[LTP] [RFC PATCH v2 1/3] tst_test.sh: Add default trap to INT

Petr Vorel pvorel@suse.cz
Thu Feb 15 21:47:12 CET 2018


This can be overwritten in tests.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Cc: Cyril Hrubis <chrubis@suse.cz>
Cc: Alexey Kodanev <alexey.kodanev@oracle.com>
---
We've been talking about it:
http://lists.linux.it/pipermail/ltp/2017-December/006660.html
http://lists.linux.it/pipermail/ltp/2017-December/006663.html
But I guess this should be ok for all tests.
---
 testcases/lib/tst_test.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index d6b638549..56ec9d126 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) Linux Test Project, 2014-2017
+# Copyright (c) Linux Test Project, 2014-2018
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -32,6 +32,9 @@ export TST_TMPDIR_RHOST=0
 
 . tst_ansi_color.sh
 
+# default trap function
+trap "tst_brk TBROK 'test interrupted'" INT
+
 tst_do_exit()
 {
 	local ret=0
-- 
2.16.1



More information about the ltp mailing list