From: Bobby R. Bruce Date: Sat, 18 Jul 2020 06:02:37 +0000 (-0700) Subject: util,tests: Updated compiler-tests to support paths with spaces X-Git-Tag: v20.1.0.0~414 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=06a408f9c6b271b588368b5c50b99df957b93bca;p=gem5.git util,tests: Updated compiler-tests to support paths with spaces This script was failing if the gem5 directory path contained a space. E.g: `/home/bobbys home/gem5`. This script has thereby been improved to handle this. Change-Id: Id56ff5a0e9aa31eef14de2111b040f7f2b0b286c Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31534 Reviewed-by: Daniel Carvalho Maintainer: Jason Lowe-Power Tested-by: kokoro --- diff --git a/util/compiler-tests.sh b/util/compiler-tests.sh index 30ce63703..c586c273e 100755 --- a/util/compiler-tests.sh +++ b/util/compiler-tests.sh @@ -70,14 +70,14 @@ test_dir="${gem5_root}/.compile-test-out" exits="${test_dir}/exit-codes.csv" # Create the testing output directory and files -rm -rf $test_dir_final -rm -rf $test_dir -mkdir $test_dir -touch $exits -echo "compiler,build_target,exit_code" >> $exits +rm -rf "${test_dir_final}" +rm -rf "${test_dir}" +mkdir "${test_dir}" +touch "${exits}" +echo "compiler,build_target,exit_code" >> "${exits}" for compiler in ${images[@]}; do - echo "Starting build tests with '$compiler'..." + echo "Starting build tests with '${compiler}'..." # Generate a randomized list of build targets build_permutation=($(shuf -i 0-$((${#builds[@]} - 1)) )) @@ -96,33 +96,34 @@ for compiler in ${images[@]}; do # Grab compiler image docker pull $repo_name >/dev/null - mkdir "$test_dir/$compiler" + mkdir "${test_dir}/${compiler}" for build_index in ${build_indices[@]}; 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" + build_stderr="${test_dir}/${compiler}/${build}${build_opt}.stderr" # Clean the build rm -rf "${build_dir}" - touch $build_stdout - touch $build_stderr + touch "${build_stdout}" + touch "${build_stderr}" - echo " * Building target '$build$build_opt' with '$compiler'..." + echo " * Building target '${build}${build_opt}' with '${compiler}'..." # Build with container { - docker run --rm -v ${gem5_root}:/gem5 -u $UID:$GID -w /gem5 \ - $repo_name scons $build_out $build_args - }>$build_stdout 2>$build_stderr + docker run --rm -v "${gem5_root}":"/gem5" -u $UID:$GID \ + -w /gem5 $repo_name scons "${build_out}" "${build_args}" + }>"${build_stdout}" 2>"${build_stderr}" result=$? - echo "$compiler,$build/gem5$build_opt,$result" >> $exits - if [ $result -ne 0 ]; then - echo " ! Failed with exit code $result." + echo "${compiler},${build}/gem5${build_opt},${result}" >>"${exits}" + + if [ ${result} -ne 0 ]; then + echo " ! Failed with exit code ${result}." else echo " Done." fi