diff --git a/configure.ac b/configure.ac index 87576f0a2..28e0ebe4a 100644 --- a/configure.ac +++ b/configure.ac @@ -643,6 +643,7 @@ tests/src/editor/test-data.txt tests/src/vfs/Makefile tests/src/vfs/extfs/Makefile tests/src/vfs/extfs/helpers-list/Makefile +tests/src/vfs/extfs/helpers-list/data/config.sh ]) AC_OUTPUT diff --git a/tests/src/vfs/extfs/helpers-list/Makefile.am b/tests/src/vfs/extfs/helpers-list/Makefile.am index 716c3a367..957631ac5 100644 --- a/tests/src/vfs/extfs/helpers-list/Makefile.am +++ b/tests/src/vfs/extfs/helpers-list/Makefile.am @@ -92,6 +92,7 @@ run: # The 'abs_' isn't mandatory. It lets you move this script out of the build tree. @echo '"$(abs_srcdir)"/test_all "$$@" \' >> $@ @echo ' --data-dir "$(abs_srcdir)/data" \' >> $@ + @echo ' --data-build-dir "$(abs_builddir)/data" \' >> $@ # Before installation, some helpers are in the build tree, some in the src tree. @echo ' --helpers-dir "$(abs_top_builddir)/src/vfs/extfs/helpers" \' >> $@ @echo ' --helpers-dir "$(abs_top_srcdir)/src/vfs/extfs/helpers"' >> $@ @@ -99,6 +100,9 @@ run: # (We can alternatively create run from a run.in template # with 'AC_CONFIG_FILES[run, chmod +x run]'.) +# Whenever we change the recipe above, we need to regenerate the 'run' script: +run: Makefile + # # Documentation # diff --git a/tests/src/vfs/extfs/helpers-list/README b/tests/src/vfs/extfs/helpers-list/README index b9c76ff0f..0c3bda65d 100644 --- a/tests/src/vfs/extfs/helpers-list/README +++ b/tests/src/vfs/extfs/helpers-list/README @@ -185,3 +185,23 @@ Contains the path of the [input file]. You'll more commonly use Contains the path of [the data folder]. Use it when you need to construct the paths of other files you store there. + +#### MC_TEST_EXTFS_DATA_BUILD_DIR #### + +Contains the path of [the data folder], but in the *build* tree. This is +where *.in files from the source tree end up. If you don't know what +these are, you can safely ignore this variable. + +#### MC_TEST_EXTFS_CONFIG_SH #### + +Contains the path of *config.sh*, a file you can "source" into shell +scripts (including the [environment file]) to gain access to values set +when Midnight Commander was compiled. Example: + + . "$MC_TEST_EXTFS_CONFIG_SH" + $PERL -e 'print "hello"' + +Currently, this variable is equal to +"[$MC_TEST_EXTFS_DATA_BUILD_DIR][MC_TEST_EXTFS_DATA_BUILD_DIR]/config.sh", +but you're advised to use only `$MC_TEST_EXTFS_CONFIG_SH` as we may +change this file's location in the future. diff --git a/tests/src/vfs/extfs/helpers-list/data/config.sh.in b/tests/src/vfs/extfs/helpers-list/data/config.sh.in new file mode 100644 index 000000000..05aca0649 --- /dev/null +++ b/tests/src/vfs/extfs/helpers-list/data/config.sh.in @@ -0,0 +1,9 @@ +# +# Configure-time parameters that may be useful in tests. +# +# See README for how to use this file. +# +PERL="@PERL@" +AWK="@AWK@" +PYTHON="@PYTHON@" +RUBY="@RUBY@" diff --git a/tests/src/vfs/extfs/helpers-list/test_all b/tests/src/vfs/extfs/helpers-list/test_all index f4dd4f1ff..23f8cea79 100755 --- a/tests/src/vfs/extfs/helpers-list/test_all +++ b/tests/src/vfs/extfs/helpers-list/test_all @@ -31,7 +31,8 @@ SYNOPSIS $(basename "$0") \\ --data-dir /path/to/where/data/files/are/stored \\ - --helpers-dir /path/to/where/helpers/are/stored + --helpers-dir /path/to/where/helpers/are/stored \\ + --data-build-dir /path/to/where/config.sh/is/stored (But you're more likely to invoke this program with the 'run' script created by 'make check'; or by 'make check' itself.) @@ -43,11 +44,15 @@ their output to the expected output. See README for full details. -You need to tell this program two things: where the helpers are stored, -and where the "data files" are stored. The data files are *.input files -that are fed to the helpers and *.output files that are the correct +You need to tell this program primarily two things: where the helpers are +stored, and where the "data files" are stored. The data files are *.input +files that are fed to the helpers and *.output files that are the correct output expected from these helpers. +You also need to tell this program where the build flavor of the "data +files" is stored. Most notably this is where the 'config.sh' file is +created during build time. You do this with '--data-build-dir'. + EOS } @@ -57,6 +62,7 @@ EOS # The directories used. data_dir= +data_build_dir= helpers_dir1= helpers_dir2= @@ -177,6 +183,13 @@ find_helper() { fi } +# +# Returns the path of 'config.sh'. +# +path_of_config_sh() { + echo "$data_build_dir/config.sh" +} + # # Export variables to be used by tests. # @@ -194,6 +207,10 @@ export_useful_variables() { export MC_TEST_EXTFS_INPUT MC_TEST_EXTFS_DATA_DIR=$data_dir export MC_TEST_EXTFS_DATA_DIR + MC_TEST_EXTFS_DATA_BUILD_DIR=$data_build_dir + export MC_TEST_EXTFS_DATA_BUILD_DIR + MC_TEST_EXTFS_CONFIG_SH=$(path_of_config_sh) + export MC_TEST_EXTFS_CONFIG_SH } # @@ -346,6 +363,10 @@ parse_command_line_arguments() { data_dir=$2 shift 2 ;; + --data-build-dir) + data_build_dir=$2 + shift 2 + ;; --helpers-dir) if [ -z "$helpers_dir1" ]; then helpers_dir1=$2 @@ -378,15 +399,18 @@ parse_command_line_arguments() { # verify_setup() { [ -n "$data_dir" ] || die "You didn't specify the data dir (--data-dir). Run me with --help for info." + [ -n "$data_build_dir" ] || die "You didn't specify the data build dir (--data-build-dir). Run me with --help for info." [ -n "$helpers_dir1" ] || die "You didn't specify the helpers dir (--helpers-dir). Run me with --help for info." [ -z "$helpers_dir2" ] && helpers_dir2=$helpers_dir1 # we're being lazy. local dir - for dir in "$data_dir" "$helpers_dir1" "$helpers_dir2"; do + for dir in "$data_dir" "$data_build_dir" "$helpers_dir1" "$helpers_dir2"; do assert_dir_exists "$dir" has_string "$dir" " " && die "$dir: Sorry, spaces aren't allowed in pathnames." # search "reason", twice, above. done + [ -e "$(path_of_config_sh)" ] || die "Missing file $(path_of_config_sh). You probably have a mistake in the '--data-build-dir' path." + local missing_progs="" check_prog() { if ! has_prog "$1"; then