Browse Source

Source (do not run) TF_SETUP and TF_CLEANUP

Source the setup/cleanup code so that it can be used to prepare
environment.

Disadvantage is that the files will need to be in Bash (ie. effect of
commit 4eb772d is negated), but that should not be problem as the use
of subtest.sh already implies that Bash is used.

After all, one can always easily run other program from these files.
Alois Mahdal 10 years ago
parent
commit
5ccb5a2c53
2 changed files with 4 additions and 4 deletions
  1. 2
    2
      test/README.md
  2. 2
    2
      test/include/subtest.sh

+ 2
- 2
test/README.md View File

@@ -134,7 +134,7 @@ At the end, `tf_do_subtests` acts as a launcher of the actual test.
134 134
 In short, it will
135 135
 
136 136
  *  take each enumerated subtest from `tf_enum_subtests`,
137
- *  run TF_SETUP, if such file is found,
137
+ *  source TF_SETUP, if such file is found,
138 138
  *  translate te subtest name to a command,
139 139
  *  launch the command,
140 140
  *  run TF_CLEANUP, if such file is found,
@@ -214,7 +214,7 @@ is set to `true`, which is by defaiult.
214 214
 ### Setup and cleanup ###
215 215
 
216 216
 Special files *TF_SETUP* and *TF_CLEANUP* (one of them or both) can be
217
-added along with *TF_RUN*.  These will be execued before (*TF_SETUP*)
217
+added along with *TF_RUN*.  These will be sourced before (*TF_SETUP*)
218 218
 and after every subtest (*TF_CLEANUP*).
219 219
 
220 220
 First, if any of these files are missing, it is considered as if the

+ 2
- 2
test/include/subtest.sh View File

@@ -27,8 +27,8 @@ tf_do_subtest() {
27 27
     local tcmd=""           # test command
28 28
     local setup=true        # setup function
29 29
     local cleanup=true      # cleanup command
30
-    test -f TF_SETUP   && setup="./TF_SETUP"
31
-    test -f TF_CLEANUP && cleanup="./TF_CLEANUP"
30
+    test -f TF_SETUP   && setup=". TF_SETUP"
31
+    test -f TF_CLEANUP && cleanup=". TF_CLEANUP"
32 32
     if $setup;
33 33
     then
34 34
         tcmd="$(tf_name2cmd $subtname)"