From d5ddf1ecaca8e48b94e2703d2f02464db729baa6 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 14 Oct 2022 11:11:00 -0700 Subject: [PATCH] Fix option save/restore test helpers The test shell helpers for saving and restoring mount options were trying to put each mount's option value in an array. It meant to build the array key by concatenating the option name and the mount number. But it didn't isolate the option "name" variable when evaluating it, instead always evaluating "name_" to nothing and building keys for all options that only contained the mount index. This then broke when tests attempted to save and restore multiple options. Signed-off-by: Zach Brown --- tests/funcs/fs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/funcs/fs.sh b/tests/funcs/fs.sh index 9a2c2db7..34c9c5ca 100644 --- a/tests/funcs/fs.sh +++ b/tests/funcs/fs.sh @@ -405,7 +405,7 @@ t_save_all_sysfs_mount_options() { for i in $(t_fs_nrs); do opt="$(t_sysfs_path $i)/mount_options/$name" - ind="$name_$i" + ind="${name}_${i}" _saved_opts[$ind]="$(cat $opt)" done @@ -417,7 +417,7 @@ t_restore_all_sysfs_mount_options() { local i for i in $(t_fs_nrs); do - ind="$name_$i" + ind="${name}_${i}" t_set_sysfs_mount_option $i $name "${_saved_opts[$ind]}" done