@@ -314,10 +314,10 @@ _cleanup() {
fi
local key value
- for key in "${!TEST_DEV_QUEUE_SAVED[@]}"; do
- value="${TEST_DEV_QUEUE_SAVED["$key"]}"
- echo "$value" >"${TEST_DEV_SYSFS}/queue/${key}"
- unset "TEST_DEV_QUEUE_SAVED[$key]"
+ for key in "${!SYSFS_QUEUE_SAVED[@]}"; do
+ value="${SYSFS_QUEUE_SAVED["$key"]}"
+ echo "$value" >"${key}"
+ unset "SYSFS_QUEUE_SAVED[$key]"
done
if [[ "${RESTORE_CPUS_ONLINE:-}" ]]; then
@@ -336,7 +336,7 @@ _call_test() {
local seqres="${RESULTS_DIR}/${TEST_NAME}"
# shellcheck disable=SC2034
FULL="${seqres}.full"
- declare -A TEST_DEV_QUEUE_SAVED
+ declare -A SYSFS_QUEUE_SAVED
declare -A LAST_TEST_RUN
_read_last_test_run
@@ -284,12 +284,14 @@ _test_dev_queue_get() {
}
_test_dev_queue_set() {
- # For bash >=4.3 we'd write if [[ ! -v TEST_DEV_QUEUE_SAVED["$1"] ]].
- if [[ -z ${TEST_DEV_QUEUE_SAVED["$1"]} &&
- ${TEST_DEV_QUEUE_SAVED["$1"]-unset} == unset ]]; then
- TEST_DEV_QUEUE_SAVED["$1"]="$(_test_dev_queue_get "$1")"
+ local path="${TEST_DEV_SYSFS}/queue/$1"
+
+ # For bash >=4.3 we'd write if [[ ! -v SYSFS_QUEUE_SAVED["$path"] ]].
+ if [[ -z ${SYSFS_QUEUE_SAVED["$path"]} &&
+ ${SYSFS_QUEUE_SAVED["$path"]-unset} == unset ]]; then
+ SYSFS_QUEUE_SAVED["$path"]="$(_test_dev_queue_get "$1")"
fi
- echo "$2" >"${TEST_DEV_SYSFS}/queue/$1"
+ echo "$2" >"$path"
}
_require_test_dev_is_pci() {
Current implementation saves sysfs attributes under queue/ directory in the associative array TEST_DEV_QUEUE_SAVED using attribute file names as keys. The saved attributes are restored after each test case run. When TEST_DEV is a device-mapper, this attribute restore does not cover attributes of device-mapper destination devices. As a preparation to cover the destination devices, use path of the attributes as keys instead of file names. Also rename the associative array TEST_DEV_QUEUE_SAVED to SYSFS_QUEUE_SAVED. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> --- check | 10 +++++----- common/rc | 12 +++++++----- 2 files changed, 12 insertions(+), 10 deletions(-)