[m-rev.] diff: reduce warnings from shellcheck in the bootcheck script
Julien Fischer
jfischer at opturion.com
Fri Dec 30 16:15:52 AEDT 2022
Reduce warnings from shellcheck in the bootcheck script.
tools/bootcheck.java:
Use $(...) in preference to `...` for command substitutions.
Quote variables.
Abort if we attempt to rm / due to a variable not being set.
Julien.
diff --git a/tools/bootcheck b/tools/bootcheck
index e562871..6028f2d 100755
--- a/tools/bootcheck
+++ b/tools/bootcheck
@@ -1,7 +1,8 @@
#!/bin/sh
# vim: ts=4 sw=4 et ft=sh
#---------------------------------------------------------------------------#
-# Copyright (C) 1995-2001 The University of Melbourne.
+# Copyright (C) 1995-2008, 2010-2011 The University of Melbourne.
+# Copyright (C) 2013-2022 The Mercury team.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
@@ -238,7 +239,7 @@ fi
if test -f .BOOT_GRADE
then
- grade=`cat .BOOT_GRADE`
+ grade=$(cat .BOOT_GRADE)
fi
if test -f .NO_WRITE_DEEP
@@ -642,16 +643,16 @@ fi
# one too many times - zs.
if echo "${MERCURY_OPTIONS}" | grep '\-Di' > /dev/null
then
- MERCURY_OPTIONS=`echo "${MERCURY_OPTIONS}" | sed -e 's/-Di//'`
+ MERCURY_OPTIONS=$(echo "${MERCURY_OPTIONS}" | sed -e 's/-Di//')
export MERCURY_OPTIONS
fi
-echo "starting at `date`"
+echo "starting at $(date)"
# set -x
-root=`/bin/pwd`
-root=`${CYGPATH} ${root}`
+root=$(/bin/pwd)
+root=$(${CYGPATH} "${root}")
PATH=${root}/tools:${PATH}
export PATH
@@ -714,9 +715,9 @@ fi
if ${coverage_test}
then
- mkdir -p ${root}/coverage
+ mkdir -p "${root}"/coverage
# Don't contaminate the coverage test with old data.
- /bin/rm ${root}/coverage/COVERAGE_TEST_DATA* > /dev/null 2>&1
+ /bin/rm "${root}"/coverage/COVERAGE_TEST_DATA* > /dev/null 2>&1
MERCURY_OPTIONS="${MERCURY_OPTIONS} --coverage-test-if-exec=mercury_compile --trace-count-summary-file=${root}/coverage/COVERAGE_TEST_DATA --trace-count-summary-cmd=${root}/slice/mtc_union"
export MERCURY_OPTIONS
# Check whether we can compile the slice directory.
@@ -734,7 +735,7 @@ then
then
echo "building of stage 1 successful"
else
- cd ${root}
+ cd "${root}"
mmake ${mmake_opts} depend
if mmake ${mmake_opts} MMAKEFLAGS=${jfactor} all
then
@@ -766,96 +767,96 @@ then
then
echo keeping existing stage2
else
- /bin/rm -fr ${root}/${stage2dir} < /dev/null
- mkdir ${root}/${stage2dir}
+ /bin/rm -fr "${root:?}/${stage2dir}" < /dev/null
+ mkdir "${root}/${stage2dir}"
fi
if ${mmake_stage_2}
then
set +x
echo linking stage 2... 1>&2
- cd ${stage2dir}
- ${LN_S} ${root}/RESERVED_MACRO_NAMES .
+ cd "${stage2dir}"
+ ${LN_S} "${root}"/RESERVED_MACRO_NAMES .
mkdir compiler
cd compiler
# Break up the links into several chunks.
# This is needed to cope with small limits
# on the size of argument vectors.
- ${LN_S} ${root}/compiler/[a-h]*.m .
- ${LN_S} ${root}/compiler/[i-o]*.m .
- ${LN_S} ${root}/compiler/[p-s]*.m .
- ${LN_S} ${root}/compiler/[t-z]*.m .
- ${LN_S} ${root}/compiler/notes .
- cp ${root}/compiler/Mmake* ${root}/compiler/Mercury.options .
- cp ${root}/compiler/*_FLAGS.in .
- cp ${root}/compiler/.mgnu* .
-
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/compiler/[a-h]*.m .
+ ${LN_S} "${root}"/compiler/[i-o]*.m .
+ ${LN_S} "${root}"/compiler/[p-s]*.m .
+ ${LN_S} "${root}"/compiler/[t-z]*.m .
+ ${LN_S} "${root}"/compiler/notes .
+ cp "${root}"/compiler/Mmake* "${root}"/compiler/Mercury.options .
+ cp "${root}"/compiler/*_FLAGS.in .
+ cp "${root}"/compiler/.mgnu* .
+
+ cd "${root}/${stage2dir}"
mkdir library
cd library
- ${LN_S} ${root}/library/[a-l]*.m .
- ${LN_S} ${root}/library/[m-z]*.m .
+ ${LN_S} "${root}"/library/[a-l]*.m .
+ ${LN_S} "${root}"/library/[m-z]*.m .
# See comment below for why we use ${LN} rather than ${LN_S} here
- ${LN} ${root}/library/library_strong_name.sn .
- ${LN_S} ${root}/library/print_extra_inits .
- ${LN_S} ${root}/library/MODULES_DOC .
- ${LN_S} ${root}/library/MODULES_UNDOC .
- cp ${root}/library/Mmake* ${root}/library/Mercury.options .
- cp ${root}/library/*_FLAGS.in .
- cp ${root}/library/INTER_FLAGS* .
- cp ${root}/library/.mgnu* .
- ${LN_S} ${root}/library/${STD_LIB_NAME}.init .
- ${LN_S} ${root}/library/RESERVED_MACRO_NAMES .
-
- cd ${root}/${stage2dir}
+ ${LN} "${root}"/library/library_strong_name.sn .
+ ${LN_S} "${root}"/library/print_extra_inits .
+ ${LN_S} "${root}"/library/MODULES_DOC .
+ ${LN_S} "${root}"/library/MODULES_UNDOC .
+ cp "${root}"/library/Mmake* "${root}"/library/Mercury.options .
+ cp "${root}"/library/*_FLAGS.in .
+ cp "${root}"/library/INTER_FLAGS* .
+ cp "${root}"/library/.mgnu* .
+ ${LN_S} "${root}"/library/${STD_LIB_NAME}.init .
+ ${LN_S} "${root}"/library/RESERVED_MACRO_NAMES .
+
+ cd "${root}/${stage2dir}"
mkdir mdbcomp
cd mdbcomp
- ${LN_S} ${root}/mdbcomp/*.m .
- cp ${root}/mdbcomp/Mmake* ${root}/mdbcomp/Mercury.options .
- cp ${root}/mdbcomp/*_FLAGS.in .
- cp ${root}/mdbcomp/.mgnu* .
- ${LN_S} ${root}/mdbcomp/${MDBCOMP_LIB_NAME}.init .
- ${LN_S} ${root}/mdbcomp/RESERVED_MACRO_NAMES .
-
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/mdbcomp/*.m .
+ cp "${root}"/mdbcomp/Mmake* "${root}"/mdbcomp/Mercury.options .
+ cp "${root}"/mdbcomp/*_FLAGS.in .
+ cp "${root}"/mdbcomp/.mgnu* .
+ ${LN_S} "${root}"/mdbcomp/${MDBCOMP_LIB_NAME}.init .
+ ${LN_S} "${root}"/mdbcomp/RESERVED_MACRO_NAMES .
+
+ cd "${root}/${stage2dir}"
mkdir browser
cd browser
- ${LN_S} ${root}/browser/*.m .
- cp ${root}/browser/Mmake* ${root}/browser/Mercury.options .
- cp ${root}/browser/*_FLAGS.in .
- cp ${root}/browser/.mgnu* .
- ${LN_S} ${root}/browser/${BROWSER_LIB_NAME}.init .
- ${LN_S} ${root}/browser/RESERVED_MACRO_NAMES .
-
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/browser/*.m .
+ cp "${root}"/browser/Mmake* "${root}"/browser/Mercury.options .
+ cp "${root}"/browser/*_FLAGS.in .
+ cp "${root}"/browser/.mgnu* .
+ ${LN_S} "${root}"/browser/${BROWSER_LIB_NAME}.init .
+ ${LN_S} "${root}"/browser/RESERVED_MACRO_NAMES .
+
+ cd "${root}/${stage2dir}"
mkdir ssdb
cd ssdb
- ${LN_S} ${root}/ssdb/*.m .
- cp ${root}/ssdb/Mmake* ${root}/ssdb/Mercury.options .
- cp ${root}/ssdb/*_FLAGS.in .
- cp ${root}/ssdb/.mgnu* .
- ${LN_S} ${root}/ssdb/${SSDB_LIB_NAME}.init .
- ${LN_S} ${root}/ssdb/RESERVED_MACRO_NAMES .
-
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/ssdb/*.m .
+ cp "${root}"/ssdb/Mmake* "${root}"/ssdb/Mercury.options .
+ cp "${root}"/ssdb/*_FLAGS.in .
+ cp "${root}"/ssdb/.mgnu* .
+ ${LN_S} "${root}"/ssdb/${SSDB_LIB_NAME}.init .
+ ${LN_S} "${root}"/ssdb/RESERVED_MACRO_NAMES .
+
+ cd "${root}/${stage2dir}"
mkdir grade_lib
cd grade_lib
- ${LN_S} ${root}/grade_lib/*.m .
- cp ${root}/grade_lib/Mmake* ${root}/grade_lib/Mercury.options .
- cp ${root}/grade_lib/*_FLAGS.in .
- cp ${root}/grade_lib/.mgnu* .
+ ${LN_S} "${root}"/grade_lib/*.m .
+ cp "${root}"/grade_lib/Mmake* "${root}"/grade_lib/Mercury.options .
+ cp "${root}"/grade_lib/*_FLAGS.in .
+ cp "${root}"/grade_lib/.mgnu* .
- cd ${root}/${stage2dir}
+ cd "${root}/${stage2dir}"
mkdir mfilterjavac
cd mfilterjavac
- ${LN_S} ${root}/mfilterjavac/*.m .
- cp ${root}/mfilterjavac/Mmake* .
- cp ${root}/mfilterjavac/*_FLAGS.in .
- cp ${root}/mfilterjavac/.mgnu* .
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/mfilterjavac/*.m .
+ cp "${root}"/mfilterjavac/Mmake* .
+ cp "${root}"/mfilterjavac/*_FLAGS.in .
+ cp "${root}"/mfilterjavac/.mgnu* .
+ cd "${root}/${stage2dir}"
- cd ${root}/${stage2dir}
+ cd "${root}/${stage2dir}"
if ${copy_runtime}
then
# Remove symbolic link to the stage 1 runtime
@@ -863,45 +864,45 @@ then
rm -f runtime
mkdir runtime
cd runtime
- ${LN_S} ${root}/runtime/*.h .
- ${LN_S} ${root}/runtime/*.c .
- ${LN_S} ${root}/runtime/*.cs .
+ ${LN_S} "${root}"/runtime/*.h .
+ ${LN_S} "${root}"/runtime/*.c .
+ ${LN_S} "${root}"/runtime/*.cs .
# We need to use ${LN} rather than ${LN_S} for the files
# that get processed with Microsoft's tools, since
# Microsoft's tools don't understand Cygwin symbolic links
# (hard links are OK, Cygwin's ln just makes copies).
rm -f mercury_conf*.h
- ${LN} ${root}/runtime/mercury_conf*.h .
- ${LN_S} ${root}/runtime/*.in .
- cp ${root}/runtime/Mmake* .
- cp ${root}/runtime/.mgnu* .
- ${LN_S} ${root}/runtime/machdeps .
- ${LN_S} ${root}/runtime/RESERVED_MACRO_NAMES .
-
- cd ${root}/${stage2dir}
+ ${LN} "${root}"/runtime/mercury_conf*.h .
+ ${LN_S} "${root}"/runtime/*.in .
+ cp "${root}"/runtime/Mmake* .
+ cp "${root}"/runtime/.mgnu* .
+ ${LN_S} "${root}"/runtime/machdeps .
+ ${LN_S} "${root}"/runtime/RESERVED_MACRO_NAMES .
+
+ cd "${root}/${stage2dir}"
rm -f trace
mkdir trace
cd trace
- ${LN_S} ${root}/trace/*.h .
- ${LN_S} ${root}/trace/*.c .
- ${LN_S} ${root}/trace/*.[yl] .
- cp ${root}/trace/Mmake* .
- cp ${root}/trace/.mgnu* .
- ${LN_S} ${root}/trace/RESERVED_MACRO_NAMES .
-
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/trace/*.h .
+ ${LN_S} "${root}"/trace/*.c .
+ ${LN_S} "${root}"/trace/*.[yl] .
+ cp "${root}"/trace/Mmake* .
+ cp "${root}"/trace/.mgnu* .
+ ${LN_S} "${root}"/trace/RESERVED_MACRO_NAMES .
+
+ cd "${root}/${stage2dir}"
rm -f robdd
mkdir robdd
cd robdd
- ${LN_S} ${root}/robdd/*.h .
- ${LN_S} ${root}/robdd/*.c .
- cp ${root}/robdd/Mmake* .
- cp ${root}/robdd/Make* .
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/robdd/*.h .
+ ${LN_S} "${root}"/robdd/*.c .
+ cp "${root}"/robdd/Mmake* .
+ cp "${root}"/robdd/Make* .
+ cd "${root}/${stage2dir}"
else
- ${LN_S} ${root}/runtime .
- ${LN_S} ${root}/trace .
- ${LN_S} ${root}/robdd .
+ ${LN_S} "${root}"/runtime .
+ ${LN_S} "${root}"/trace .
+ ${LN_S} "${root}"/robdd .
fi
if ${copy_boehm_gc}
then
@@ -910,137 +911,137 @@ then
rm -f boehm_gc
mkdir boehm_gc
cd boehm_gc
- ${LN_S} ${root}/boehm_gc/*.c .
- ${LN_S} ${root}/boehm_gc/*.s .
- ${LN_S} ${root}/boehm_gc/*.S .
- ${LN_S} ${root}/boehm_gc/include .
- cp ${root}/boehm_gc/Mmake* .
- cp ${root}/boehm_gc/Makefile.direct .
- cp ${root}/boehm_gc/NT*_MAKEFILE .
- cp ${root}/boehm_gc/gc.mak .
- cp ${root}/boehm_gc/gc_cpp.cc .
- cp ${root}/boehm_gc/gc_cpp.cpp .
- cp -r ${root}/boehm_gc/cord .
- cp -r ${root}/boehm_gc/libatomic_ops .
- cp -r ${root}/boehm_gc/extra .
- cp -r ${root}/boehm_gc/tools .
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/boehm_gc/*.c .
+ ${LN_S} "${root}"/boehm_gc/*.s .
+ ${LN_S} "${root}"/boehm_gc/*.S .
+ ${LN_S} "${root}"/boehm_gc/include .
+ cp "${root}"/boehm_gc/Mmake* .
+ cp "${root}"/boehm_gc/Makefile.direct .
+ cp "${root}"/boehm_gc/NT*_MAKEFILE .
+ cp "${root}"/boehm_gc/gc.mak .
+ cp "${root}"/boehm_gc/gc_cpp.cc .
+ cp "${root}"/boehm_gc/gc_cpp.cpp .
+ cp -r "${root}"/boehm_gc/cord .
+ cp -r "${root}"/boehm_gc/libatomic_ops .
+ cp -r "${root}"/boehm_gc/extra .
+ cp -r "${root}"/boehm_gc/tools .
+ cd "${root}/${stage2dir}"
else
- ${LN_S} ${root}/boehm_gc .
+ ${LN_S} "${root}"/boehm_gc .
fi
- ${LN_S} ${root}/java .
- ${LN_S} ${root}/bindist .
- ${LN_S} ${root}/doc .
- ${LN_S} ${root}/scripts .
- ${LN_S} ${root}/tools .
- ${LN_S} ${root}/util .
+ ${LN_S} "${root}"/java .
+ ${LN_S} "${root}"/bindist .
+ ${LN_S} "${root}"/doc .
+ ${LN_S} "${root}"/scripts .
+ ${LN_S} "${root}"/tools .
+ ${LN_S} "${root}"/util .
if ${copy_slice}
then
mkdir slice
cd slice
- ${LN_S} ${root}/slice/*.m .
- cp ${root}/slice/Mmake* ${root}/slice/Mercury.options .
- cp ${root}/slice/*_FLAGS.in .
- cp ${root}/slice/.mgnu* .
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/slice/*.m .
+ cp "${root}"/slice/Mmake* "${root}"/slice/Mercury.options .
+ cp "${root}"/slice/*_FLAGS.in .
+ cp "${root}"/slice/.mgnu* .
+ cd "${root}/${stage2dir}"
else
- ${LN_S} ${root}/slice .
+ ${LN_S} "${root}"/slice .
fi
if ${copy_profilers}
then
mkdir profiler
cd profiler
- ${LN_S} ${root}/profiler/*.m .
- cp ${root}/profiler/Mmake* ${root}/profiler/Mercury.options .
- cp ${root}/profiler/*_FLAGS.in .
- cp ${root}/profiler/.mgnu* .
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/profiler/*.m .
+ cp "${root}"/profiler/Mmake* "${root}"/profiler/Mercury.options .
+ cp "${root}"/profiler/*_FLAGS.in .
+ cp "${root}"/profiler/.mgnu* .
+ cd "${root}/${stage2dir}"
mkdir deep_profiler
cd deep_profiler
- ${LN_S} ${root}/deep_profiler/*.m .
- cp ${root}/deep_profiler/Mmake* .
- cp ${root}/deep_profiler/Mercury.options .
- cp ${root}/deep_profiler/*_FLAGS.in .
- cp ${root}/deep_profiler/.mgnu* .
- cd ${root}/${stage2dir}
+ ${LN_S} "${root}"/deep_profiler/*.m .
+ cp "${root}"/deep_profiler/Mmake* .
+ cp "${root}"/deep_profiler/Mercury.options .
+ cp "${root}"/deep_profiler/*_FLAGS.in .
+ cp "${root}"/deep_profiler/.mgnu* .
+ cd "${root}/${stage2dir}"
else
- ${LN_S} ${root}/profiler .
- ${LN_S} ${root}/deep_profiler .
+ ${LN_S} "${root}"/profiler .
+ ${LN_S} "${root}"/deep_profiler .
fi
- ${LN_S} ${root}/conf* .
- ${LN_S} ${root}/aclocal.m4 .
- ${LN_S} ${root}/m4 .
- ${LN_S} ${root}/VERSION .
- ${LN_S} ${root}/install-sh .
- ${LN_S} ${root}/.*.in .
- ${LN_S} ${root}/mercury.snk .
+ ${LN_S} "${root}"/conf* .
+ ${LN_S} "${root}"/aclocal.m4 .
+ ${LN_S} "${root}"/m4 .
+ ${LN_S} "${root}"/VERSION .
+ ${LN_S} "${root}"/install-sh .
+ ${LN_S} "${root}"/.*.in .
+ ${LN_S} "${root}"/mercury.snk .
rm -f config*.log
- cp ${root}/Mmake* ${root}/Mercury.options .
- if test -f ${root}/Mmake.stage.params
+ cp "${root}"/Mmake* "${root}"/Mercury.options .
+ if test -f "${root}"/Mmake.stage.params
then
/bin/rm -f Mmake.params
- cp ${root}/Mmake.stage.params Mmake.params
+ cp "${root}"/Mmake.stage.params Mmake.params
fi
- if test -f ${root}/Mmake.stage.slice.params
+ if test -f "${root}"/Mmake.stage.slice.params
then
/bin/rm -f slice/Mmake.slice.params
- cp ${root}/Mmake.stage.slice.params slice/Mmake.slice.params
+ cp "${root}"/Mmake.stage.slice.params slice/Mmake.slice.params
fi
- if test -f ${root}/Mmake.stage.mdbcomp.params
+ if test -f "${root}"/Mmake.stage.mdbcomp.params
then
/bin/rm -f mdbcomp/Mmake.mdbcomp.params
- cp ${root}/Mmake.stage.mdbcomp.params mdbcomp/Mmake.mdbcomp.params
+ cp "${root}"/Mmake.stage.mdbcomp.params mdbcomp/Mmake.mdbcomp.params
fi
- if test -f ${root}/Mmake.stage.browser.params
+ if test -f "${root}"/Mmake.stage.browser.params
then
/bin/rm -f browser/Mmake.browser.params
- cp ${root}/Mmake.stage.browser.params browser/Mmake.browser.params
+ cp "${root}"/Mmake.stage.browser.params browser/Mmake.browser.params
fi
- if test -f ${root}/Mmake.stage.ssdb.params
+ if test -f "${root}"/Mmake.stage.ssdb.params
then
/bin/rm -f ssdb/Mmake.ssdb.params
- cp ${root}/Mmake.stage.ssdb.params ssdb/Mmake.ssdb.params
+ cp "${root}"/Mmake.stage.ssdb.params ssdb/Mmake.ssdb.params
fi
- if test -f ${root}/Mmake.stage.grade_lib.params
+ if test -f "${root}"/Mmake.stage.grade_lib.params
then
/bin/rm -f grade_lib/Mmake.grade_lib.params
- cp ${root}/Mmake.stage.grade_lib.params \
+ cp "${root}"/Mmake.stage.grade_lib.params \
grade_lib/Mmake.grade_lib.params
fi
- if test -f ${root}/Mmake.stage.deep.params
+ if test -f "${root}"/Mmake.stage.deep.params
then
/bin/rm -f deep_profiler/Mmake.deep.params
- cp ${root}/Mmake.stage.deep.params deep_profiler/Mmake.deep.params
+ cp "${root}"/Mmake.stage.deep.params deep_profiler/Mmake.deep.params
fi
- if test -f ${root}/Mmake.stage.compiler.params
+ if test -f "${root}"/Mmake.stage.compiler.params
then
/bin/rm -f compiler/Mmake.compiler.params
- cp ${root}/Mmake.stage.compiler.params \
+ cp "${root}"/Mmake.stage.compiler.params \
compiler/Mmake.compiler.params
fi
- if test -f ${root}/Mmake.stage.library.params
+ if test -f "${root}"/Mmake.stage.library.params
then
/bin/rm -f library/Mmake.library.params
- cp ${root}/Mmake.stage.library.params library/Mmake.library.params
+ cp "${root}"/Mmake.stage.library.params library/Mmake.library.params
fi
- if test -f ${root}/Mmake.stage.runtime.params
+ if test -f "${root}"/Mmake.stage.runtime.params
then
/bin/rm -f runtime/Mmake.runtime.params
- cp ${root}/Mmake.stage.runtime.params runtime/Mmake.runtime.params
+ cp "${root}"/Mmake.stage.runtime.params runtime/Mmake.runtime.params
fi
- if test -f ${root}/Mmake.stage.trace.params
+ if test -f "${root}"/Mmake.stage.trace.params
then
/bin/rm -f trace/Mmake.trace.params
- cp ${root}/Mmake.stage.trace.params trace/Mmake.trace.params
+ cp "${root}"/Mmake.stage.trace.params trace/Mmake.trace.params
fi
- if test -f ${root}/Mercury.stage.options
+ if test -f "${root}"/Mercury.stage.options
then
/bin/rm -f Mercury.options
- cp ${root}/Mercury.stage.options Mercury.options
+ cp "${root}"/Mercury.stage.options Mercury.options
fi
if test "${grade}" != ""
then
@@ -1050,13 +1051,13 @@ then
then
echo "${mmc_make_jobs}" >> Mmake.params
fi
- cd ${root}
+ cd "${root}"
# set -x
MMAKE_VPATH=.
export MMAKE_VPATH
- MMAKE_DIR=${root}/scripts
+ MMAKE_DIR="${root}"/scripts
export MMAKE_DIR
# Use the new mmake to build stage 2.
@@ -1290,7 +1291,7 @@ then
ls -lt ${stage2dir}/compiler/mercury_compile
fi
fi
- echo "finishing stage 2 at `date`"
+ echo "finishing stage 2 at $(date)"
# Build the check_namespace target in the relevant directories.
# We want to do so before we delete any of the stage 2 object files.
@@ -1298,52 +1299,52 @@ then
check_namespace_status=0
if ${check_namespace}
then
- cd ${root}/${stage2dir}/runtime
+ cd "${root}"/${stage2dir}/runtime
mmake ${mmake_opts} check_namespace || {
echo '** mmake check_namespace failed in runtime!'
check_namespace_status=1
}
mmake ${mmake_opts} clean_check
- cd ${root}/${stage2dir}/trace
+ cd "${root}"/${stage2dir}/trace
mmake ${mmake_opts} check_namespace || {
echo '** mmake check_namespace failed in trace!'
check_namespace_status=1
}
mmake ${mmake_opts} clean_check
- cd ${root}/${stage2dir}/library
+ cd "${root}"/${stage2dir}/library
mmake ${mmake_opts} check_namespace || {
echo '** mmake check_namespace failed in library!'
check_namespace_status=1
}
mmake ${mmake_opts} clean_check
- cd ${root}/${stage2dir}/mdbcomp
+ cd "${root}"/${stage2dir}/mdbcomp
mmake ${mmake_opts} check_namespace || {
echo '** mmake check_namespace failed in mdbcomp!'
check_namespace_status=1
}
mmake ${mmake_opts} clean_check
- cd ${root}/${stage2dir}/browser
+ cd "${root}"/${stage2dir}/browser
mmake ${mmake_opts} check_namespace || {
echo '** mmake check_namespace failed in browser!'
check_namespace_status=1
}
mmake ${mmake_opts} clean_check
- cd ${root}/${stage2dir}/ssdb
+ cd "${root}"/${stage2dir}/ssdb
mmake ${mmake_opts} check_namespace || {
echo '** mmake check_namespace failed in ssdb!'
check_namespace_status=1
}
mmake ${mmake_opts} clean_check
- cd ${root}
+ cd "${root}"
fi
check_stdlib_modules_status=0
- cd ${root}/${stage2dir}/library
+ cd "${root}"/${stage2dir}/library
mmake ${mmake_opts} check_stdlib_modules || {
echo '** mmake check_stdlib_modules failed in library!'
check_stdlib_modules_status=1
}
- cd ${root}
+ cd "${root}"
if ${stop_after_stage_2}
then
@@ -1380,7 +1381,7 @@ then
objdirs="${libdirs} ${slicedirs} ${profdirs} ${rundirs}"
for rmdir in ${objdirs}
do
- cd ${root}/${stage2dir}/${rmdir}
+ cd "${root}/${stage2dir}/${rmdir}"
/bin/rm -f *.o *.pic_o
done
@@ -1388,12 +1389,12 @@ then
then
for cleandir in runtime trace library mdbcomp browser ssdb
do
- cd ${root}/${stage2dir}/${cleandir}
+ cd "${root}/${stage2dir}/${cleandir}"
mmake clean_check
done
fi
- cd ${root}
+ cd "${root}"
fi
# In the java grade, the generated mercury_compile wrapper script
@@ -1402,7 +1403,7 @@ then
#
if test "${grade}" = "java"
then
-cat > ${root}/${stage2dir}/compiler/mercury_compile << EOF
+cat > "${root}/${stage2dir}"/compiler/mercury_compile << EOF
#!/bin/sh
case \$WINDIR in
'') SEP=':' ;;
@@ -1425,7 +1426,7 @@ EOF
# XXX the following only works with Mono.
if test "${grade}" = "csharp"
then
-cat > ${root}/${stage2dir}/compiler/mercury_compile << EOF
+cat > "${root}"/${stage2dir}/compiler/mercury_compile << EOF
#!/bin/sh
MONO_PATH=\$MONO_PATH:${root}/${stage2dir}/library:${root}/${stage2dir}/mdbcomp
export MONO_PATH
@@ -1434,7 +1435,7 @@ exec "\$CLI_INTERPRETER" "${root}/${stage2dir}/compiler/mercury_compile.exe" "\$
EOF
fi
- MERCURY_COMPILER=${root}/${stage2dir}/compiler/mercury_compile
+ MERCURY_COMPILER="${root}/${stage2dir}"/compiler/mercury_compile
export MERCURY_COMPILER
test -d ${stage3dir} || mkdir ${stage3dir}
@@ -1442,137 +1443,137 @@ EOF
then
echo keeping existing stage3
else
- /bin/rm -fr ${root}/${stage3dir} < /dev/null
- mkdir ${root}/${stage3dir}
+ /bin/rm -fr "${root:?}/${stage3dir}" < /dev/null
+ mkdir "${root}/${stage3dir}"
fi
echo linking stage 3... 1>&2
set +x
- cd ${stage3dir}
+ cd "${stage3dir}"
mkdir compiler
cd compiler
# Break up the links into several chunks.
# This is needed to cope with small limits
# on the size of argument vectors.
- ${LN_S} ${root}/compiler/[a-h]*.m .
- ${LN_S} ${root}/compiler/[i-o]*.m .
- ${LN_S} ${root}/compiler/[p-s]*.m .
- ${LN_S} ${root}/compiler/[t-z]*.m .
- ${LN_S} ${root}/compiler/notes .
- cp ${root}/compiler/Mmake* ${root}/compiler/Mercury.options .
- cp ${root}/compiler/*_FLAGS.in .
- cp ${root}/compiler/.mgnu* .
-
- cd ${root}/${stage3dir}
+ ${LN_S} "${root}"/compiler/[a-h]*.m .
+ ${LN_S} "${root}"/compiler/[i-o]*.m .
+ ${LN_S} "${root}"/compiler/[p-s]*.m .
+ ${LN_S} "${root}"/compiler/[t-z]*.m .
+ ${LN_S} "${root}"/compiler/notes .
+ cp "${root}"/compiler/Mmake* "${root}"/compiler/Mercury.options .
+ cp "${root}"/compiler/*_FLAGS.in .
+ cp "${root}"/compiler/.mgnu* .
+
+ cd "${root}/${stage3dir}"
mkdir library
cd library
- ${LN_S} ${root}/library/[a-l]*.m .
- ${LN_S} ${root}/library/[m-z]*.m .
- ${LN_S} ${root}/library/print_extra_inits .
- ${LN_S} ${root}/library/library_strong_name.sn .
- ${LN_S} ${root}/library/MODULES_DOC .
- ${LN_S} ${root}/library/MODULES_UNDOC .
- cp ${root}/library/Mmake* ${root}/library/Mercury.options .
- cp ${root}/library/*_FLAGS.in .
- cp ${root}/library/INTER_FLAGS* .
- cp ${root}/library/.mgnu* .
- ${LN_S} ${root}/library/${STD_LIB_NAME}.init .
-
- cd ${root}/${stage3dir}
+ ${LN_S} "${root}"/library/[a-l]*.m .
+ ${LN_S} "${root}"/library/[m-z]*.m .
+ ${LN_S} "${root}"/library/print_extra_inits .
+ ${LN_S} "${root}"/library/library_strong_name.sn .
+ ${LN_S} "${root}"/library/MODULES_DOC .
+ ${LN_S} "${root}"/library/MODULES_UNDOC .
+ cp "${root}"/library/Mmake* "${root}"/library/Mercury.options .
+ cp "${root}"/library/*_FLAGS.in .
+ cp "${root}"/library/INTER_FLAGS* .
+ cp "${root}"/library/.mgnu* .
+ ${LN_S} "${root}"/library/${STD_LIB_NAME}.init .
+
+ cd "${root}/${stage3dir}"
mkdir mdbcomp
cd mdbcomp
- ${LN_S} ${root}/mdbcomp/*.m .
- cp ${root}/mdbcomp/Mmake* ${root}/mdbcomp/Mercury.options .
- cp ${root}/mdbcomp/*_FLAGS.in .
- cp ${root}/mdbcomp/.mgnu* .
- ${LN_S} ${root}/mdbcomp/${MDBCOMP_LIB_NAME}.init .
+ ${LN_S} "${root}"/mdbcomp/*.m .
+ cp "${root}"/mdbcomp/Mmake* "${root}"/mdbcomp/Mercury.options .
+ cp "${root}"/mdbcomp/*_FLAGS.in .
+ cp "${root}"/mdbcomp/.mgnu* .
+ ${LN_S} "${root}"/mdbcomp/${MDBCOMP_LIB_NAME}.init .
- cd ${root}/${stage3dir}
+ cd "${root}/${stage3dir}"
mkdir browser
cd browser
- ${LN_S} ${root}/browser/*.m .
- cp ${root}/browser/Mmake* ${root}/browser/Mercury.options .
- cp ${root}/browser/*_FLAGS.in .
- cp ${root}/browser/.mgnu* .
- ${LN_S} ${root}/browser/${BROWSER_LIB_NAME}.init .
+ ${LN_S} "${root}"/browser/*.m .
+ cp "${root}"/browser/Mmake* "${root}"/browser/Mercury.options .
+ cp "${root}"/browser/*_FLAGS.in .
+ cp "${root}"/browser/.mgnu* .
+ ${LN_S} "${root}"/browser/${BROWSER_LIB_NAME}.init .
- cd ${root}/${stage3dir}
+ cd "${root}/${stage3dir}"
mkdir ssdb
cd ssdb
- ${LN_S} ${root}/ssdb/*.m .
- cp ${root}/ssdb/Mmake* ${root}/ssdb/Mercury.options .
- cp ${root}/ssdb/*_FLAGS.in .
- cp ${root}/ssdb/.mgnu* .
- ${LN_S} ${root}/ssdb/${SSDB_LIB_NAME}.init .
-
- cd ${root}/${stage3dir}
- ${LN_S} ${root}/${stage2dir}/boehm_gc .
- ${LN_S} ${root}/${stage2dir}/java .
- ${LN_S} ${root}/bindist .
- ${LN_S} ${root}/doc .
- ${LN_S} ${root}/${stage2dir}/runtime .
- ${LN_S} ${root}/${stage2dir}/trace .
- ${LN_S} ${root}/${stage2dir}/robdd .
- ${LN_S} ${root}/scripts .
- ${LN_S} ${root}/tools .
- ${LN_S} ${root}/util .
-
- cd ${root}/${stage3dir}
+ ${LN_S} "${root}"/ssdb/*.m .
+ cp "${root}"/ssdb/Mmake* "${root}"/ssdb/Mercury.options .
+ cp "${root}"/ssdb/*_FLAGS.in .
+ cp "${root}"/ssdb/.mgnu* .
+ ${LN_S} "${root}"/ssdb/${SSDB_LIB_NAME}.init .
+
+ cd "${root}/${stage3dir}"
+ ${LN_S} "${root}"/${stage2dir}/boehm_gc .
+ ${LN_S} "${root}"/${stage2dir}/java .
+ ${LN_S} "${root}"/bindist .
+ ${LN_S} "${root}"/doc .
+ ${LN_S} "${root}"/${stage2dir}/runtime .
+ ${LN_S} "${root}"/${stage2dir}/trace .
+ ${LN_S} "${root}"/${stage2dir}/robdd .
+ ${LN_S} "${root}"/scripts .
+ ${LN_S} "${root}"/tools .
+ ${LN_S} "${root}"/util .
+
+ cd "${root}/${stage3dir}"
mkdir grade_lib
cd grade_lib
- ${LN_S} ${root}/grade_lib/*.m .
- cp ${root}/grade_lib/Mmake* ${root}/grade_lib/Mercury.options .
- cp ${root}/grade_lib/*_FLAGS.in .
- cp ${root}/grade_lib/.mgnu* .
+ ${LN_S} "${root}"/grade_lib/*.m .
+ cp "${root}"/grade_lib/Mmake* "${root}"/grade_lib/Mercury.options .
+ cp "${root}"/grade_lib/*_FLAGS.in .
+ cp "${root}"/grade_lib/.mgnu* .
- cd ${root}/${stage3dir}
+ cd "${root}/${stage3dir}"
mkdir slice
cd slice
- ${LN_S} ${root}/slice/*.m .
- cp ${root}/slice/Mmake* ${root}/slice/Mercury.options .
- cp ${root}/slice/*_FLAGS.in .
- cp ${root}/slice/.mgnu* .
+ ${LN_S} "${root}"/slice/*.m .
+ cp "${root}"/slice/Mmake* "${root}"/slice/Mercury.options .
+ cp "${root}"/slice/*_FLAGS.in .
+ cp "${root}"/slice/.mgnu* .
- cd ${root}/${stage3dir}
+ cd "${root}/${stage3dir}"
mkdir profiler
cd profiler
- ${LN_S} ${root}/profiler/*.m .
- cp ${root}/profiler/Mmake* ${root}/profiler/Mercury.options .
- cp ${root}/profiler/*_FLAGS.in .
- cp ${root}/profiler/.mgnu* .
+ ${LN_S} "${root}"/profiler/*.m .
+ cp "${root}"/profiler/Mmake* "${root}"/profiler/Mercury.options .
+ cp "${root}"/profiler/*_FLAGS.in .
+ cp "${root}"/profiler/.mgnu* .
- cd ${root}/${stage3dir}
+ cd "${root}/${stage3dir}"
mkdir deep_profiler
cd deep_profiler
- ${LN_S} ${root}/deep_profiler/*.m .
- cp ${root}/deep_profiler/Mmake* ${root}/deep_profiler/Mercury.options .
- cp ${root}/deep_profiler/*_FLAGS.in .
- cp ${root}/deep_profiler/.mgnu* .
+ ${LN_S} "${root}"/deep_profiler/*.m .
+ cp "${root}"/deep_profiler/Mmake* "${root}"/deep_profiler/Mercury.options .
+ cp "${root}"/deep_profiler/*_FLAGS.in .
+ cp "${root}"/deep_profiler/.mgnu* .
- cd ${root}/${stage3dir}
+ cd "${root}/${stage3dir}"
mkdir mfilterjavac
cd mfilterjavac
- ${LN_S} ${root}/mfilterjavac/*.m .
- cp ${root}/mfilterjavac/Mmake* ${root}/mfilterjavac/Mercury.options .
- cp ${root}/mfilterjavac/*_FLAGS.in .
- cp ${root}/mfilterjavac/.mgnu* .
-
- cd ${root}/${stage3dir}
- ${LN_S} ${root}/conf* .
- ${LN_S} ${root}/aclocal.m4 .
- ${LN_S} ${root}/m4 .
- ${LN_S} ${root}/VERSION .
- ${LN_S} ${root}/install-sh .
- ${LN_S} ${root}/.*.in .
+ ${LN_S} "${root}"/mfilterjavac/*.m .
+ cp "${root}"/mfilterjavac/Mmake* "${root}"/mfilterjavac/Mercury.options .
+ cp "${root}"/mfilterjavac/*_FLAGS.in .
+ cp "${root}"/mfilterjavac/.mgnu* .
+
+ cd "${root}/${stage3dir}"
+ ${LN_S} "${root}"/conf* .
+ ${LN_S} "${root}"/aclocal.m4 .
+ ${LN_S} "${root}"/m4 .
+ ${LN_S} "${root}"/VERSION .
+ ${LN_S} "${root}"/install-sh .
+ ${LN_S} "${root}"/.*.in .
rm -f config*.log
- cp ${root}/${stage2dir}/Mmake* ${root}/${stage2dir}/Mercury.options .
- cd ${root}
+ cp "${root}"/${stage2dir}/Mmake* "${root}"/${stage2dir}/Mercury.options .
+ cd "${root}"
# set -x
MMAKE_VPATH=.
export MMAKE_VPATH
- MMAKE_DIR=${root}/scripts
+ MMAKE_DIR="${root}"/scripts
export MMAKE_DIR
# Use the new mmake to build stage 3.
@@ -1669,7 +1670,7 @@ EOF
then
true
else
- find ${root}/${stage2dir}/compiler -name "*.o" -print |
+ find "${root}/${stage2dir}/compiler" -name "*.o" -print |
xargs /bin/rm -f
fi
@@ -1847,7 +1848,7 @@ EOF
# but stage 3 being generated by a compiler in which native
# integers are 32 bits.
compare_file=true
- base_file=`basename ${file}`
+ base_file=$(basename "${file}")
case "${grade}" in
java*)
case "${dir},${base_file}" in
@@ -1893,8 +1894,8 @@ EOF
esac
if ${compare_file}
then
- diff -u ${stage2dir}/${dir}/${target_subdir}${base_file} \
- ${file} \
+ diff -u "${stage2dir}/${dir}/${target_subdir}${base_file}" \
+ "${file}" \
|| diff_status=1
fi
done
@@ -1909,26 +1910,26 @@ EOF
if test -d ${stage3dir}/library/ComplexityArgs
then
mv ${stage3dir}/library/ComplexityArgs \
- ${root}/stage3_library_ComplexityArgs
+ "${root}"/stage3_library_ComplexityArgs
fi
if test -d ${stage3dir}/library/ComplexityData
then
mv ${stage3dir}/library/ComplexityData \
- ${root}/stage3_library_ComplexityData
+ "${root}"/stage3_library_ComplexityData
fi
if test -d ${stage3dir}/compiler/ComplexityArgs
then
mv ${stage3dir}/compiler/ComplexityArgs \
- ${root}/stage3_compiler_ComplexityArgs
+ "${root}"/stage3_compiler_ComplexityArgs
fi
if test -d ${stage3dir}/compiler/ComplexityData
then
mv ${stage3dir}/compiler/ComplexityData \
- ${root}/stage3_compiler_ComplexityData
+ "${root}"/stage3_compiler_ComplexityData
fi
echo "removing stage 3..."
- /bin/rm -fr ${root}/${stage3dir} < /dev/null
+ /bin/rm -fr "${root:?}/${stage3dir}" < /dev/null
if ${keep_objs}
then
@@ -1940,17 +1941,17 @@ EOF
# them. This reduces the probability that running the tests
# will run out of disk space, while still allowing the
# original files to be reconstructed relatively quickly.
- gzip ${root}/${stage2dir}/library/*.c
- gzip ${root}/${stage2dir}/mdbcomp/*.c
- gzip ${root}/${stage2dir}/browser/*.c
- gzip ${root}/${stage2dir}/ssdb/*.c
- gzip ${root}/${stage2dir}/compiler/*.c
+ gzip "${root}"/${stage2dir}/library/*.c
+ gzip "${root}"/${stage2dir}/mdbcomp/*.c
+ gzip "${root}"/${stage2dir}/browser/*.c
+ gzip "${root}"/${stage2dir}/ssdb/*.c
+ gzip "${root}"/${stage2dir}/compiler/*.c
;;
esac
fi
fi
- echo "finishing stage 3 at `date`"
+ echo "finishing stage 3 at $(date)"
else
MMAKE_USE_SUBDIRS=${use_subdirs}
export MMAKE_USE_SUBDIRS
@@ -2004,23 +2005,23 @@ fi
# Run the tests in the tests/* directories.
-if test -s ${HOME}/.bootcheck_diff_opts
+if test -s "${HOME}"/.bootcheck_diff_opts
then
- DIFF_OPTS=`cat ${HOME}/.bootcheck_diff_opts`
+ DIFF_OPTS=$(cat "${HOME}"/.bootcheck_diff_opts)
export DIFF_OPTS
fi
test_status=0
if ${runtests}
then
- echo "starting the test suite at `date`"
+ echo "starting the test suite at $(date)"
# If the workspace has been moved since ${root}/scripts/test_mdbrc
# was last built, that file will refer to the OLD location of
# the workspace, which may not exist anymore. We therefore rebuild
# the file.
- (cd ${root}/scripts; /bin/rm test_mdbrc; mmake test_mdbrc)
- MERCURY_DEBUGGER_INIT=${root}/scripts/test_mdbrc
+ (cd "${root}"/scripts; /bin/rm test_mdbrc; mmake test_mdbrc)
+ MERCURY_DEBUGGER_INIT="${root}"/scripts/test_mdbrc
export MERCURY_DEBUGGER_INIT
MERCURY_SUPPRESS_STACK_TRACE=yes
@@ -2039,13 +2040,13 @@ then
then
if ${test_params}
then
- cp ${root}/${stage2dir}/Mmake.params tests
+ cp "${root}"/${stage2dir}/Mmake.params tests
else
/bin/rm tests/Mmake.params > /dev/null 2>&1
fi
if cmp \
- ${root}/doc/mdb_command_test.inp \
+ "${root}"/doc/mdb_command_test.inp \
tests/debugger/mdb_command_test.inp
then
true
@@ -2053,7 +2054,7 @@ then
mdb_command_test_inp_status=1
fi
- cp ${root}/doc/mdb_command_test.inp tests/debugger
+ cp "${root}"/doc/mdb_command_test.inp tests/debugger
sed -e "s:@WORKSPACE@:${WORKSPACE}:" \
< tests/WS_FLAGS.ws \
@@ -2110,8 +2111,8 @@ then
for d in ${all_test_dirs}
do
- cp tests/.mgnuc_copts tests/${d}
- cp tests/.mgnuc_opts tests/${d}
+ cp tests/.mgnuc_copts tests/"${d}"
+ cp tests/.mgnuc_opts tests/"${d}"
done
WORKSPACE_FLAGS=yes
@@ -2159,7 +2160,7 @@ then
;;
esac
- cd ${root}/tests
+ cd "${root}/tests"
true > FAILED_TESTS_SUMMARY
true > NOMAKE_DIRS
@@ -2175,12 +2176,12 @@ then
test_status=0
for specified_test in ${specified_tests_only}
do
- specified_test_dir=`dirname ${specified_test}`
- specified_test_base=`basename ${specified_test}`
+ specified_test_dir=$(dirname "${specified_test}")
+ specified_test_base=$(basename "${specified_test}")
if test -d \
"${root}/tests/${specified_test_dir}"
then
- cd ${root}/tests/${specified_test_dir}
+ cd "${root}/tests/${specified_test_dir}"
mmake ${mmake_opts} ${target_opt} ${jfactor} \
${test_grade_opt} \
SPECIFIED_TESTS="${specified_test_base}" runtests_local
@@ -2201,9 +2202,9 @@ then
test_status=0
for testdir in ${testdirs}
do
- if test -d ${root}/tests/${testdir}
+ if test -d "${root}/tests/${testdir}"
then
- cd ${root}/tests/${testdir}
+ cd "${root}/tests/${testdir}"
mmake ${mmake_opts} ${target_opt} ${jfactor} \
${test_grade_opt} ${test_log_opt} runtests_dir
if test "$?" -ne 0
@@ -2229,18 +2230,18 @@ then
mv "${type_stats}" "${type_stats}".test.$$
fi
- cd ${root}/tests
+ cd "${root}"/tests
for tcdir in PASSED_TC_DIR FAILED_TC_DIR
do
- if test "`cat ${tcdir}/NEXT_NUMBER`" -gt 0
+ if test "$(cat ${tcdir}/NEXT_NUMBER)" -gt 0
then
- ${SLICE_DIR}slice/mtc_union -o ${tcdir}/SUMMARY \
+ "${SLICE_DIR}"slice/mtc_union -o ${tcdir}/SUMMARY \
${tcdir}/trace_counts.*
/bin/rm ${tcdir}/trace_counts.*
fi
done
- cd ${root}
+ cd "${root}"
fi
fi
@@ -2249,20 +2250,20 @@ fi
# Run the tests in the extras/* directories.
extras_status=0
-if ${extras}
+if "${extras}"
then
- cd ${root}/extras
+ cd "${root}"/extras
if test -f Mmake.params
then
mv Mmake.params Mmake.params.$$
fi
- if test -f ${root}/Mmake.stage.params
+ if test -f "${root}"/Mmake.stage.params
then
- cp ${root}/Mmake.stage.params Mmake.params
- elif test -f ${root}/Mmake.params
+ cp "${root}"/Mmake.stage.params Mmake.params
+ elif test -f "${root}"/Mmake.params
then
- cp ${root}/Mmake.params Mmake.params
+ cp "${root}"/Mmake.params Mmake.params
else
cp /dev/null Mmake.params
fi
@@ -2277,9 +2278,9 @@ then
for testdir in *
do
- if test -f ${testdir}/Mmakefile -a ! -f ${testdir}/NOBOOTTEST
+ if test -f "${testdir}"/Mmakefile -a ! -f "${testdir}"/NOBOOTTEST
then
- (cd ${testdir};
+ (cd "${testdir}";
mmake ${mmake_opts} ${mmake_jobs} realclean;
mmake ${mmake_opts} ${mmake_jobs} depend &&
mmake ${mmake_opts} ${mmake_jobs} &&
@@ -2296,12 +2297,12 @@ then
/bin/rm Mmake.params
fi
- cd ${root}
+ cd "${root}"
fi
if ${delete_deep_data}
then
- (cd ${root}; \
+ (cd "${root}"; \
find stage2 tests -name Deep.data -o -name Deep.procrep -print \
| xargs /bin/rm -f)
fi
@@ -2315,40 +2316,40 @@ fi
tests_dir="${root}/tests"
-cat /dev/null > ${tests_dir}/EXPECT_FAIL_TESTS
+cat /dev/null > "${tests_dir}"/EXPECT_FAIL_TESTS
-if test -s ${tests_dir}/FAILED_TESTS_SUMMARY
+if test -s "${tests_dir}"/FAILED_TESTS_SUMMARY
then
- sed -e 's/ .*//' < ${tests_dir}/FAILED_TESTS_SUMMARY \
- > ${tests_dir}/FAIL_TESTS
+ sed -e 's/ .*//' < "${tests_dir}"/FAILED_TESTS_SUMMARY \
+ > "${tests_dir}"/FAIL_TESTS
- if test -f ${tests_dir}/EXPECT_FAIL_TESTS.all_grades
+ if test -f "${tests_dir}"/EXPECT_FAIL_TESTS.all_grades
then
- cat ${tests_dir}/EXPECT_FAIL_TESTS.all_grades >> \
- ${tests_dir}/EXPECT_FAIL_TESTS
+ cat "${tests_dir}"/EXPECT_FAIL_TESTS.all_grades >> \
+ "${tests_dir}"/EXPECT_FAIL_TESTS
fi
- if test -f ${tests_dir}/EXPECT_FAIL_TESTS.${test_grade}
+ if test -f "${tests_dir}"/EXPECT_FAIL_TESTS."${test_grade}"
then
- cat ${tests_dir}/EXPECT_FAIL_TESTS.${test_grade} >> \
- ${tests_dir}/EXPECT_FAIL_TESTS
+ cat "${tests_dir}"/EXPECT_FAIL_TESTS."${test_grade}" >> \
+ "${tests_dir}"/EXPECT_FAIL_TESTS
fi
- sort ${tests_dir}/EXPECT_FAIL_TESTS > ${tests_dir}/EXPECT_FAIL_TESTS.sort
- mv ${tests_dir}/EXPECT_FAIL_TESTS.sort ${tests_dir}/EXPECT_FAIL_TESTS
+ sort "${tests_dir}"/EXPECT_FAIL_TESTS > "${tests_dir}"/EXPECT_FAIL_TESTS.sort
+ mv "${tests_dir}"/EXPECT_FAIL_TESTS.sort "${tests_dir}"/EXPECT_FAIL_TESTS
- sort ${tests_dir}/FAIL_TESTS > ${tests_dir}/FAIL_TESTS.sort
- mv ${tests_dir}/FAIL_TESTS.sort ${tests_dir}/FAIL_TESTS
+ sort "${tests_dir}"/FAIL_TESTS > "${tests_dir}"/FAIL_TESTS.sort
+ mv "${tests_dir}"/FAIL_TESTS.sort "${tests_dir}"/FAIL_TESTS
- comm -23 ${tests_dir}/FAIL_TESTS \
- ${tests_dir}/EXPECT_FAIL_TESTS \
- > ${tests_dir}/UNEXPECTED_FAILED_TESTS
- comm -12 ${tests_dir}/FAIL_TESTS \
- ${tests_dir}/EXPECT_FAIL_TESTS \
- > ${tests_dir}/EXPECTED_FAILED_TESTS
+ comm -23 "${tests_dir}"/FAIL_TESTS \
+ "${tests_dir}"/EXPECT_FAIL_TESTS \
+ > "${tests_dir}"/UNEXPECTED_FAILED_TESTS
+ comm -12 "${tests_dir}"/FAIL_TESTS \
+ "${tests_dir}"/EXPECT_FAIL_TESTS \
+ > "${tests_dir}"/EXPECTED_FAILED_TESTS
if ${expect_listed_failures}
then
- if test ! -s ${tests_dir}/UNEXPECTED_FAILED_TESTS
+ if test ! -s "${tests_dir}"/UNEXPECTED_FAILED_TESTS
then
test_status=0
fi
@@ -2397,47 +2398,47 @@ then
exitstatus=1
fi
-if test -s ${tests_dir}/NOMAKE_DIRS
+if test -s "${tests_dir}"/NOMAKE_DIRS
then
echo "ERROR EXIT: some test directories were left out"
- cat ${tests_dir}/NOMAKE_DIRS
+ cat "${tests_dir}"/NOMAKE_DIRS
exitstatus=1
fi
-if test -s ${tests_dir}/FAILED_TESTS_SUMMARY
+if test -s "${tests_dir}"/FAILED_TESTS_SUMMARY
then
- num_expected_failures=`wc -l < ${tests_dir}/EXPECTED_FAILED_TESTS`
+ num_expected_failures=$(wc -l < "${tests_dir}"/EXPECTED_FAILED_TESTS)
case "${num_expected_failures}" in
0)
;;
1)
echo "one expected test case failure:"
echo
- sed -e 's/^/ /' < ${tests_dir}/EXPECTED_FAILED_TESTS
+ sed -e 's/^/ /' < "${tests_dir}"/EXPECTED_FAILED_TESTS
echo
;;
*)
echo "${num_expected_failures} expected test case failures:"
echo
- sed -e 's/^/ /' < ${tests_dir}/EXPECTED_FAILED_TESTS
+ sed -e 's/^/ /' < "${tests_dir}"/EXPECTED_FAILED_TESTS
echo
;;
esac
- num_unexpected_failures=`wc -l < ${tests_dir}/UNEXPECTED_FAILED_TESTS`
+ num_unexpected_failures=$(wc -l < "${tests_dir}"/UNEXPECTED_FAILED_TESTS)
case "${num_unexpected_failures}" in
0)
;;
1)
echo "one unexpected test case failure:"
echo
- sed -e 's/^/ /' < ${tests_dir}/UNEXPECTED_FAILED_TESTS
+ sed -e 's/^/ /' < "${tests_dir}"/UNEXPECTED_FAILED_TESTS
echo
;;
*)
echo "${num_unexpected_failures} unexpected test case failures:"
echo
- sed -e 's/^/ /' < ${tests_dir}/UNEXPECTED_FAILED_TESTS
+ sed -e 's/^/ /' < "${tests_dir}"/UNEXPECTED_FAILED_TESTS
echo
;;
esac
@@ -2450,7 +2451,7 @@ fi
echo "-----------------------------------------------------------------------"
-echo "finishing at `date`"
+echo "finishing at $(date)"
exit ${exitstatus}
#-----------------------------------------------------------------------------#
More information about the reviews
mailing list