mirror of https://github.com/MidnightCommander/mc
extfs: tester: export some more useful variables.
New environment variables: - MC_TEST_EXTFS_DATA_DIR - MC_TEST_EXTFS_INPUT Signed-off-by: Mooffie <mooffie@gmail.com>
This commit is contained in:
parent
9f99838fbe
commit
e4e4b214b4
|
@ -142,8 +142,12 @@ This is the tester itself. You invoke it with `make check`, or with the
|
|||
`run` script. Invoking it directly is a bit involving because you need to
|
||||
provide it with 2 or 3 directory paths. `run` does this work for you.
|
||||
|
||||
MC_TEST_EXTFS_LIST_CMD
|
||||
----------------------
|
||||
Environment variables
|
||||
---------------------
|
||||
|
||||
### Frequently used variables ###
|
||||
|
||||
#### MC_TEST_EXTFS_LIST_CMD ####
|
||||
|
||||
When a helper runs under the tester, the environment variable
|
||||
`MC_TEST_EXTFS_LIST_CMD` holds the command that's to provide input. The
|
||||
|
@ -169,3 +173,15 @@ To make this helper testable, we need to change the first line to:
|
|||
The command in `MC_TEST_EXTFS_LIST_CMD` is a black-box for the helper,
|
||||
and it intentionally ignores any arguments passed to it (so that `lq
|
||||
"$ARCHIVE"`, above, won't cause problems).
|
||||
|
||||
### Infrequently used variables ###
|
||||
|
||||
#### MC_TEST_EXTFS_INPUT ####
|
||||
|
||||
Contains the path of the [input file]. You'll more commonly use
|
||||
[MC_TEST_EXTFS_LIST_CMD], though.
|
||||
|
||||
#### MC_TEST_EXTFS_DATA_DIR ####
|
||||
|
||||
Contains the path of [the data folder]. Use it when you need to
|
||||
construct the paths of other files you store there.
|
||||
|
|
|
@ -177,6 +177,25 @@ find_helper() {
|
|||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Export variables to be used by tests.
|
||||
#
|
||||
# See README for their documentation.
|
||||
#
|
||||
export_useful_variables() {
|
||||
local input="$1"
|
||||
|
||||
# Frequently used variables:
|
||||
MC_TEST_EXTFS_LIST_CMD="mc_xcat $input" # reason #2 we don't allow spaces in pathnames.
|
||||
export MC_TEST_EXTFS_LIST_CMD
|
||||
|
||||
# Infrequently used variables:
|
||||
MC_TEST_EXTFS_INPUT=$input
|
||||
export MC_TEST_EXTFS_INPUT
|
||||
MC_TEST_EXTFS_DATA_DIR=$data_dir
|
||||
export MC_TEST_EXTFS_DATA_DIR
|
||||
}
|
||||
|
||||
#
|
||||
# The crux of this program.
|
||||
#
|
||||
|
@ -235,8 +254,7 @@ run() {
|
|||
#
|
||||
|
||||
(
|
||||
MC_TEST_EXTFS_LIST_CMD="mc_xcat $input" # reason #2 we don't allow spaces in pathnames.
|
||||
export MC_TEST_EXTFS_LIST_CMD
|
||||
export_useful_variables "$input"
|
||||
if [ -f "$env_vars_file" ]; then
|
||||
set -a # "allexport: Export all variables assigned to."
|
||||
. "$env_vars_file"
|
||||
|
|
Loading…
Reference in New Issue