mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 12:08:11 +00:00
Fix log collection test suite for Android
This commit is contained in:
parent
e45b7bc3f0
commit
d249550e0a
3 changed files 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
|
||||
|
|
|
|||
2
oRTP
2
oRTP
|
|
@ -1 +1 @@
|
|||
Subproject commit a8dcd5b3ee563b5746199a605b94459308f5d009
|
||||
Subproject commit 913099228e4f6faf92669e03e209c6ab19268bdd
|
||||
|
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue