Jelajahi Sumber

Unit test: print multiple log files

bel2125 7 tahun lalu
induk
melakukan
e0e9410f7b
3 mengubah file dengan 10 tambahan dan 7 penghapusan
  1. 4 4
      .travis.yml
  2. 4 1
      appveyor.yml
  3. 2 2
      unittest/main.c

+ 4 - 4
.travis.yml

@@ -105,10 +105,10 @@ script:
     fi
   - pwd
   - ls -la unittest
-  - if [ "${MACOSX_PACKAGE}" != "1" ]; then
-      cat unittest/test-*.log;
-      cat unittest/test-*.xml;
-    fi
+  - echo "Show all test logs:"
+  - for f in unittest/test-*.log; do echo $f; cat $f; done
+  - for f in unittest/test-*.xml; do echo $f; cat $f; done
+  - echo "Build and test script DONE"
 
 # Coveralls options: https://github.com/eddyxu/cpp-coveralls/blob/master/README.md
 after_success:

+ 4 - 1
appveyor.yml

@@ -365,13 +365,16 @@ test_script:
   - cmd /c "%test%" & set "test_ret=%ERRORLEVEL%"
   - echo "Test returned %test_ret%"
   - dir "%source_path%\output\build\unittest\"
-  - for /r %%i in ("%source_path%\output\build\unittest\test-*") do (type %%i)
+  - echo "Show all test logs:"
+  - for /r %%i in ("%source_path%\output\build\unittest\test-*.log") do (echo %%i & type %%i)
+  - for /r %%i in ("%source_path%\output\build\unittest\test-*.xml") do (echo %%i & type %%i)
   - cd "%source_path%"
   - set "output_path=%source_path%\output"
   - set "build_path=%output_path%\build"
   - set "install_path=%output_path%\install"
   - set "third_party_dir=C:\third-party"
   - exit /B %ERRORLEVEL%
+  - echo "Test script DONE"
 
 after_test:
   - echo "Current directory:"

+ 2 - 2
unittest/main.c

@@ -118,7 +118,7 @@ main(const int argc, char *argv[])
 		/* Find the next free log name */
 		FILE *f;
 		for (i = 1;; i++) {
-			sprintf(test_log_name, "test-%i.log", i);
+			sprintf(test_log_name, "test-%03i.log", i);
 			f = fopen(test_log_name, "r");
 			if (f) {
 				/* already exists */
@@ -126,7 +126,7 @@ main(const int argc, char *argv[])
 				continue;
 			}
 			srunner_set_log(srunner, test_log_name);
-			sprintf(test_xml_name, "test-%i.xml", i);
+			sprintf(test_xml_name, "test-%03i.xml", i);
 			srunner_set_xml(srunner, test_xml_name);
 			break;
 		}