]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: call ts_init_env as early as possible
authorRuediger Meier <ruediger.meier@ga-group.nl>
Sat, 10 May 2014 02:51:22 +0000 (04:51 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Sat, 10 May 2014 02:59:34 +0000 (04:59 +0200)
Soon we want to use some env vars within ts_has_option(). That's
why we move some lines to make this possible.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests/functions.sh

index 191a310acfe5b53268af22655311d34cb607a785..e76408baf9a4a58147b16d8ceafd0ed1784ac144 100644 (file)
@@ -132,6 +132,7 @@ function ts_init_core_subtest_env {
 
 function ts_init_env {
        local mydir=$(ts_abspath ${0%/*})
+       local tmp
 
        LANG="POSIX"
        LANGUAGE="POSIX"
@@ -178,6 +179,11 @@ function ts_init_env {
        TS_VERBOSE=$(ts_has_option "verbose" "$*")
        TS_PARALLEL=$(ts_has_option "parallel" "$*")
 
+       tmp=$( ts_has_option "memcheck" "$*")
+       if [ "$tmp" == "yes" -a -f /usr/bin/valgrind ]; then
+               TS_VALGRIND_CMD="/usr/bin/valgrind"
+       fi
+
        BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab"
 
        declare -a TS_SUID_PROGS
@@ -233,15 +239,10 @@ function ts_init_subtest {
 }
 
 function ts_init {
+       ts_init_env "$*"
+
        local is_fake=$( ts_has_option "fake" "$*")
        local is_force=$( ts_has_option "force" "$*")
-       local is_memcheck=$( ts_has_option "memcheck" "$*")
-
-       if [ "$is_memcheck" == "yes" -a -f /usr/bin/valgrind ]; then
-               TS_VALGRIND_CMD="/usr/bin/valgrind"
-       fi
-
-       ts_init_env "$*"
 
        if [ "$TS_PARALLEL" == "yes" ]; then
                TS_TITLE=$(printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_DESC")