run_tests.*: fail test on compilation error
authorPavel Orekhov <p.orekhov@partnet.samsung.com>
Tue, 20 Oct 2020 14:32:44 +0000 (17:32 +0300)
committerAlexander Soldatov/Platform Lab /SRR/Staff Engineer/Samsung Electronics <soldatov.a@samsung.com>
Thu, 5 Nov 2020 10:00:18 +0000 (13:00 +0300)
Run every test only if it's build is successfull.
Else count it as failed it with "build error" message.

test-suite/run_tests.ps1
test-suite/run_tests.sh

index 6138c167ec95f08433e1fc56e31544253a0f9f95..a17a3c8034075c97837736fe1d0b6d7147623c91 100644 (file)
@@ -51,6 +51,9 @@ if ($TEST_NAMES.count -eq 0) {
 
 # Prepare
 dotnet build TestRunner
+if ($lastexitcode -ne 0) {
+    throw ("Exec build test: " + $errorMessage)
+}
 
 $test_pass = 0
 $test_fail = 0
@@ -59,6 +62,11 @@ $test_list = ""
 # Build, push and run tests
 foreach ($TEST_NAME in $TEST_NAMES) {
     dotnet build $TEST_NAME
+    if ($lastexitcode -ne 0) {
+        $test_fail++
+        $test_list = "$test_list$TEST_NAME ... failed: build error`n"
+        continue
+    }
 
     $SOURCE_FILE_LIST = (Get-ChildItem -Path "$TEST_NAME" -Recurse -Filter *.cs | Where {$_.FullName -notlike "*\obj\*"} | Resolve-path -relative).Substring(2)
 
index c75e2c806d99919fe75dbf9a15121ca589938b7e..d34634ef9b6380dd26093f5b35a0ececd91353a2 100755 (executable)
@@ -48,14 +48,19 @@ if [[ -z $TEST_NAMES ]]; then
     TEST_NAMES="${ALL_TEST_NAMES[@]}"
 fi
 
-dotnet build TestRunner
+dotnet build TestRunner || exit $?
 
 test_pass=0
 test_fail=0
 test_list=""
 
 for TEST_NAME in $TEST_NAMES; do
-    dotnet build $TEST_NAME
+    dotnet build $TEST_NAME || {
+        echo "$TEST_NAME: build error." >&2
+        test_fail=$(($test_fail + 1))
+        test_list="$test_list$TEST_NAME ... failed: build error\n"
+        continue
+    }
 
     SOURCE_FILES=$(find $TEST_NAME \! -path "$TEST_NAME/obj/*" -type f -name "*.cs" -printf '%p;')