Rename --junit and --junit-file to --xml and --xml-file

parent b1389019
......@@ -40,3 +40,4 @@ tester/belle_sip_tester
tester/belle_http_get
tester/belle_sip_resolve
tester/CUnitAutomated-Results.xml
......@@ -35,7 +35,6 @@ extern const char *test_domain;
extern const char *auth_domain;
static const char *belle_sip_tester_root_ca_path = NULL;
static const char *belle_sip_tester_junit_file = NULL;
static test_suite_t **test_suite = NULL;
static int nb_test_suites = 0;
static int belle_sip_tester_use_log_file=0;
......@@ -50,7 +49,8 @@ const char *belle_sip_tester_writable_dir_prefix = ".";
static unsigned char curses = 0;
#endif
static unsigned char junit = 0;
static const char *belle_sip_tester_xml_file = NULL;
static unsigned char belle_sip_tester_xml_enabled = FALSE;
static void add_test_suite(test_suite_t *suite) {
......@@ -163,8 +163,8 @@ void belle_sip_tester_set_root_ca_path(const char *root_ca_path) {
belle_sip_tester_root_ca_path = root_ca_path;
}
void belle_sip_tester_set_junit_output(const char *junit_path ) {
belle_sip_tester_junit_file = junit_path;
void belle_sip_tester_set_xml_output(const char *xml_path ) {
belle_sip_tester_xml_file = xml_path;
}
......@@ -234,7 +234,7 @@ static void test_suite_start_message_handler(const CU_pSuite pSuite) {
int belle_sip_tester_run_tests(const char *suite_name, const char *test_name) {
int i,ret;
belle_sip_object_pool_t *pool;
/* initialize the CUnit test registry */
if (CUE_SUCCESS != CU_initialize_registry())
return CU_get_error();
......@@ -250,12 +250,12 @@ int belle_sip_tester_run_tests(const char *suite_name, const char *test_name) {
CU_set_suite_cleanup_failure_handler(test_suite_cleanup_failure_message_handler);
CU_set_suite_start_handler(test_suite_start_message_handler);
if( belle_sip_tester_junit_file != NULL ){
CU_set_output_filename(belle_sip_tester_junit_file);
if(belle_sip_tester_xml_file != NULL){
CU_set_output_filename(belle_sip_tester_xml_file);
}
if( junit ){
if(belle_sip_tester_xml_enabled){
CU_automated_run_tests();
} else {
} else {
#ifdef HAVE_CU_GET_SUITE
if (suite_name){
CU_pSuite suite;
......@@ -312,8 +312,8 @@ void helper(const char *name) {
#ifdef HAVE_CU_CURSES
"\t\t\t--curses\n"
#endif
"\t\t\t--junit\n"
"\t\t\t--junit-file <junit file prefix (will be suffixed by '-Results.xml')>\n"
"\t\t\t--xml\n"
"\t\t\t--xml-file <xml file prefix (will be suffixed by '-Results.xml')>\n"
, name);
}
......@@ -331,7 +331,7 @@ int main (int argc, char *argv[]) {
const char *root_ca_path = NULL;
const char *suite_name=NULL;
const char *test_name=NULL;
const char *junit_file=NULL;
const char *xml_file=NULL;
const char *env_domain=getenv("TEST_DOMAIN");
FILE* log_file=NULL;
......@@ -366,11 +366,11 @@ int main (int argc, char *argv[]) {
} else if (strcmp(argv[i], "--root-ca") == 0) {
CHECK_ARG("--root-ca", ++i, argc);
root_ca_path = argv[i];
} else if (strcmp(argv[i], "--junit-file") == 0){
CHECK_ARG("--junit-file", ++i, argc);
junit_file = argv[i];
} else if (strcmp(argv[i], "--junit") == 0){
junit = 1;
} else if (strcmp(argv[i], "--xml-file") == 0){
CHECK_ARG("--xml-file", ++i, argc);
xml_file = argv[i];
} else if (strcmp(argv[i], "--xml") == 0){
belle_sip_tester_xml_enabled = 1;
}
#ifdef HAVE_CU_GET_SUITE
else if (strcmp(argv[i],"--list-suites")==0){
......@@ -409,19 +409,19 @@ int main (int argc, char *argv[]) {
}
#ifdef HAVE_CU_CURSES
if( junit && curses ){
printf("Cannot use both junit and curses\n");
if( xml && curses ){
printf("Cannot use both xml and curses\n");
return -1;
}
#endif
if( junit && (suite_name || test_name) ){
printf("Cannot use both junit and specific test suite\n");
if( belle_sip_tester_xml_enabled && (suite_name || test_name) ){
printf("Cannot use both xml and specific test suite\n");
return -1;
}
if( junit_file != NULL ){
belle_sip_tester_set_junit_output(junit_file);
if( xml_file != NULL ){
belle_sip_tester_set_xml_output(xml_file);
}
belle_sip_tester_set_root_ca_path(root_ca_path);
ret = belle_sip_tester_run_tests(suite_name, test_name);
......
Markdown is supported
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