Skip to content

Commit 519c494

Browse files
author
Alan W. Irwin
committed
Improve comprehensive_test.sh script
The improvements are the following: 1. Make the summary of options state the options with the same format users would need to specify them (and with quotes wherever they might be required). 2. Make the script more robust by warning when no printenv command is available, for that case removing corresponding stale file results, and by checking that files exist before storing them in the tarball. when there is no printenv command available.
1 parent 44c7bfa commit 519c494

1 file changed

Lines changed: 33 additions & 21 deletions

File tree

scripts/comprehensive_test.sh

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ collect_exit() {
8282
rm -f $TARBALL $TARBALL.gz
8383

8484
# Collect relevant subset of $prefix information in the tarball
85-
tar rf $TARBALL $RELATIVE_COMPREHENSIVE_TEST_LOG
86-
tar rf $TARBALL $RELATIVE_ENVIRONMENT_LOG
85+
if [ -f $RELATIVE_COMPREHENSIVE_TEST_LOG ] ; then
86+
tar rf $TARBALL $RELATIVE_COMPREHENSIVE_TEST_LOG
87+
fi
88+
89+
if [ -f $RELATIVE_ENVIRONMENT_LOG ] ; then
90+
tar rf $TARBALL $RELATIVE_ENVIRONMENT_LOG
91+
fi
8792

8893
for directory in shared nondynamic static ; do
8994
if [ -d $directory/output_tree ] ; then
@@ -685,27 +690,27 @@ fi
685690

686691
echo_tee "Summary of options used for these tests
687692
688-
prefix=$prefix
693+
--prefix \"$prefix\"
689694
690-
do_clean_as_you_go=$do_clean_as_you_go
695+
--do_clean_as_you_go $do_clean_as_you_go
691696
692-
generator_string=$generator_string"
697+
--generator_string \"$generator_string"\"
693698
echo_tee "
694-
ctest_command=$ctest_command
695-
build_command=$build_command
696-
traditional_build_command=$traditional_build_command
697-
698-
cmake_added_options=$cmake_added_options
699-
do_shared=$do_shared
700-
do_nondynamic=$do_nondynamic
701-
do_static=$do_static
702-
703-
do_ctest=$do_ctest
704-
do_test_noninteractive=$do_test_noninteractive
705-
do_test_interactive=$do_test_interactive
706-
do_test_build_tree=$do_test_build_tree
707-
do_test_install_tree=$do_test_install_tree
708-
do_test_traditional_install_tree=$do_test_traditional_install_tree
699+
--ctest_command \"$ctest_command\"
700+
--build_command \"$build_command\"
701+
--traditional_build_command \"$traditional_build_command\"
702+
703+
--cmake_added_options \"$cmake_added_options\"
704+
--do_shared $do_shared
705+
--do_nondynamic $do_nondynamic
706+
--do_static $do_static
707+
708+
--do_ctest $do_ctest
709+
--do_test_noninteractive $do_test_noninteractive
710+
--do_test_interactive $do_test_interactive
711+
--do_test_build_tree $do_test_build_tree
712+
--do_test_install_tree $do_test_install_tree
713+
--do_test_traditional_install_tree $do_test_traditional_install_tree
709714
710715
N.B. do_clean_as_you_go above should be yes unless you don't mind an
711716
accumulation of ~40GB of plot files! Even with this option set to yes
@@ -739,8 +744,15 @@ if [ "$do_clean_first" = "yes" ] ; then
739744
rm -rf $prefix/shared $prefix/nondynamic $prefix/static
740745
fi
741746

747+
hash printenv
748+
hash_rc=$?
749+
if [ "$hash_rc" -ne 0 ] ; then
750+
echo_tee "WARNING: printenv not on PATH so not collecting environment variables in $ENVIRONMENT_LOG"
751+
rm -f $ENVIRONMENT_LOG
752+
else
742753
# Collect environment variable results prior to testing.
743-
printenv >| $ENVIRONMENT_LOG
754+
printenv >| $ENVIRONMENT_LOG
755+
fi
744756

745757
# Shared + dynamic
746758
if [ "$do_shared" = "yes" ] ; then

0 commit comments

Comments
 (0)