lib/test.sh: Remove temporary directory only if we know the location
This is a problem when a test TCONF before calling tst_tmpdir, but has
tst_rmdir in cleanup function (e.g. dhcp_lib.sh when failing on
tst_check_cmds).
Now it has the same behaviour as deleting $TST_TMPDIR in tst_do_exit
in tst_test.sh.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 642f7ea..d16444e 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -132,8 +132,10 @@
tst_rmdir()
{
- cd "$LTPROOT"
- rm -r "$TST_TMPDIR"
+ if [ -n "$TST_TMPDIR" ]; then
+ cd "$LTPROOT"
+ rm -r "$TST_TMPDIR"
+ fi
}
#