Ticket #3752: 3752-0002-extfs-tester-export-some-more-useful-variables.patch

File 3752-0002-extfs-tester-export-some-more-useful-variables.patch, 3.0 KB (added by mooffie, 5 years ago)
  • tests/src/vfs/extfs/helpers-list/README

    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 
    142142`run` script. Invoking it directly is a bit involving because you need to 
    143143provide it with 2 or 3 directory paths. `run` does this work for you. 
    144144 
    145 MC_TEST_EXTFS_LIST_CMD 
    146 ---------------------- 
     145Environment variables 
     146--------------------- 
     147 
     148### Frequently used variables ### 
     149 
     150#### MC_TEST_EXTFS_LIST_CMD #### 
    147151 
    148152When a helper runs under the tester, the environment variable 
    149153`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: 
    169173The command in `MC_TEST_EXTFS_LIST_CMD` is a black-box for the helper, 
    170174and it intentionally ignores any arguments passed to it (so that `lq 
    171175"$ARCHIVE"`, above, won't cause problems). 
     176 
     177### Infrequently used variables ### 
     178 
     179#### MC_TEST_EXTFS_INPUT #### 
     180 
     181Contains 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 
     186Contains the path of [the data folder]. Use it when you need to 
     187construct the paths of other files you store there. 
  • tests/src/vfs/extfs/helpers-list/test_all

    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() { 
    178178} 
    179179 
    180180# 
     181# Export variables to be used by tests. 
     182# 
     183# See README for their documentation. 
     184# 
     185export_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# 
    181200# The crux of this program. 
    182201# 
    183202run() { 
    run() { 
    235254    # 
    236255 
    237256    ( 
    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" 
    240258    if [ -f "$env_vars_file" ]; then 
    241259      set -a  # "allexport: Export all variables assigned to." 
    242260      . "$env_vars_file"