Skip to content

Commit 4cd44e8

Browse files
authored
Merge pull request #3072 from smoe/tests_revision_and_maybe_fix_for_sid
fix: buggy printf in BASH in current Debian unstable breaks our tests
2 parents c6fdf4a + 8d31462 commit 4cd44e8

2 files changed

Lines changed: 34 additions & 14 deletions

File tree

tests/mdi-queue/oword-queue-buster/test.sh

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22

33
rm -f gcode-output
44

5+
if ! command -v nc ; then
6+
echo "E: Binary 'nc' not in PATH or not installed."
7+
exit 1
8+
fi
9+
10+
if ! command -v linuxcnc ; then
11+
echo "E: Binary 'linuxcnc' not in PATH or not installed."
12+
exit 1
13+
fi
14+
515
if nc -z localhost 5007; then
6-
echo "Process already listening on port 5007. Exiting"
16+
echo "E: Process already listening on port 5007. Exiting"
717
exit 1
818
fi
919

@@ -13,31 +23,31 @@ linuxcnc -r linuxcncrsh-test.ini &
1323
# let linuxcnc come up
1424
TOGO=80
1525
while [ $TOGO -gt 0 ]; do
16-
echo trying to connect to linuxcncrsh TOGO=$TOGO
26+
echo "I: trying to connect to linuxcncrsh TOGO=$TOGO"
1727
if nc -z localhost 5007; then
1828
break
1929
fi
2030
sleep 0.25
2131
TOGO=$(($TOGO - 1))
2232
done
2333
if [ $TOGO -eq 0 ]; then
24-
echo connection to linuxcncrsh timed out
34+
echo "E: connection to linuxcncrsh timed out"
2535
exit 1
2636
fi
2737

2838
# switch back and forth between tool 1 and tool 2 every few MDI calls
2939
rm -f expected-gcode-output lots-of-gcode
30-
printf "P is %.6f\n" -100 >> expected-gcode-output
40+
echo "P is -100.000000" >> expected-gcode-output
3141
NUM_MDIS=1
3242
NUM_MDIS_LEFT=$NUM_MDIS
3343
TOOL=1
3444
for i in $(seq 0 1000); do
3545
NUM_MDIS_LEFT=$(($NUM_MDIS_LEFT - 1))
3646
if [ $NUM_MDIS_LEFT -eq 0 ]; then
3747
echo "set mdi o<queue-buster> call [$TOOL]" >> lots-of-gcode
38-
printf "P is 12345.000000\n" >> expected-gcode-output
39-
printf "P is %.6f\n" $((-1 * $TOOL)) >> expected-gcode-output
40-
printf "P is 54321.000000\n" >> expected-gcode-output
48+
echo "P is 12345.000000" >> expected-gcode-output
49+
echo "P is $((-1 * $TOOL)).000000" >> expected-gcode-output
50+
echo "P is 54321.000000" >> expected-gcode-output
4151

4252
if [ $TOOL -eq 1 ]; then
4353
TOOL=2
@@ -53,9 +63,9 @@ for i in $(seq 0 1000); do
5363
NUM_MDIS_LEFT=$NUM_MDIS
5464
fi
5565
echo "set mdi m100 p$i" >> lots-of-gcode
56-
printf "P is %.6f\n" $i >> expected-gcode-output
66+
echo "P is $i.000000" >> expected-gcode-output
5767
done
58-
printf "P is %.6f\n" -200 >> expected-gcode-output
68+
echo "P is -200.000000" >> expected-gcode-output
5969

6070
(
6171
echo hello EMC mt 1.0

tests/mdi-queue/simple-queue-buster/test.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22

33
rm -f gcode-output
44

5+
if ! command -v nc ; then
6+
echo "E: Binary 'nc' not in PATH or not installed."
7+
exit 1
8+
fi
9+
10+
if ! command -v linuxcnc ; then
11+
echo "E: Binary 'linuxcnc' not in PATH or not installed."
12+
exit 1
13+
fi
14+
515
if nc -z localhost 5007; then
6-
echo "Process already listening on port 5007. Exiting"
16+
echo "E: Process already listening on port 5007. Exiting"
717
exit 1
818
fi
919

@@ -13,7 +23,7 @@ linuxcnc -r linuxcncrsh-test.ini &
1323
# let linuxcnc come up
1424
TOGO=80
1525
while [ $TOGO -gt 0 ]; do
16-
echo trying to connect to linuxcncrsh TOGO=$TOGO
26+
echo "I: trying to connect to linuxcncrsh TOGO=$TOGO"
1727
if nc -z localhost 5007; then
1828
break
1929
fi
@@ -27,7 +37,7 @@ fi
2737

2838
# switch back and forth between tool 1 and tool 2 every few MDI calls
2939
rm -f expected-gcode-output lots-of-gcode
30-
printf "P is %.6f\n" -1 >> expected-gcode-output
40+
echo "P is -1.000000" >> expected-gcode-output
3141
NUM_MDIS=1
3242
NUM_MDIS_LEFT=$NUM_MDIS
3343
TOOL=1
@@ -49,9 +59,9 @@ for i in $(seq 0 1000); do
4959
NUM_MDIS_LEFT=$NUM_MDIS
5060
fi
5161
echo "set mdi m100 p$i" >> lots-of-gcode
52-
printf "P is %.6f\n" $i >> expected-gcode-output
62+
echo "P is $i.000000" >> expected-gcode-output
5363
done
54-
printf "P is %.6f\n" -2 >> expected-gcode-output
64+
echo "P is -2.000000" >> expected-gcode-output
5565

5666
(
5767
echo hello EMC mt 1.0

0 commit comments

Comments
 (0)