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

Do not write XML tests output until end of execution to avoid corrupted XML in case of crash (bis)

parent 5a9e7e66
......@@ -163,7 +163,7 @@ int main (int argc, char *argv[])
int ret;
const char *suite_name=NULL;
const char *test_name=NULL;
const char *xml_file=NULL;
const char *xml_file="CUnitAutomated-Results.xml";
char *xml_tmp_file=NULL;
int xml = 0;
FILE* log_file=NULL;
......@@ -214,7 +214,6 @@ int main (int argc, char *argv[])
} else if (strcmp(argv[i], "--xml-file") == 0){
CHECK_ARG("--xml-file", ++i, argc);
xml_file = argv[i];
xml_tmp_file = ms_strdup_printf("%s.tmp", argv[i]);
} else if (strcmp(argv[i], "--xml") == 0){
xml = 1;
} else if (strcmp(argv[i],"--log-file")==0){
......@@ -240,7 +239,8 @@ int main (int argc, char *argv[])
return -1;
}
if( xml_tmp_file != NULL ){
if( xml ){
xml_tmp_file = ms_strdup_printf("%s.tmp", xml_file);
liblinphone_tester_set_xml_output(xml_tmp_file);
}
liblinphone_tester_enable_xml(xml);
......@@ -249,8 +249,9 @@ int main (int argc, char *argv[])
ret = liblinphone_tester_run_tests(suite_name, test_name);
liblinphone_tester_uninit();
if (xml_tmp_file != NULL) {
if ( xml ) {
/*create real xml file only if tester did not crash*/
ms_strcat_printf(xml_tmp_file, "-Results.xml");
rename(xml_tmp_file, xml_file);
ms_free(xml_tmp_file);
}
......
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