Tester: continuing

parent d3d0573d
......@@ -30,7 +30,7 @@ AC_SUBST(LINPHONE_VERSION)
AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION A full featured audio/video sip phone.])
AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
AM_INIT_AUTOMAKE([1.9 tar-pax])
AM_INIT_AUTOMAKE([1.9 tar-pax subdir-objects])
AC_SUBST([LIBTOOL_DEPS])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
AC_SUBST([docdir], [${datadir}/doc])
......
mediastreamer2 @ 42916174
Subproject commit 2be165a129a174a6b9a51574aee85f90d4f38084
Subproject commit 42916174111a5db519f60d6b37ec115fef8d0436
oRTP @ 72522333
Subproject commit 3b0892f87fecbd7d3e2b34b381527ab1d7e59a59
Subproject commit 72522333e7298cb2432dfa6316097a5d19698de8
......@@ -10,7 +10,7 @@ liblinphone_HEADERS = liblinphone_tester.h
lib_LTLIBRARIES = liblinphonetester.la
liblinphonetester_la_SOURCES = tester.c \
liblinphonetester_la_SOURCES = \
accountmanager.c \
call_tester.c \
dtmf_tester.c \
......@@ -28,16 +28,17 @@ liblinphonetester_la_SOURCES = tester.c \
remote_provisioning_tester.c \
setup_tester.c \
stun_tester.c \
tester_utils.c \
transport_tester.c \
tester.c \
upnp_tester.c \
video_tester.c
video_tester.c \
common/bc_tester_utils.c common/bc_tester_utils.h
liblinphonetester_la_LDFLAGS= -no-undefined
liblinphonetester_la_LIBADD= ../coreapi/liblinphone.la $(CUNIT_LIBS)
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/coreapi
AM_CFLAGS = $(STRICT_OPTIONS) $(STRICT_OPTIONS_CC) -DIN_LINPHONE $(ORTP_CFLAGS) $(MEDIASTREAMER_CFLAGS) $(CUNIT_CFLAGS) $(BELLESIP_CFLAGS) $(LIBXML2_CFLAGS) $(SQLITE3_CFLAGS)
AM_CFLAGS = -DBC_CONFIG_FILE=\"config.h\" $(STRICT_OPTIONS) $(STRICT_OPTIONS_CC) -DIN_LINPHONE $(ORTP_CFLAGS) $(MEDIASTREAMER_CFLAGS) $(CUNIT_CFLAGS) $(BELLESIP_CFLAGS) $(LIBXML2_CFLAGS) $(SQLITE3_CFLAGS)
if BUILD_GTK_UI
......
......@@ -123,7 +123,7 @@ void account_create_on_server(Account *account, const LinphoneProxyConfig *refcf
vtable.registration_state_changed=account_created_on_server_cb;
vtable.auth_info_requested=account_created_auth_requested_cb;
lc=configure_lc_from(&vtable,tester_file_prefix,NULL,account);
lc=configure_lc_from(&vtable,bc_tester_read_dir_prefix,NULL,account);
tr.udp_port=LC_SIP_TRANSPORT_RANDOM;
tr.tcp_port=LC_SIP_TRANSPORT_RANDOM;
tr.tls_port=LC_SIP_TRANSPORT_RANDOM;
......
......@@ -1616,8 +1616,8 @@ static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* ma
}
if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
marie->lc->user_certificates_path = ms_strdup_printf("%s/certificates/marie", tester_file_prefix);
pauline->lc->user_certificates_path = ms_strdup_printf("%s/certificates/pauline", tester_file_prefix);
marie->lc->user_certificates_path = ms_strdup_printf("%s/certificates/marie", bc_tester_read_dir_prefix);
pauline->lc->user_certificates_path = ms_strdup_printf("%s/certificates/pauline", bc_tester_read_dir_prefix);
}
linphone_core_set_media_encryption(marie->lc,mode);
......@@ -2055,12 +2055,12 @@ static void call_with_file_player(void) {
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphonePlayer *player;
char hellopath[256];
char *recordpath = create_filepath(tester_writable_dir_prefix, "record", "wav");
char *recordpath = create_filepath(bc_tester_writable_dir_prefix, "record", "wav");
/*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/
unlink(recordpath);
snprintf(hellopath,sizeof(hellopath), "%s/sounds/hello8000.wav", tester_file_prefix);
snprintf(hellopath,sizeof(hellopath), "%s/sounds/hello8000.wav", bc_tester_read_dir_prefix);
/*caller uses files instead of soundcard in order to avoid mixing soundcard input with file played using call's player*/
linphone_core_use_files(marie->lc,TRUE);
......@@ -2133,12 +2133,12 @@ static void call_with_mkv_file_player(void) {
ms_warning("Test skipped, no mkv support.");
goto end;
}
recordpath = create_filepath(tester_writable_dir_prefix, "record", "wav");
recordpath = create_filepath(bc_tester_writable_dir_prefix, "record", "wav");
/*make sure the record file doesn't already exists, otherwise this test will append new samples to it*/
unlink(recordpath);
snprintf(hellowav,sizeof(hellowav), "%s/sounds/hello8000_mkv_ref.wav", tester_file_prefix);
snprintf(hellomkv,sizeof(hellomkv), "%s/sounds/hello8000.mkv", tester_file_prefix);
snprintf(hellowav,sizeof(hellowav), "%s/sounds/hello8000_mkv_ref.wav", bc_tester_read_dir_prefix);
snprintf(hellomkv,sizeof(hellomkv), "%s/sounds/hello8000.mkv", bc_tester_read_dir_prefix);
/*caller uses files instead of soundcard in order to avoid mixing soundcard input with file played using call's player*/
linphone_core_use_files(marie->lc,TRUE);
......@@ -2216,8 +2216,8 @@ void call_base(LinphoneMediaEncryption mode, bool_t enable_video,bool_t enable_r
linphone_core_set_media_encryption(marie->lc,mode);
linphone_core_set_media_encryption(pauline->lc,mode);
if (mode==LinphoneMediaEncryptionDTLS) { /* for DTLS we must access certificates or at least have a directory to store them */
marie->lc->user_certificates_path = ms_strdup_printf("%s/certificates/marie", tester_file_prefix);
pauline->lc->user_certificates_path = ms_strdup_printf("%s/certificates/pauline", tester_file_prefix);
marie->lc->user_certificates_path = ms_strdup_printf("%s/certificates/marie", bc_tester_read_dir_prefix);
pauline->lc->user_certificates_path = ms_strdup_printf("%s/certificates/pauline", bc_tester_read_dir_prefix);
}
linphone_core_set_firewall_policy(marie->lc,policy);
......@@ -2849,7 +2849,7 @@ static void record_call(const char *filename, bool_t enableVideo) {
formats = linphone_core_get_supported_file_formats(marie->lc);
for(i=0, format = formats[0]; format != NULL; i++, format = formats[i]) {
filepath = create_filepath(tester_writable_dir_prefix, filename, format);
filepath = create_filepath(bc_tester_writable_dir_prefix, filename, format);
remove(filepath);
linphone_call_params_set_record_file(marieParams, filepath);
CU_ASSERT_TRUE(call_succeeded = call_with_params(marie, pauline, marieParams, paulineParams));
......@@ -2887,7 +2887,7 @@ static void video_call_snapshot(void) {
LinphoneCallParams *marieParams = linphone_core_create_default_call_parameters(marie->lc);
LinphoneCallParams *paulineParams = linphone_core_create_default_call_parameters(pauline->lc);
LinphoneCall *callInst = NULL;
char *filename = create_filepath(tester_writable_dir_prefix, "snapshot", "jpeg");
char *filename = create_filepath(bc_tester_writable_dir_prefix, "snapshot", "jpeg");
int dummy = 0;
bool_t call_succeeded = FALSE;
......@@ -3331,8 +3331,8 @@ static void call_with_generic_cn(void) {
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
LinphoneCall *pauline_call;
char *audio_file_with_silence=ms_strdup_printf("%s/%s",tester_file_prefix,"sounds/ahbahouaismaisbon.wav");
char *recorded_file=ms_strdup_printf("%s/%s",tester_writable_dir_prefix,"result.wav");
char *audio_file_with_silence=ms_strdup_printf("%s/%s",bc_tester_read_dir_prefix,"sounds/ahbahouaismaisbon.wav");
char *recorded_file=ms_strdup_printf("%s/%s",bc_tester_writable_dir_prefix,"result.wav");
belle_sip_object_enable_leak_detector(TRUE);
begin=belle_sip_object_get_object_count();
......
......@@ -16,27 +16,29 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define tester_fprintf fprintf
#define ms_warning printf
#define ms_fatal abort
#include "tester_utils.h"
/* this must be provided at compile time*/
#include BC_CONFIG_FILE
#include "bc_tester_utils.h"
#include <stdarg.h>
#include <stdlib.h>
#include "CUnit/Automated.h"
#if WINAPI_FAMILY_PHONE_APP
const char *tester_file_prefix="Assets";
const char *bc_tester_read_dir_prefix="Assets";
#elif defined(__QNX__)
const char *tester_file_prefix="./app/native/assets/";
const char *bc_tester_read_dir_prefix="./app/native/assets/";
#else
const char *tester_file_prefix=".";
const char *bc_tester_read_dir_prefix=".";
#endif
/* TODO: have the same "static" for QNX and windows as above? */
#ifdef ANDROID
const char *tester_writable_dir_prefix = "/data/data/org.linphone.tester/cache";
const char *bc_tester_writable_dir_prefix = "/data/data/org.linphone.tester/cache";
#else
const char *tester_writable_dir_prefix = ".";
const char *bc_tester_writable_dir_prefix = ".";
#endif
static test_suite_t **test_suite = NULL;
......@@ -46,112 +48,44 @@ static int nb_test_suites = 0;
static unsigned char curses = 0;
#endif
int tester_use_log_file = 0;
char* tester_xml_file = NULL;
int tester_xml_enabled = FALSE;
char* xml_file = NULL;
int xml_enabled = 0;
char * suite_name;
char * test_name;
void helper(const char *name, const char* additionnal_helper) {
fprintf(stderr,"%s --help\n"
"\t\t\t--verbose\n"
"\t\t\t--silent\n"
"\t\t\t--list-suites\n"
"\t\t\t--list-tests <suite>\n"
"\t\t\t--suite <suite name>\n"
"\t\t\t--test <test name>\n"
"\t\t\t--log-file <output log file path>\n"
#if HAVE_CU_CURSES
"\t\t\t--curses\n"
#endif
"\t\t\t--xml\n"
"\t\t\t--xml-file <xml file prefix (will be suffixed by '-Results.xml')>\n"
"And additionnaly:\n"
"%s"
, name
, additionnal_helper);
void (*tester_printf_va)(int level, const char *fmt, va_list args);
int verbosity_info;
int verbosity_error;
static void tester_printf(int level, const char *fmt, ...) {
va_list args;
va_start (args, fmt);
tester_printf_va(level, fmt, args);
va_end (args);
}
int parge_args(int argc, char **argv, int argid, const char * additionnal_helper)
{
int i = argid;
static int tester_run_suite(test_suite_t *suite) {
int i;
if (strcmp(argv[i],"--help")==0){
helper(argv[0], additionnal_helper);
return -1;
// } else if (strcmp(argv[i],"--verbose")==0){
// linphone_core_set_log_level(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
// } else if (strcmp(argv[i],"--silent")==0){
// linphone_core_set_log_level(ORTP_FATAL);
} else if (strcmp(argv[i],"--test")==0){
CHECK_ARG("--test", ++i, argc);
test_name=argv[i];
}else if (strcmp(argv[i],"--suite")==0){
CHECK_ARG("--suite", ++i, argc);
suite_name=argv[i];
} else if (strcmp(argv[i],"--list-suites")==0){
tester_list_suites();
return -1;
} else if (strcmp(argv[i],"--list-tests")==0){
CHECK_ARG("--list-tests", ++i, argc);
suite_name = argv[i];
tester_list_suite_tests(suite_name);
return -1;
} else if (strcmp(argv[i], "--xml-file") == 0){
CHECK_ARG("--xml-file", ++i, argc);
tester_xml_file = argv[i];
tester_xml_enabled = 1;
} else if (strcmp(argv[i], "--xml") == 0){
tester_xml_enabled = 1;
} else if (strcmp(argv[i],"--log-file")==0){
CHECK_ARG("--log-file", ++i, argc);
FILE *log_file=fopen(argv[i],"w");
if (!log_file) {
ms_fatal("Cannot open file [%s] for writting logs because [%s]",argv[i],strerror(errno));
} else {
tester_use_log_file=1;
tester_fprintf(stdout,"Redirecting traces to file [%s]",argv[i]);
// linphone_core_set_log_file(log_file);
}
}else {
tester_fprintf(stderr, "Unknown option \"%s\"\n", argv[i]);
helper(argv[0], additionnal_helper);
return -2;
}
CU_pSuite pSuite = CU_add_suite(suite->name, suite->init_func, suite->cleanup_func);
if( tester_xml_enabled && (suite_name || test_name) ){
printf("Cannot use both xml and specific test suite\n");
return -1;
for (i = 0; i < suite->nb_tests; i++) {
if (NULL == CU_add_test(pSuite, suite->tests[i].name, suite->tests[i].func)) {
return CU_get_error();
}
}
/* returns number of arguments read */
return i - argid;
return 0;
}
int tester_start() {
int ret;
char * xml_tmp_file;
if( tester_xml_enabled ){
xml_tmp_file = ms_strdup_printf("%s.tmp", tester_xml_file);
}
ret = tester_run_tests(suite_name, test_name);
tester_uninit();
if ( tester_xml_enabled ) {
/*create real xml file only if tester did not crash*/
ms_strcat_printf(xml_tmp_file, "-Results.xml");
rename(xml_tmp_file, tester_xml_file);
ms_free(xml_tmp_file);
}
return ret;
const char * tester_test_suite_name(int suite_index) {
if (suite_index >= nb_test_suites) return NULL;
return test_suite[suite_index]->name;
}
int tester_test_suite_index(const char *suite_name) {
static int tester_test_suite_index(const char *suite_name) {
int i;
for (i = 0; i < tester_nb_test_suites(); i++) {
for (i = 0; i < nb_test_suites; i++) {
if ((strcmp(suite_name, test_suite[i]->name) == 0) && (strlen(suite_name) == strlen(test_suite[i]->name))) {
return i;
}
......@@ -159,170 +93,132 @@ int tester_test_suite_index(const char *suite_name) {
return -1;
}
void tester_list_suites() {
int j;
for(j=0;j<tester_nb_test_suites();j++) {
tester_fprintf(stdout, "%s\n", tester_test_suite_name(j));
}
}
void tester_list_suite_tests(const char *suite_name) {
int j;
for( j = 0; j < tester_nb_tests(suite_name); j++) {
const char *test_name = tester_test_name(suite_name, j);
tester_fprintf(stdout, "%s\n", test_name);
}
}
int tester_test_index(const char *suite_name, const char *test_name) {
int j,i;
j = tester_test_suite_index(suite_name);
if(j != -1) {
for (i = 0; i < test_suite[j]->nb_tests; i++) {
if ((strcmp(test_name, test_suite[j]->tests[i].name) == 0) && (strlen(test_name) == strlen(test_suite[j]->tests[i].name))) {
return i;
}
}
}
return -1;
}
int tester_nb_test_suites(void) {
return nb_test_suites;
const char * tester_test_name(const char *suite_name, int test_index) {
int suite_index = tester_test_suite_index(suite_name);
if ((suite_index < 0) || (suite_index >= nb_test_suites)) return NULL;
if (test_index >= test_suite[suite_index]->nb_tests) return NULL;
return test_suite[suite_index]->tests[test_index].name;
}
int tester_nb_tests(const char *suite_name) {
static int tester_nb_tests(const char *suite_name) {
int i = tester_test_suite_index(suite_name);
if (i < 0) return 0;
return test_suite[i]->nb_tests;
}
const char * tester_test_suite_name(int suite_index) {
if (suite_index >= tester_nb_test_suites()) return NULL;
return test_suite[suite_index]->name;
static void tester_list_suites() {
int j;
for(j=0;j<nb_test_suites;j++) {
fprintf(stdout, "%s\n", tester_test_suite_name(j));
}
}
const char * tester_test_name(const char *suite_name, int test_index) {
int suite_index = tester_test_suite_index(suite_name);
if ((suite_index < 0) || (suite_index >= tester_nb_test_suites())) return NULL;
if (test_index >= test_suite[suite_index]->nb_tests) return NULL;
return test_suite[suite_index]->tests[test_index].name;
static void tester_list_suite_tests(const char *suite_name) {
int j;
for( j = 0; j < tester_nb_tests(suite_name); j++) {
const char *test_name = tester_test_name(suite_name, j);
fprintf(stdout, "%s\n", test_name);
}
}
static void test_all_tests_complete_message_handler(const CU_pFailureRecord pFailure) {
static void all_complete_message_handler(const CU_pFailureRecord pFailure) {
#ifdef HAVE_CU_GET_SUITE
char * results = CU_get_run_results_string();
if (liblinphone_tester_use_log_file) {
ms_warning("\n\n %s", results);
}
tester_fprintf(stdout,"\n\n %s",results);
ms_free(results);
tester_printf(verbosity_info,"\n%s",results);
free(results);
#endif
}
static void test_suite_init_failure_message_handler(const CU_pSuite pSuite) {
if (liblinphone_tester_use_log_file) ms_warning("Suite initialization failed for [%s].", pSuite->pName);
tester_fprintf(stdout,"Suite initialization failed for [%s].", pSuite->pName);
static void suite_init_failure_message_handler(const CU_pSuite pSuite) {
tester_printf(verbosity_error,"Suite initialization failed for [%s].", pSuite->pName);
}
static void test_suite_cleanup_failure_message_handler(const CU_pSuite pSuite) {
if (liblinphone_tester_use_log_file) ms_warning("Suite cleanup failed for '%s'.", pSuite->pName);
tester_fprintf(stdout,"Suite cleanup failed for [%s].", pSuite->pName);
static void suite_cleanup_failure_message_handler(const CU_pSuite pSuite) {
tester_printf(verbosity_error,"Suite cleanup failed for [%s].", pSuite->pName);
}
#ifdef HAVE_CU_GET_SUITE
static void test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSuite) {
if (liblinphone_tester_use_log_file) ms_warning("Suite [%s] Test [%s]", pSuite->pName,pTest->pName);
tester_fprintf(stdout,"\nSuite [%s] Test [%s]\n", pSuite->pName,pTest->pName);
static void suite_start_message_handler(const CU_pSuite pSuite) {
tester_printf(verbosity_info,"Suite [%s] started\n", pSuite->pName);
}
static void suite_complete_message_handler(const CU_pSuite pSuite, const CU_pFailureRecord pFailure) {
tester_printf(verbosity_info,"Suite [%s] ended\n", pSuite->pName);
}
static void test_suite_start_message_handler(const CU_pSuite pSuite) {
if (liblinphone_tester_use_log_file) ms_warning("Suite [%s]", pSuite->pName);
tester_fprintf(stdout,"\nSuite [%s]", pSuite->pName);
static void test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSuite) {
tester_printf(verbosity_info,"Suite [%s] Test [%s] started", pSuite->pName,pTest->pName);
}
#endif
/*derivated from cunit*/
static void test_complete_message_handler(const CU_pTest pTest,
const CU_pSuite pSuite,
const CU_pFailureRecord pFailureList) {
int i;
char * result = malloc(sizeof(char)*2048);//not very pretty but...
sprintf(result, "Suite [%s] Test [%s]", pSuite->pName, pTest->pName);
CU_pFailureRecord pFailure = pFailureList;
if (pFailure) {
if (liblinphone_tester_use_log_file) ms_warning("Suite [%s], Test [%s] had failures:", pSuite->pName, pTest->pName);
tester_fprintf(stdout,"\nSuite [%s], Test [%s] had failures:", pSuite->pName, pTest->pName);
} else {
if (liblinphone_tester_use_log_file) ms_warning(" passed");
tester_fprintf(stdout," passed");
}
for (i = 1 ; (NULL != pFailure) ; pFailure = pFailure->pNext, i++) {
if (liblinphone_tester_use_log_file) ms_warning("\n %d. %s:%u - %s", i,
(NULL != pFailure->strFileName) ? pFailure->strFileName : "",
pFailure->uiLineNumber,
(NULL != pFailure->strCondition) ? pFailure->strCondition : "");
tester_fprintf(stdout,"\n %d. %s:%u - %s", i,
strncat(result, " failed:", strlen(" failed:"));
for (i = 1 ; (NULL != pFailure) ; pFailure = pFailure->pNext, i++) {
sprintf(result, "%s\n %d. %s:%u - %s", result, i,
(NULL != pFailure->strFileName) ? pFailure->strFileName : "",
pFailure->uiLineNumber,
(NULL != pFailure->strCondition) ? pFailure->strCondition : "");
}
} else {
strncat(result, " passed", strlen(" passed"));
}
tester_printf(verbosity_info,"%s\n", result);
free(result);
}
#endif
int tester_run_tests(const char *suite_name, const char *test_name) {
static int tester_run_tests(const char *suite_name, const char *test_name) {
int i;
int ret;
/* initialize the CUnit test registry */
/* initialize the CUnit test registry */
if (CUE_SUCCESS != CU_initialize_registry())
return CU_get_error();
for (i = 0; i < tester_nb_test_suites(); i++) {
for (i = 0; i < nb_test_suites; i++) {
tester_run_suite(test_suite[i]);
}
#ifdef HAVE_CU_GET_SUITE
CU_set_suite_start_handler(suite_start_message_handler);
CU_set_suite_complete_handler(suite_complete_message_handler);
CU_set_test_start_handler(test_start_message_handler);
#endif
CU_set_test_complete_handler(test_complete_message_handler);
CU_set_all_test_complete_handler(test_all_tests_complete_message_handler);
CU_set_suite_init_failure_handler(test_suite_init_failure_message_handler);
CU_set_suite_cleanup_failure_handler(test_suite_cleanup_failure_message_handler);
#ifdef HAVE_CU_GET_SUITE
CU_set_suite_start_handler(test_suite_start_message_handler);
#endif
if( tester_xml_file != NULL ){
CU_set_output_filename(tester_xml_file);
}
if( tester_xml_enabled != 0 ){
CU_set_all_test_complete_handler(all_complete_message_handler);
CU_set_suite_init_failure_handler(suite_init_failure_message_handler);
CU_set_suite_cleanup_failure_handler(suite_cleanup_failure_message_handler);
if( xml_enabled != 0 ){
CU_automated_run_tests();
} else {
#if !HAVE_CU_GET_SUITE
if( suite_name ){
ms_warning("Tester compiled without CU_get_suite() function, running all tests instead of suite '%s'\n", suite_name);
tester_printf(verbosity_info, "Tester compiled without CU_get_suite() function, running all tests instead of suite '%s'", suite_name);
}
#else
if (!test_name && suite_name && strcmp("Call",suite_name) == 0) {
/*special case for suite Call which is now splitted into simple and multi*/
CU_run_suite(CU_get_suite("Single call"));
CU_run_suite(CU_get_suite("Multi call"));
} else if (suite_name){
if (suite_name){
CU_pSuite suite;
suite=CU_get_suite(suite_name);
if (!suite) {
ms_error("Could not find suite '%s'. Available suites are:", suite_name);
liblinphone_tester_list_suites();
tester_printf(verbosity_error, "Could not find suite '%s'. Available suites are:", suite_name);
tester_list_suites();
return -1;
} else if (test_name) {
CU_pTest test=CU_get_test_by_name(test_name, suite);
if (!test) {
ms_error("Could not find test '%s' in suite '%s'. Available tests are:", test_name, suite_name);
// do not use suite_name here, since this method is case sensitive
liblinphone_tester_list_suite_tests(suite->pName);
tester_printf(verbosity_error, "Could not find test '%s' in suite '%s'. Available tests are:", test_name, suite_name);
// do not use suite_name here, since this method is case sensitive
tester_list_suite_tests(suite->pName);
return -2;
} else {
CU_ErrorCode err= CU_run_test(suite, test);
if (err != CUE_SUCCESS) ms_error("CU_basic_run_test error %d", err);
if (err != CUE_SUCCESS) tester_printf(verbosity_error, "CU_basic_run_test error %d", err);
}
} else {
CU_run_suite(suite);
......@@ -339,26 +235,93 @@ int tester_run_tests(const char *suite_name, const char *test_name) {
else
#endif
{
/* Run all tests using the CUnit Basic interface */
/* Run all tests using the CUnit Basic interface */
CU_run_all_tests();
}
}
}
return CU_get_number_of_tests_failed()!=0;
}
void bc_tester_helper(const char *name, const char* additionnal_helper) {
fprintf(stdout,"%s --help\n"
"\t\t\t--list-suites\n"
"\t\t\t--list-tests <suite>\n"
"\t\t\t--suite <suite name>\n"
"\t\t\t--test <test name>\n"
#if HAVE_CU_CURSES
"\t\t\t--curses\n"
#endif
"\t\t\t--xml\n"
"\t\t\t--xml-file <xml file prefix (will be suffixed by '-Results.xml')>\n"
"And additionally:\n"
"%s"
, name
, additionnal_helper);
}
void bc_tester_init(void (*ftester_printf)(int level, const char *fmt, va_list args), int iverbosity_info, int iverbosity_error) {
tester_printf_va = ftester_printf;
verbosity_error = iverbosity_error;
verbosity_info = iverbosity_info;
}
int bc_tester_parse_args(int argc, char **argv, int argid)
{
int i = argid;
if (strcmp(argv[i],"--help")==0){
return -1;
} else if (strcmp(argv[i],"--test")==0){
CHECK_ARG("--test", ++i, argc);
test_name=argv[i];
}else if (strcmp(argv[i],"--suite")==0){
CHECK_ARG("--suite", ++i, argc);
suite_name=argv[i];
} else if (strcmp(argv[i],"--list-suites")==0){
tester_list_suites();
return 0;
} else if (strcmp(argv[i],"--list-tests")==0){
CHECK_ARG("--list-tests", ++i, argc);
suite_name = argv[i];