Prop210: Refactor connection_get_* to produce lists and counts
[tor.git] / src / test / bt_test.py
blobe694361703eb594516d0b65e3355d096d710ad4e
1 # Copyright 2013-2015, The Tor Project, Inc
2 # See LICENSE for licensing information
4 """
5 bt_test.py
7 This file tests the output from test-bt-cl to make sure it's as expected.
9 Example usage:
11 $ ./src/test/test-bt-cl crash | ./src/test/bt_test.py
13 $ ./src/test/test-bt-cl assert | ./src/test/bt_test.py
16 """
18 import sys
21 def matches(lines, funcs):
22 if len(lines) < len(funcs):
23 return False
24 try:
25 for l, f in zip(lines, funcs):
26 l.index(f)
27 except ValueError:
28 return False
29 else:
30 return True
32 FUNCNAMES = "crash oh_what a_tangled_web we_weave main".split()
34 LINES = sys.stdin.readlines()
36 for I in range(len(LINES)):
37 if matches(LINES[I:], FUNCNAMES):
38 print("OK")
39 sys.exit(0)
40 else:
41 print("BAD")
42 sys.exit(1)