shells: fix exitcode_trapN tests to avoid races
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 26 Feb 2020 08:05:52 +0000 (09:05 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 26 Feb 2020 08:05:52 +0000 (09:05 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash_test/ash-misc/exitcode_trap2.tests
shell/ash_test/ash-misc/exitcode_trap6.tests
shell/hush_test/hush-misc/exitcode_trap2.tests
shell/hush_test/hush-misc/exitcode_trap6.tests

index f259774bf94f2d27fb24857486290bb92b06d3e8..aff6d51870d1281c18a484bb7900540ca8fc975c 100755 (executable)
@@ -3,7 +3,6 @@
 $THIS_SH -c '
  trap "false;exit" term
  kill $$ &
- (exit 42)
- wait
+ (sleep 1; exit 42)
 '
 echo 42:$?
index 15fb99d2ded6c5c6421614a2675274342d31495c..59a07fc912bb4e8cad8eaad29e1f3e059d6f1dd7 100755 (executable)
@@ -5,7 +5,6 @@ $THIS_SH -c '
  trap "echo INT" int
  trap "kill -int $$;exit" term
  kill $$ &
- (exit 42)
- wait
+ (sleep 1; exit 42)
 '
 echo 42:$?
index f259774bf94f2d27fb24857486290bb92b06d3e8..aff6d51870d1281c18a484bb7900540ca8fc975c 100755 (executable)
@@ -3,7 +3,6 @@
 $THIS_SH -c '
  trap "false;exit" term
  kill $$ &
- (exit 42)
- wait
+ (sleep 1; exit 42)
 '
 echo 42:$?
index 15fb99d2ded6c5c6421614a2675274342d31495c..59a07fc912bb4e8cad8eaad29e1f3e059d6f1dd7 100755 (executable)
@@ -5,7 +5,6 @@ $THIS_SH -c '
  trap "echo INT" int
  trap "kill -int $$;exit" term
  kill $$ &
- (exit 42)
- wait
+ (sleep 1; exit 42)
 '
 echo 42:$?