Commit d249550e authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

Fix log collection test suite for Android

parent e45b7bc3
No related merge requests found
Showing with 70 additions and 19 deletions
......@@ -14,6 +14,7 @@ common_SRC_FILES := \
tester.c \
remote_provisioning_tester.c \
quality_reporting_tester.c \
log_collection_tester.c \
transport_tester.c \
player_tester.c \
dtmf_tester.c
......
oRTP @ 91309922
Subproject commit a8dcd5b3ee563b5746199a605b94459308f5d009
Subproject commit 913099228e4f6faf92669e03e209c6ab19268bdd
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
Copyright (C) 2010 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
......@@ -27,6 +27,63 @@
#include "private.h"
#include "liblinphone_tester.h"
/*getline is not available on android...*/
#ifdef ANDROID
/* This code is public domain -- Will Hartung 4/9/09 */
size_t getline(char **lineptr, size_t *n, FILE *stream) {
char *bufptr = NULL;
char *p = bufptr;
size_t size;
int c;
if (lineptr == NULL) {
return -1;
}
if (stream == NULL) {
return -1;
}
if (n == NULL) {
return -1;
}
bufptr = *lineptr;
size = *n;
c = fgetc(stream);
if (c == EOF) {
return -1;
}
if (bufptr == NULL) {
bufptr = malloc(128);
if (bufptr == NULL) {
return -1;
}
size = 128;
}
p = bufptr;
while(c != EOF) {
if ((p - bufptr) > (size - 1)) {
size = size + 128;
bufptr = realloc(bufptr, size);
if (bufptr == NULL) {
return -1;
}
}
*p++ = c;
if (c == '\n') {
break;
}
c = fgetc(stream);
}
*p++ = '\0';
*lineptr = bufptr;
*n = size;
return p - bufptr - 1;
}
#endif
LinphoneCoreManager* setup(bool_t enable_logs) {
LinphoneCoreManager *marie;
int timeout = 300;
......@@ -65,13 +122,11 @@ time_t check_file(char * filepath) {
if (strlen(line) > 24) {
char date[24] = {'\0'};
memcpy(date, line, 23);
#ifndef ANDROID
if (strptime(date, "%Y-%m-%d %H:%M:%S", &tm_curr) != NULL) {
time_curr = mktime(&tm_curr);
CU_ASSERT_TRUE(time_curr >= time_prev);
time_prev = time_curr;
}
#endif
}
}
CU_ASSERT_TRUE(line_count > 25);
......@@ -80,12 +135,7 @@ time_t check_file(char * filepath) {
ms_free(filepath);
}
// return latest time in file
#ifdef ANDROID
ms_warning("fix me: Use mktime function on android");
return ms_time(0); //should be fixed
#else
return time_curr;
#endif
}
static LinphoneLogCollectionState old_collection_state;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment