mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-09 19:02:18 +00:00
Sometimes, when a test case fails in a workspace even though it has passed
before, it is not clear whether the cause of the failure is that the
updated code in the workspace is generating a different sequence of
mmc invocations, or whether the same invocations do something different.
The new option allows developers to answer that question by keeping the logs
from a bootcheck in an unchanged workspace, and comparing the logs
between the workspaces.
tools/bootcheck:
If given the --keep-success-log-files option, set an environment variable
that records this fact.
tests/run_one_test:
If this environment variable is set, then rename the .log files of
successful test cases as .kept_log files instead of deleting them.
Note that we cannot keep the .log files around under their original name,
because we currently interpret the presence of *any* .log file
in a test directory as meaning "some tests failed in this test directory".
99 lines
3.0 KiB
Bash
Executable File
99 lines
3.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# vim: ts=4 sw=4 expandtab
|
|
|
|
exitstatus=0
|
|
echo RUNNING TEST "${this_dir}/${test_full}" "${params_msg}"
|
|
echo "MERCURY_OPTIONS=${MERCURY_OPTIONS}" > "${test_full}.log"
|
|
trace_count=false
|
|
case "${MERCURY_OPTIONS}" in
|
|
*trace-count*)
|
|
trace_count=true
|
|
/bin/rm .mercury_trace_counts.* > /dev/null 2>&1
|
|
;;
|
|
esac
|
|
|
|
rm -f ${test_full}.failed
|
|
case ${test_full} in
|
|
*-nodepend)
|
|
;;
|
|
*)
|
|
( mmake "${test}.depend" 2>&1 || touch "${test_full}.failed" ) \
|
|
>> "${test_full}.log"
|
|
;;
|
|
esac
|
|
|
|
if test -f "${test_full}.failed"
|
|
then
|
|
echo FAILED TEST "${this_dir}/${test_full}" "${params_msg}" \
|
|
>> "${test_full}.log"
|
|
cat "${test_full}.log"
|
|
echo "${test_full}" >> FAILED_TESTS
|
|
echo "${this_dir}/${test_full}" "${params_msg}" >> \
|
|
"${tests_dir}/FAILED_TESTS_SUMMARY"
|
|
exitstatus=1
|
|
else
|
|
( mmake "${test}.runtest" 2>&1 || touch "${test_full}.failed" ) \
|
|
>> "${test_full}.log"
|
|
if test -f "${test_full}.failed"
|
|
then
|
|
rm -f "${test_full}.failed"
|
|
echo FAILED TEST "${this_dir}/${test_full}" "${params_msg}"
|
|
echo "LOG OF THE FAILED TEST"
|
|
cat "${test_full}.log"
|
|
echo "END OF THE LOG OF THE FAILED TEST"
|
|
echo "${test_full}" >> FAILED_TESTS
|
|
echo "${this_dir}/${test_full}" "${params_msg}" \
|
|
>> "${tests_dir}/FAILED_TESTS_SUMMARY"
|
|
tcdir=FAILED_TC_DIR
|
|
exitstatus=1
|
|
else
|
|
if test "${KEEP_SUCCESS_LOG_FILES}" = "keep_success_log_files"
|
|
then
|
|
mv -f "${test_full}.log" "${test_full}.kept_log"
|
|
else
|
|
rm -f "${test_full}.log"
|
|
fi
|
|
rm -f ${test}.out* ${test}.*res*
|
|
mmake "${test}.realclean" > /dev/null 2>&1
|
|
# The lack of a FAILED TEST is enough to tell you that the test passed.
|
|
# echo PASSED TEST "${this_dir}/${test_full}" "${params_msg}"
|
|
tcdir=PASSED_TC_DIR
|
|
fi
|
|
|
|
case "${trace_count}" in
|
|
true)
|
|
max_num_trace_counts=50
|
|
n=`cat "${tests_dir}/${tcdir}/NEXT_NUMBER"`
|
|
for counts_file in .mercury_trace_counts.*
|
|
do
|
|
if test -s "${counts_file}"
|
|
then
|
|
mv "${counts_file}" \
|
|
"${tests_dir}/${tcdir}/trace_counts.${n}"
|
|
n=`expr ${n} + 1`
|
|
fi
|
|
done
|
|
if test "${n}" -gt "${max_num_trace_counts}"
|
|
then
|
|
${SLICE_DIR}mtc_union -o "${tests_dir}/${tcdir}/tmp_summary" \
|
|
${tests_dir}/${tcdir}/trace_counts.*
|
|
/bin/rm -f ${tests_dir}/${tcdir}/trace_counts.*
|
|
mv "${tests_dir}/${tcdir}/tmp_summary" \
|
|
"${tests_dir}/${tcdir}/trace_counts.0"
|
|
|
|
echo 1 > "${tests_dir}/${tcdir}/NEXT_NUMBER"
|
|
else
|
|
echo "${n}" > "${tests_dir}/${tcdir}/NEXT_NUMBER"
|
|
fi
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
case "${BOOTCHECK_TEST_PROGRESS}" in
|
|
yes)
|
|
touch ".date.${test}"
|
|
;;
|
|
esac
|
|
|
|
exit ${exitstatus}
|