14 """Runs stage with the given filename and validates the output.""" 20 file = os.popen(
'../../src/stage %s' % filename,
'r') 24 print '%s : errors ' % filename,
26 print ': \033[41mfail\033[0m' 32 print '%s : sections' % filename,
34 print ': \033[41mfail\033[0m' 39 print '%s : items ' % filename,
41 print ': \033[41mfail\033[0m' 50 """Read and return the various lists from a file object.""" 59 line = file.readline()
62 bits = string.split(line)
66 if bits[1] ==
'begin':
67 if bits[2] ==
'sections':
69 elif bits[2] ==
'items':
71 elif bits[1] ==
'end':
73 elif bits[1] ==
'stage' and bits[2] ==
'error':
74 errors.append(string.join(bits[4:]))
76 list.append(string.join(bits[1:]))
77 elif bits[0] ==
'stage' and bits[1] ==
'error':
78 errors.append(string.join(bits[3:]))
80 return (sections, items, errors)
84 """Compare two lists.""" 86 if len(la) != len(lb):
88 for i
in range(0, len(la)):
97 """Print two lists.""" 99 for i
in range(0, max(len(la), len(lb))):
112 print '\033[42m' + sa +
'\33[K\033[0m' 113 print '\033[41m' + sb +
'\33[K\033[0m' 122 for test
in argv[1:]:
130 if __name__ ==
'__main__':
def compare_lists(la, lb)