Skip to content

Commit 6e4c60d

Browse files
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.
1 parent 61d96fc commit 6e4c60d

File tree

19 files changed

+19
-48
lines changed

19 files changed

+19
-48
lines changed

tests/hal-link-unlink/test.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33
$REALTIME start
44
python3 hallink.py
55

6-
$REALTIME stop
7-
8-
exit $?
6+
exec $REALTIME stop

tests/halui/shared-test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
22

3-
linuxcnc -r halui.ini
4-
exit $?
3+
exec linuxcnc -r halui.ini
54

tests/interp/mdi-oword-m66/test.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#!/bin/bash
22

3-
linuxcnc -r interp.ini
4-
exit $?
5-
3+
exec linuxcnc -r interp.ini
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#!/bin/bash
22

3-
linuxcnc -r interp.ini
4-
exit $?
5-
3+
exec linuxcnc -r interp.ini

tests/interp/pymove/test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#!/bin/bash
2-
rs274 -i test.ini -n 0 -g test.ngc 2>&1
3-
exit $?
2+
exec rs274 -i test.ini -n 0 -g test.ngc 2>&1

tests/interp/python-self/test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#!/bin/bash
22
export PYTHONUNBUFFERED=1
3-
rs274 -i test.ini -n 0 -g test.ngc 2>&1
4-
exit $?
3+
exec rs274 -i test.ini -n 0 -g test.ngc 2>&1
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#!/bin/bash
2-
rs274 -n 0 -i test.ini -g test.ngc
3-
exit $?
2+
exec rs274 -n 0 -i test.ini -g test.ngc

tests/interp/subroutine-return/test.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33
cp -f orig.ngc test.ngc
44
cp -f subs/orig-sub.ngc subs/sub.ngc
55

6-
linuxcnc -r interp.ini
7-
exit $?
8-
6+
exec linuxcnc -r interp.ini
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
#!/bin/bash
2-
rs274 -i test.ini -n 0 -g test.ngc 2>&1
3-
exit $?
2+
exec rs274 -i test.ini -n 0 -g test.ngc 2>&1

tests/io-startup/shared-test.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33
rm -f tool.tbl
44
cp tool.tbl.original tool.tbl
55

6-
linuxcnc -r test.ini
7-
exit $?
8-
6+
exec linuxcnc -r test.ini

0 commit comments

Comments
 (0)