Skip to content

Commit e117572

Browse files
authored
Merge pull request #1840 from petterreinholdtsen/test-g0-correct-progname
Get tests/motion/g0/test.sh working again
2 parents cc00ed6 + 0384f49 commit e117572

File tree

5 files changed

+17
-16
lines changed

5 files changed

+17
-16
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,5 @@ jobs:
8787
eatmydata debian/configure
8888
eatmydata debuild -us -uc
8989
sudo apt-get install ../*.deb
90-
eatmydata ./scripts/runtests -p tests/
90+
./scripts/runtests -p tests/
9191
eatmydata lintian --info --display-info --pedantic --display-experimental ../*.deb

scripts/runtests.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ run_tests () {
141141
fi
142142
fi
143143
NUM=$(($NUM+1))
144+
export TEST_DIR=$(readlink -f $testdir)
144145
echo "Running test: $testdir" 1>&2
145146
if test -n "$SYSTEM_BUILD"; then
146147
# Tell `halcompile` where to install comps

tests/motion/g0/checkresult

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ servo_period_ns = float(Popen(
1818
"-sec",
1919
"EMCMOT",
2020
"-ini",
21-
"%s/tests/motion/g0/motion-test.ini" % os.getenv("EMC2_HOME")
21+
"%s/motion-test.ini" % os.getenv("TEST_DIR")
2222
],
2323
stdout=PIPE
2424
).communicate()[0])
@@ -32,9 +32,9 @@ max_acceleration_ips2 = float(Popen(
3232
"-var",
3333
"MAX_ACCELERATION",
3434
"-sec",
35-
"AXIS_0",
35+
"AXIS_X",
3636
"-ini",
37-
"%s/tests/motion/g0/motion-test.ini" % os.getenv("EMC2_HOME")
37+
"%s/motion-test.ini" % os.getenv("TEST_DIR")
3838
],
3939
stdout=PIPE
4040
).communicate()[0])
@@ -50,9 +50,9 @@ max_velocity_ips = float(Popen(
5050
"-var",
5151
"MAX_VELOCITY",
5252
"-sec",
53-
"AXIS_0",
53+
"AXIS_X",
5454
"-ini",
55-
"%s/tests/motion/g0/motion-test.ini" % os.getenv("EMC2_HOME")
55+
"%s/motion-test.ini" % os.getenv("TEST_DIR")
5656
],
5757
stdout=PIPE
5858
).communicate()[0])
@@ -63,7 +63,9 @@ max_velocity_ipc = max_velocity_ips / cycles_per_second
6363
# read the samples file and turn it into an array, where index i is an
6464
# array of the floats found on line i of the samples file
6565
samples_filename = sys.argv[1] + ".halsamples"
66-
lines = file(samples_filename).readlines()
66+
with open(samples_filename) as f:
67+
lines = f.readlines()
68+
6769
samples = []
6870
for line in lines:
6971
s = [ float(x) for x in line.split() ]
@@ -105,7 +107,7 @@ for i in range(i, len(samples)):
105107

106108
highest_seen_accel_ipc2 = max(accel_ipc2, highest_seen_accel_ipc2)
107109

108-
#print "line %d: X=%.6f, v=%.6f i/c (%.6f i/s), a=%.6f i/c^2 (%.6f i/s^2)" % (i, samples[i][1], new_v_ipc, (new_v_ipc * cycles_per_second), accel_ipc2, (accel_ipc2 * cycles_per_second * cycles_per_second))
110+
#print("line %d: X=%.6f, v=%.6f i/c (%.6f i/s), a=%.6f i/c^2 (%.6f i/s^2)" % (i, samples[i][1], new_v_ipc, (new_v_ipc * cycles_per_second), accel_ipc2, (accel_ipc2 * cycles_per_second * cycles_per_second)))
109111

110112
# i hate floating point
111113
if ((accel_ipc2 * cycles_per_second) - max_acceleration_ipspc) > 0.0000001:
@@ -163,7 +165,7 @@ for i in range(i, len(samples)):
163165

164166
highest_seen_accel_ipc2 = min(accel_ipc2, highest_seen_accel_ipc2)
165167

166-
#print "line %d: X=%.6f, v=%.6f i/c (%.6f i/s), a=%.6f i/c^2 (%.6f i/s^2)" % (i, samples[i][1], new_v_ipc, (new_v_ipc * cycles_per_second), accel_ipc2, (accel_ipc2 * cycles_per_second * cycles_per_second))
168+
#print("line %d: X=%.6f, v=%.6f i/c (%.6f i/s), a=%.6f i/c^2 (%.6f i/s^2)" % (i, samples[i][1], new_v_ipc, (new_v_ipc * cycles_per_second), accel_ipc2, (accel_ipc2 * cycles_per_second * cycles_per_second)))
167169

168170
# i hate floating point
169171
if ((accel_ipc2 * cycles_per_second) - max_acceleration_ipspc) > 0.0000001:

tests/motion/g0/skip

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/motion/g0/test.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#export PATH=$PATH:$EMC2_HOME/tests/helpers
44
#source $EMC2_HOME/tests/helpers/test-functions.sh
55

6-
emc motion-test.ini &
6+
linuxcnc motion-test.ini &
77

8-
# let emc come up
8+
# let linuxcnc come up
99
sleep 4
1010

1111
(
@@ -26,20 +26,20 @@ sleep 4
2626
echo set home 1
2727
echo set home 2
2828

29-
# give emc a second to home
29+
# give linuxcnc a second to home
3030
sleep 1.0
3131

3232
echo set mode mdi
3333
echo set mdi g0x1
3434

35-
# give emc a half second to move
35+
# give linuxcnc a half second to move
3636
sleep 0.5
3737

3838
echo shutdown
3939
) | nc localhost 5007
4040

4141

42-
# wait for emc to finish
42+
# wait for linuxcnc to finish
4343
wait
4444

4545
exit 0

0 commit comments

Comments
 (0)