From 6e4c60dd134563d952c48d9fd51ca3d984e7ec5a Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sun, 14 Aug 2022 09:42:21 +0200 Subject: [PATCH] Use exec instead of exit $? in tests Before this change, the shell process will linger around to extract the exit value, only to return it to the parent process, and after this change the task is left to the kernel and one less process is used during testing. This is a very small optimisation of the tests to gut down the number of lines and reduce the resources spend during testing. --- tests/hal-link-unlink/test.sh | 4 +--- tests/halui/shared-test.sh | 3 +-- tests/interp/mdi-oword-m66/test.sh | 4 +--- tests/interp/oword-mdi-sub-update/test.sh | 4 +--- tests/interp/pymove/test.sh | 3 +-- tests/interp/python-self/test.sh | 3 +-- tests/interp/sequence-number/test.sh | 3 +-- tests/interp/subroutine-return/test.sh | 4 +--- tests/interp/value-returned/test.sh | 3 +-- tests/io-startup/shared-test.sh | 4 +--- tests/lathe/test.sh | 4 +--- tests/motion/jogwheel-axis/test.sh | 4 +--- tests/motion/jogwheel-joint/test.sh | 4 +--- tests/remap/introspect/test.sh | 3 +-- tests/remap/oword-pycall/test.sh | 3 +-- tests/remap/predefined-named-params/test.sh | 3 +-- tests/remap/variable-injection/test.sh | 3 +-- tests/tlo/test.sh | 4 +--- tests/toolchanger/m61/test.sh | 4 +--- 19 files changed, 19 insertions(+), 48 deletions(-) diff --git a/tests/hal-link-unlink/test.sh b/tests/hal-link-unlink/test.sh index af50ee85fdb..b5d62877296 100755 --- a/tests/hal-link-unlink/test.sh +++ b/tests/hal-link-unlink/test.sh @@ -3,6 +3,4 @@ $REALTIME start python3 hallink.py -$REALTIME stop - -exit $? +exec $REALTIME stop diff --git a/tests/halui/shared-test.sh b/tests/halui/shared-test.sh index 3844190286b..2d0bb0375f1 100755 --- a/tests/halui/shared-test.sh +++ b/tests/halui/shared-test.sh @@ -1,5 +1,4 @@ #!/bin/bash -linuxcnc -r halui.ini -exit $? +exec linuxcnc -r halui.ini diff --git a/tests/interp/mdi-oword-m66/test.sh b/tests/interp/mdi-oword-m66/test.sh index 20aab841a0e..49672c3d6d9 100755 --- a/tests/interp/mdi-oword-m66/test.sh +++ b/tests/interp/mdi-oword-m66/test.sh @@ -1,5 +1,3 @@ #!/bin/bash -linuxcnc -r interp.ini -exit $? - +exec linuxcnc -r interp.ini diff --git a/tests/interp/oword-mdi-sub-update/test.sh b/tests/interp/oword-mdi-sub-update/test.sh index 20aab841a0e..49672c3d6d9 100755 --- a/tests/interp/oword-mdi-sub-update/test.sh +++ b/tests/interp/oword-mdi-sub-update/test.sh @@ -1,5 +1,3 @@ #!/bin/bash -linuxcnc -r interp.ini -exit $? - +exec linuxcnc -r interp.ini diff --git a/tests/interp/pymove/test.sh b/tests/interp/pymove/test.sh index cc74b3d9342..5dbf4b71382 100755 --- a/tests/interp/pymove/test.sh +++ b/tests/interp/pymove/test.sh @@ -1,3 +1,2 @@ #!/bin/bash -rs274 -i test.ini -n 0 -g test.ngc 2>&1 -exit $? +exec rs274 -i test.ini -n 0 -g test.ngc 2>&1 diff --git a/tests/interp/python-self/test.sh b/tests/interp/python-self/test.sh index b505c39369a..f04a539256e 100755 --- a/tests/interp/python-self/test.sh +++ b/tests/interp/python-self/test.sh @@ -1,4 +1,3 @@ #!/bin/bash export PYTHONUNBUFFERED=1 -rs274 -i test.ini -n 0 -g test.ngc 2>&1 -exit $? +exec rs274 -i test.ini -n 0 -g test.ngc 2>&1 diff --git a/tests/interp/sequence-number/test.sh b/tests/interp/sequence-number/test.sh index 582d72946e1..6b3fe6ddaba 100644 --- a/tests/interp/sequence-number/test.sh +++ b/tests/interp/sequence-number/test.sh @@ -1,3 +1,2 @@ #!/bin/bash -rs274 -n 0 -i test.ini -g test.ngc -exit $? +exec rs274 -n 0 -i test.ini -g test.ngc diff --git a/tests/interp/subroutine-return/test.sh b/tests/interp/subroutine-return/test.sh index bc868235b87..cf334c1b274 100755 --- a/tests/interp/subroutine-return/test.sh +++ b/tests/interp/subroutine-return/test.sh @@ -3,6 +3,4 @@ cp -f orig.ngc test.ngc cp -f subs/orig-sub.ngc subs/sub.ngc -linuxcnc -r interp.ini -exit $? - +exec linuxcnc -r interp.ini diff --git a/tests/interp/value-returned/test.sh b/tests/interp/value-returned/test.sh index cc74b3d9342..5dbf4b71382 100755 --- a/tests/interp/value-returned/test.sh +++ b/tests/interp/value-returned/test.sh @@ -1,3 +1,2 @@ #!/bin/bash -rs274 -i test.ini -n 0 -g test.ngc 2>&1 -exit $? +exec rs274 -i test.ini -n 0 -g test.ngc 2>&1 diff --git a/tests/io-startup/shared-test.sh b/tests/io-startup/shared-test.sh index b568c513acb..c378d3eaf80 100755 --- a/tests/io-startup/shared-test.sh +++ b/tests/io-startup/shared-test.sh @@ -3,6 +3,4 @@ rm -f tool.tbl cp tool.tbl.original tool.tbl -linuxcnc -r test.ini -exit $? - +exec linuxcnc -r test.ini diff --git a/tests/lathe/test.sh b/tests/lathe/test.sh index 2b16fbde826..12ba0cd03dc 100755 --- a/tests/lathe/test.sh +++ b/tests/lathe/test.sh @@ -1,5 +1,3 @@ #!/bin/bash -linuxcnc -r lathe.ini -exit $? - +exec linuxcnc -r lathe.ini diff --git a/tests/motion/jogwheel-axis/test.sh b/tests/motion/jogwheel-axis/test.sh index 6e50c15a793..798f0dee7b7 100755 --- a/tests/motion/jogwheel-axis/test.sh +++ b/tests/motion/jogwheel-axis/test.sh @@ -1,5 +1,3 @@ #!/bin/bash -linuxcnc -r motion-test.ini -exit $? - +exec linuxcnc -r motion-test.ini diff --git a/tests/motion/jogwheel-joint/test.sh b/tests/motion/jogwheel-joint/test.sh index 6e50c15a793..798f0dee7b7 100755 --- a/tests/motion/jogwheel-joint/test.sh +++ b/tests/motion/jogwheel-joint/test.sh @@ -1,5 +1,3 @@ #!/bin/bash -linuxcnc -r motion-test.ini -exit $? - +exec linuxcnc -r motion-test.ini diff --git a/tests/remap/introspect/test.sh b/tests/remap/introspect/test.sh index 7b265f2d78e..02c534ca16d 100755 --- a/tests/remap/introspect/test.sh +++ b/tests/remap/introspect/test.sh @@ -1,4 +1,3 @@ #!/bin/bash export PYTHONUNBUFFERED=1 -rs274 -i test.ini -n 0 -g test.ngc 2>&1 -exit $? +exec rs274 -i test.ini -n 0 -g test.ngc 2>&1 diff --git a/tests/remap/oword-pycall/test.sh b/tests/remap/oword-pycall/test.sh index feeeb455cfd..4215493da4f 100755 --- a/tests/remap/oword-pycall/test.sh +++ b/tests/remap/oword-pycall/test.sh @@ -1,4 +1,3 @@ #!/bin/bash export PYTHONUNBUFFERED=1 -rs274 -t test.tbl -i test.ini -n 0 -g test.ngc 2>&1 -exit $? +exec rs274 -t test.tbl -i test.ini -n 0 -g test.ngc 2>&1 diff --git a/tests/remap/predefined-named-params/test.sh b/tests/remap/predefined-named-params/test.sh index 7b265f2d78e..02c534ca16d 100755 --- a/tests/remap/predefined-named-params/test.sh +++ b/tests/remap/predefined-named-params/test.sh @@ -1,4 +1,3 @@ #!/bin/bash export PYTHONUNBUFFERED=1 -rs274 -i test.ini -n 0 -g test.ngc 2>&1 -exit $? +exec rs274 -i test.ini -n 0 -g test.ngc 2>&1 diff --git a/tests/remap/variable-injection/test.sh b/tests/remap/variable-injection/test.sh index 013a557bc49..1b7c5d406d8 100755 --- a/tests/remap/variable-injection/test.sh +++ b/tests/remap/variable-injection/test.sh @@ -1,3 +1,2 @@ #!/bin/bash -rs274 -i test.ini -g test.ngc 2>&1 -exit $? +exec rs274 -i test.ini -g test.ngc 2>&1 diff --git a/tests/tlo/test.sh b/tests/tlo/test.sh index f7226ce3880..50d7a466a35 100755 --- a/tests/tlo/test.sh +++ b/tests/tlo/test.sh @@ -3,6 +3,4 @@ cp -f simpockets.tbl.original simpockets.tbl rm -f sim.var -linuxcnc -r g43-test.ini -exit $? - +exec linuxcnc -r g43-test.ini diff --git a/tests/toolchanger/m61/test.sh b/tests/toolchanger/m61/test.sh index 2c0f4b1afd4..5d77bedec55 100755 --- a/tests/toolchanger/m61/test.sh +++ b/tests/toolchanger/m61/test.sh @@ -2,6 +2,4 @@ cp -f ../simpockets.tbl.original simpockets.tbl -linuxcnc -r m61-test.ini -exit $? - +exec linuxcnc -r m61-test.ini