From 06e48c52aabaf09a6b851c91b0c25d895c56949e Mon Sep 17 00:00:00 2001
From: Mooffie <mooffie@gmail.com>
Date: Sat, 7 Jan 2017 19:50:27 +0200
Subject: [PATCH 2/3] Ticket #3752: 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>
---
tests/src/vfs/extfs/helpers-list/README | 20 ++++++++++++++++++--
tests/src/vfs/extfs/helpers-list/test_all | 22 ++++++++++++++++++++--
2 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/tests/src/vfs/extfs/helpers-list/README b/tests/src/vfs/extfs/helpers-list/README
index d601f7d..b9c76ff 100644
a
|
b
|
This is the tester itself. You invoke it with `make check`, or with the |
142 | 142 | `run` script. Invoking it directly is a bit involving because you need to |
143 | 143 | provide it with 2 or 3 directory paths. `run` does this work for you. |
144 | 144 | |
145 | | MC_TEST_EXTFS_LIST_CMD |
146 | | ---------------------- |
| 145 | Environment variables |
| 146 | --------------------- |
| 147 | |
| 148 | ### Frequently used variables ### |
| 149 | |
| 150 | #### MC_TEST_EXTFS_LIST_CMD #### |
147 | 151 | |
148 | 152 | When a helper runs under the tester, the environment variable |
149 | 153 | `MC_TEST_EXTFS_LIST_CMD` holds the command that's to provide input. The |
… |
… |
To make this helper testable, we need to change the first line to: |
169 | 173 | The command in `MC_TEST_EXTFS_LIST_CMD` is a black-box for the helper, |
170 | 174 | and it intentionally ignores any arguments passed to it (so that `lq |
171 | 175 | "$ARCHIVE"`, above, won't cause problems). |
| 176 | |
| 177 | ### Infrequently used variables ### |
| 178 | |
| 179 | #### MC_TEST_EXTFS_INPUT #### |
| 180 | |
| 181 | Contains the path of the [input file]. You'll more commonly use |
| 182 | [MC_TEST_EXTFS_LIST_CMD], though. |
| 183 | |
| 184 | #### MC_TEST_EXTFS_DATA_DIR #### |
| 185 | |
| 186 | Contains the path of [the data folder]. Use it when you need to |
| 187 | construct the paths of other files you store there. |
diff --git a/tests/src/vfs/extfs/helpers-list/test_all b/tests/src/vfs/extfs/helpers-list/test_all
index 0652c9d..f4dd4f1 100755
a
|
b
|
find_helper() { |
178 | 178 | } |
179 | 179 | |
180 | 180 | # |
| 181 | # Export variables to be used by tests. |
| 182 | # |
| 183 | # See README for their documentation. |
| 184 | # |
| 185 | export_useful_variables() { |
| 186 | local input="$1" |
| 187 | |
| 188 | # Frequently used variables: |
| 189 | MC_TEST_EXTFS_LIST_CMD="mc_xcat $input" # reason #2 we don't allow spaces in pathnames. |
| 190 | export MC_TEST_EXTFS_LIST_CMD |
| 191 | |
| 192 | # Infrequently used variables: |
| 193 | MC_TEST_EXTFS_INPUT=$input |
| 194 | export MC_TEST_EXTFS_INPUT |
| 195 | MC_TEST_EXTFS_DATA_DIR=$data_dir |
| 196 | export MC_TEST_EXTFS_DATA_DIR |
| 197 | } |
| 198 | |
| 199 | # |
181 | 200 | # The crux of this program. |
182 | 201 | # |
183 | 202 | run() { |
… |
… |
run() { |
235 | 254 | # |
236 | 255 | |
237 | 256 | ( |
238 | | MC_TEST_EXTFS_LIST_CMD="mc_xcat $input" # reason #2 we don't allow spaces in pathnames. |
239 | | export MC_TEST_EXTFS_LIST_CMD |
| 257 | export_useful_variables "$input" |
240 | 258 | if [ -f "$env_vars_file" ]; then |
241 | 259 | set -a # "allexport: Export all variables assigned to." |
242 | 260 | . "$env_vars_file" |