util,tests: Added exit code to the compiler tests
authorBobby R. Bruce <bbruce@ucdavis.edu>
Mon, 3 Aug 2020 23:22:59 +0000 (16:22 -0700)
committerBobby R. Bruce <bbruce@ucdavis.edu>
Mon, 24 Aug 2020 22:52:06 +0000 (22:52 +0000)
This testing script should return a non-exit code when one of the
compilations fail.

Change-Id: Ie15bc5779372dd31d784eaffdee4b04abb9a1b11
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32097
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
util/compiler-tests.sh

index a574fd386047f46f582f29ddb0256e0399f8bab2..cd47bd9368a51cdcde2d76ef55478123809e193c 100755 (executable)
@@ -74,6 +74,8 @@ mkdir "${test_dir}"
 touch "${exits}"
 echo "compiler,build_target,exit_code" >> "${exits}"
 
+exit_code=0 # We return a non-zero exit code if any of the compilations fail.
+
 for compiler in ${images[@]}; do
     echo "Starting build tests with '${compiler}'..."
     # Generate a randomized list of build targets
@@ -121,6 +123,7 @@ for compiler in ${images[@]}; do
             echo "${compiler},${build}/gem5${build_opt},${result}" >>"${exits}"
 
             if [ ${result} -ne 0 ]; then
+                exit_code=1
                 echo "  ! Failed with exit code ${result}."
             else
                 echo "    Done."
@@ -130,3 +133,5 @@ for compiler in ${images[@]}; do
 done
 
 mv "${test_dir}" "${test_dir_final}"
+
+exit ${exit_code}