Currently, the callback function fallback_device() is called with bash $() feature. This runs the function call in a new bash context. Then, global variable changes in the function call are not reflected in the caller context. This is not handy and does not allow checking MODULES_TO_UNLOAD status change in the caller, which will be added in the following commit. To share the same bash context between the caller and the callee of fallback_device(), do not use $(). Instead, use a temporary file to keep the output of fallback_device(). Signed-off-by: Shin'ichiro Kawasaki --- check | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/check b/check index fdc7ba7..00213cb 100755 --- a/check +++ b/check @@ -708,6 +708,7 @@ _check_and_call_test_device() { local unset_skip_reason local ret=0 local fallback=0 + local fb_dev_file if declare -fF requires >/dev/null; then requires @@ -726,10 +727,14 @@ _check_and_call_test_device() { return 0 fi - if ! TEST_DEV=$(fallback_device); then + # Use a tmp file to keep bash context in fallback_device + fb_dev_file="${OUTPUT}/${TEST_NAME/\//_}_fallback_dev" + if ! fallback_device > "$fb_dev_file"; then _warning "$TEST_NAME: fallback_device call failure" return 0 fi + TEST_DEV=$(<"$fb_dev_file") + rm -f "$fb_dev_file" if ! _find_sysfs_dirs "$TEST_DEV"; then _warning "$TEST_NAME: could not find sysfs directory for ${TEST_DEV}" -- 2.49.0