diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-07-29 21:56:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-11-18 10:43:15 -0500 |
commit | 56e3f056e9a03015aa55392a8028e2cbe097a0fb (patch) | |
tree | 041021d07c4da05f947d64aed5b3a4a74243918d /src/test/bt_test.py | |
parent | 0cf234317f4dd6395490f24f12a7d35a480ddf11 (diff) | |
download | tor-56e3f056e9a03015aa55392a8028e2cbe097a0fb.tar.gz tor-56e3f056e9a03015aa55392a8028e2cbe097a0fb.zip |
Tests for backtrace.c
These need to be a separate executable, since the point of backtrace.c
is that it can crash and write stuff.
Diffstat (limited to 'src/test/bt_test.py')
-rwxr-xr-x | src/test/bt_test.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test/bt_test.py b/src/test/bt_test.py new file mode 100755 index 0000000000..2de9924a59 --- /dev/null +++ b/src/test/bt_test.py @@ -0,0 +1,42 @@ +# Copyright 2013, The Tor Project, Inc +# 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 + +""" + +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): + print "OK" + break +else: + print "BAD" + |