@@ -1191,35 +1191,23 @@ perf_analyze()
11911191# Should be triggered at the end of
11921192# every test touching ALSA.
11931193# Couple with save_machine_state.
1194- # Passes through the status of the previous command
1195- # so as to not interefere with the func_exit_handler
1196- # param1: file name
11971194restore_alsa_state ()
11981195{
1199- status=$?
1200- dlogi " restore_alsa_state called with ${1} "
1201- if [ -f " $1 " ]; then
1202- dlogi " restore_alsa_state found relevant state file."
1203- alsactl restore --file /var/tmp/" $1 " --pedantic --no-ucm --no-init-fallback || dlogi " alsactl state restoration failed!"
1204- rm /var/tmp/" $1 " || dlogi " Old state file removal failed!"
1196+ dlogi " restore_alsa_state called in ${SCRIPT_NAME} "
1197+ if [ -f /var/tmp/" ${SCRIPT_NAME} " .state ]; then
1198+ dlogi " restore_alsa_state found a relevant state file."
1199+ alsactl restore --file /var/tmp/" ${SCRIPT_NAME} " .state --pedantic --no-ucm --no-init-fallback || dlogi " alsactl state restoration failed!"
1200+ rm /var/tmp/" ${SCRIPT_NAME} " .state || dlogi " Old state file removal failed!"
12051201 fi
1206- return " $status "
12071202}
12081203
12091204# Save the machine state to a file.
12101205# Should be used at the start of
12111206# every test touching ALSA.
1212- # Coupled with restore_machine_state on an exit signal.
1213- # param1: file name
1207+ # Coupled with restore_machine_state
1208+ # on an exit signal inside func_exit_handler.
12141209save_alsa_state ()
12151210{
1216- dlogi " save_alsa_state called with ${1} "
1217- # Prepend the restore_alsa_state to the preexisting EXIT trap.
1218- cur_exit_trap_code=$( trap -p EXIT | awk -F\' ' {print $2}' )
1219- if [[ -z " ${cur_exit_trap_code// } " ]]; then
1220- trap " restore_alsa_state ${1} " EXIT
1221- else
1222- trap " restore_alsa_state ${1} ; ${cur_exit_trap_code} " EXIT
1223- fi
1224- alsactl store --file /var/tmp/" $1 " || dlogi " alsactl state storage failed!"
1211+ dlogi " save_alsa_state called in ${SCRIPT_NAME} "
1212+ alsactl store --file /var/tmp/" ${SCRIPT_NAME} " .state || dlogi " alsactl state storage failed!"
12251213}
0 commit comments