2015-01-02 20:27:39 +01:00
|
|
|
# Copyright 2013-2015, The Tor Project, Inc
|
2013-07-30 03:56:31 +02:00
|
|
|
# See LICENSE for licensing information
|
|
|
|
|
|
|
|
"""
|
|
|
|
bt_test.py
|
|
|
|
|
|
|
|
This file tests the output from test-bt-cl to make sure it's as expected.
|
|
|
|
|
|
|
|
Example usage:
|
|
|
|
|
|
|
|
$ ./src/test/test-bt-cl crash | ./src/test/bt_test.py
|
|
|
|
OK
|
|
|
|
$ ./src/test/test-bt-cl assert | ./src/test/bt_test.py
|
|
|
|
OK
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2015-12-17 17:31:41 +01:00
|
|
|
from __future__ import print_function
|
2013-07-30 03:56:31 +02:00
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
def matches(lines, funcs):
|
|
|
|
if len(lines) < len(funcs):
|
|
|
|
return False
|
|
|
|
try:
|
|
|
|
for l, f in zip(lines, funcs):
|
|
|
|
l.index(f)
|
|
|
|
except ValueError:
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
return True
|
|
|
|
|
|
|
|
FUNCNAMES = "crash oh_what a_tangled_web we_weave main".split()
|
|
|
|
|
|
|
|
LINES = sys.stdin.readlines()
|
|
|
|
|
|
|
|
for I in range(len(LINES)):
|
|
|
|
if matches(LINES[I:], FUNCNAMES):
|
2014-04-28 04:54:24 +02:00
|
|
|
print("OK")
|
2015-03-05 11:05:17 +01:00
|
|
|
sys.exit(0)
|
2015-12-17 17:31:41 +01:00
|
|
|
|
|
|
|
for l in LINES:
|
|
|
|
print("{}".format(l), end="")
|
|
|
|
|
|
|
|
sys.exit(1)
|