prop224: 'is_new_tp' -> 'use_second_hdsir_index' in hs_get_responsible_hsdirs()
[tor.git] / src / test / bt_test.py
blob4cb3326042c580ce40ccf01533442ed769646f4b
1 # Copyright 2013-2017, 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 from __future__ import print_function
19 import sys
22 def matches(lines, funcs):
23 if len(lines) < len(funcs):
24 return False
25 try:
26 for l, f in zip(lines, funcs):
27 l.index(f)
28 except ValueError:
29 return False
30 else:
31 return True
33 FUNCNAMES = "crash oh_what a_tangled_web we_weave main".split()
35 LINES = sys.stdin.readlines()
37 for I in range(len(LINES)):
38 if matches(LINES[I:], FUNCNAMES):
39 print("OK")
40 sys.exit(0)
42 print("BAD")
44 for l in LINES:
45 print("{}".format(l), end="")
47 if sys.platform.startswith('freebsd'):
48 # See bug #17808 if you know how to fix this.
49 print("Test failed; but FreeBSD is known to have backtrace problems.\n"
50 "Treating as 'SKIP'.")
51 sys.exit(77)
53 sys.exit(1)