util: Add a README file for the m5 utility.
[gem5.git] / util / compiler-tests.sh
index a574fd386047f46f582f29ddb0256e0399f8bab2..f8d4f5d0dc36a5da14c5531ff694e64f39f73f92 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
@@ -100,8 +102,8 @@ for compiler in ${images[@]}; do
         for build_opt in ${opts[@]}; do
             build="${builds[$build_index]}"
             build_out="build/$build/gem5$build_opt"
-            build_stdout="${test_dir}/${compiler}/${build}${build_opt}.stdout"
-            build_stderr="${test_dir}/${compiler}/${build}${build_opt}.stderr"
+            build_stdout="${test_dir}/${compiler}/${build}${build_opt}.stdout.txt"
+            build_stderr="${test_dir}/${compiler}/${build}${build_opt}.stderr.txt"
 
             # Clean the build
             rm -rf "${build_dir}"
@@ -114,13 +116,15 @@ for compiler in ${images[@]}; do
             # Build with container
             {
                 docker run --rm -v "${gem5_root}":"/gem5" -u $UID:$GID \
-                    -w /gem5 $repo_name scons "${build_out}" "${build_args}"
+                    -w /gem5 $repo_name /usr/bin/env python3 /usr/bin/scons \
+                    "${build_out}" "${build_args}"
             }>"${build_stdout}" 2>"${build_stderr}"
             result=$?
 
             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 +134,5 @@ for compiler in ${images[@]}; do
 done
 
 mv "${test_dir}" "${test_dir_final}"
+
+exit ${exit_code}