Skip to content

Commit

Permalink
Use exec instead of exit $? in tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
petterreinholdtsen committed Aug 14, 2022
1 parent 61d96fc commit 6e4c60d
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 48 deletions.
4 changes: 1 addition & 3 deletions tests/hal-link-unlink/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
$REALTIME start
python3 hallink.py

$REALTIME stop

exit $?
exec $REALTIME stop
3 changes: 1 addition & 2 deletions tests/halui/shared-test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

linuxcnc -r halui.ini
exit $?
exec linuxcnc -r halui.ini

4 changes: 1 addition & 3 deletions tests/interp/mdi-oword-m66/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash

linuxcnc -r interp.ini
exit $?

exec linuxcnc -r interp.ini
4 changes: 1 addition & 3 deletions tests/interp/oword-mdi-sub-update/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash

linuxcnc -r interp.ini
exit $?

exec linuxcnc -r interp.ini
3 changes: 1 addition & 2 deletions tests/interp/pymove/test.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions tests/interp/python-self/test.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions tests/interp/sequence-number/test.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tests/interp/subroutine-return/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions tests/interp/value-returned/test.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tests/io-startup/shared-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
rm -f tool.tbl
cp tool.tbl.original tool.tbl

linuxcnc -r test.ini
exit $?

exec linuxcnc -r test.ini
4 changes: 1 addition & 3 deletions tests/lathe/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash

linuxcnc -r lathe.ini
exit $?

exec linuxcnc -r lathe.ini
4 changes: 1 addition & 3 deletions tests/motion/jogwheel-axis/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash

linuxcnc -r motion-test.ini
exit $?

exec linuxcnc -r motion-test.ini
4 changes: 1 addition & 3 deletions tests/motion/jogwheel-joint/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/bash

linuxcnc -r motion-test.ini
exit $?

exec linuxcnc -r motion-test.ini
3 changes: 1 addition & 2 deletions tests/remap/introspect/test.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions tests/remap/oword-pycall/test.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions tests/remap/predefined-named-params/test.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions tests/remap/variable-injection/test.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions tests/tlo/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 1 addition & 3 deletions tests/toolchanger/m61/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

cp -f ../simpockets.tbl.original simpockets.tbl

linuxcnc -r m61-test.ini
exit $?

exec linuxcnc -r m61-test.ini

0 comments on commit 6e4c60d

Please sign in to comment.