blob: 5674a04407d33093913fb9c3f19a5f7c54d8d5f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/python
import glob, os, sys
fail = 0
for t in sorted(glob.glob('*.ngc')):
print >>sys.stderr, "#", t
error = open(t).readline()
if error.startswith(';'): expected = error[1:-1]
elif error.startswith('('): expected = error[1:-2]
else: expected = "%s: Test does not specify expected error" % t
p = os.popen("rs274 -g %s 2>&1 > /dev/null" % t)
output = p.readlines()
r = p.close()
print "# ->", r
if not r:
print "%s: Interpreter accepted bad gcode" % t
fail += 1
continue
if len(output) < 2:
print "%s: Unexpected interpreter output: %r" % output
fail += 1
continue
err = output[-2].strip()
if err != expected:
print "%s: Expected %r, got %r instead" % (t, expected, err)
fail += 1
if fail:
raise SystemExit, "%d failures" % fail
|