Use 'trap' builtin to clean up temporaries in test scripts
Some of the test scripts create temporary files, which we remove at the end. Except that we usually forgot to remove them on some exit paths. To avoid this problem in future, this modifies the scripts to use the shell's trap 0 functionality to automatically remove the temporaries on any exit. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
committed by
Jon Loeliger
parent
9a50d82c4e
commit
2ca83614e7
@@ -10,9 +10,9 @@ for x; do
|
||||
CHECKS="$CHECKS $x"
|
||||
done
|
||||
|
||||
LOG="tmp.log.$$"
|
||||
|
||||
LOG=tmp.log.$$
|
||||
rm -f $LOG
|
||||
trap "rm -f $LOG" 0
|
||||
|
||||
verbose_run_log "$LOG" $VALGRIND "$DTC" -o /dev/null "$@"
|
||||
ret="$?"
|
||||
@@ -28,6 +28,4 @@ for c in $CHECKS; do
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f $LOG
|
||||
|
||||
PASS
|
||||
|
||||
Reference in New Issue
Block a user