-
Notifications
You must be signed in to change notification settings - Fork 0
/
regression_test.py
51 lines (44 loc) · 1.29 KB
/
regression_test.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import re
import os.path
import sys
import time
from subprocess import Popen
if len(sys.argv) < 2:
print "usage: %s <board file>" % os.path.basename(sys.argv[0])
sys.exit(0)
test_boards = open(sys.argv[1], "rU")
board_num = 0
while True:
next_line = test_boards.readline()
while re.match("[0-9]+[wb]", next_line) == None:
next_line = test_boards.readline()
if next_line == "":
break
if next_line == "":
break
board_name = next_line
while True:
try:
check_file = open("regression_board", "w")
break
except IOError:
print "Could not open regression_board"
time.sleep(1)
for i in range(12):
check_file.write(next_line)
next_line = test_boards.readline()
check_file.close()
board_num += 1
print "Checking movement on #%d, %s" % (board_num, board_name)
movement = Popen(["movement", "regression_board"])
if movement.wait():
print "Movement error found"
sys.exit(0)
print
print "Checking #%d, %s" % (board_num, board_name)
parseboard = Popen(["parseboard", "regression_board"])
if parseboard.wait():
print "Error found"
sys.exit(0)
print
print "Finished checking %d boards without an error." % board_num