Преглед изворни кода

Notify user if unit tests fail

Vecna пре 4 месеци
родитељ
комит
46f6bb5902
1 измењених фајлова са 22 додато и 4 уклоњено
  1. 22 4
      scripts/test.sh

+ 22 - 4
scripts/test.sh

@@ -18,22 +18,40 @@ cp parsing-results/table-header.tex test-table.tex && \
 docker stop tp-analysis-test
 
 # Unit tests for the three versions of Lox
+allpassed=true
+
 docker run --name "lox-old-test" --rm -d -i lox-old:latest || exit 1
 for i in open_invite trust_promotion level0_migration level_up issue_invite redeem_invite mark_unreachable blockage_migration; do
-    docker exec lox-old-test cargo test --release --features fast test_$i 2> /dev/null | grep "$i"
+    result=$(docker exec lox-old-test cargo test --release --features fast test_$i 2> /dev/null | grep "$i")
+    echo "$result"
+    if [[ "$result" != *" ... ok" ]]; then
+        allpassed=false
+    fi
 done
 docker stop lox-old-test
 
 docker run --name "lox-new-test" --rm -d -i lox-new:latest || exit 1
 for i in check_blockage issue_invite redeem_invite trust_migration update_cred level_up blockage_migration open_invitation update_invite trust_promotion; do
-    docker exec lox-new-test cargo test --release --features bridgeauth,test,fast test_$i 2> /dev/null | grep "$i"
+    result=$(docker exec lox-new-test cargo test --release --features bridgeauth,test,fast test_$i 2> /dev/null | grep "$i")
+    echo "$result"
+    if [[ "$result" != *" ... ok" ]]; then
+        allpassed=false
+    fi
 done
 docker stop lox-new-test
 
 docker run --name "troll-patrol-test" --rm -d -i troll-patrol:latest || exit 1
 for i in check_blockage issue_invite redeem_invite trust_migration update_cred level_up blockage_migration open_invitation update_invite trust_promotion report_protocols; do
-    docker exec troll-patrol-test cargo test --release --features bridgeauth,test,fast test_$i 2> /dev/null | grep "$i"
+    result=$(docker exec troll-patrol-test cargo test --release --features bridgeauth,test,fast test_$i 2> /dev/null | grep "$i")
+    echo "$result"
+    if [[ "$result" != *" ... ok" ]]; then
+        allpassed=false
+    fi
 done
 docker stop troll-patrol-test
 
-echo "Everything seems to be set up correctly!"
+if [ "$allpassed" == "true" ]; then
+    echo "Everything seems to be set up correctly!"
+else
+    echo "Some tests failed."
+fi