Loading src/test/include.am +14 −3 Original line number Diff line number Diff line Loading @@ -74,11 +74,22 @@ src_test_test_ntor_cl_LDADD = src/or/libtor.a src/common/libor.a \ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ src_test_test_ntor_cl_AM_CPPFLAGS = \ -I"$(top_srcdir)/src/or" NTOR_TEST_DEPS=src/test/test-ntor-cl else NTOR_TEST_DEPS= endif if COVERAGE_ENABLED CMDLINE_TEST_TOR = ./src/or/tor-cov else CMDLINE_TEST_TOR = ./src/or/tor endif check-local: check-local: $(NTOR_TEST_DEPS) $(CMDLINE_TEST_TOR) if USEPYTHON $(PYTHON) src/test/test_cmdline_args.py $(PYTHON) src/test/test_cmdline_args.py $(CMDLINE_TEST_TOR) "${top_srcdir}" if CURVE25519_ENABLED $(PYTHON) src/test/ntor_ref.py test-tor $(PYTHON) src/test/ntor_ref.py self-test endif endif src/test/ntor_ref.py 100644 → 100755 +13 −3 Original line number Diff line number Diff line #!/usr/bin/python # Copyright 2012-2013, The Tor Project, Inc # See LICENSE for licensing information Loading Loading @@ -27,7 +28,13 @@ commands: """ import binascii try: import curve25519 except ImportError: curve25519 = None print "SKIPPING: No Python curve25519 module installed" import sys sys.exit(0) import hashlib import hmac import subprocess Loading Loading @@ -286,6 +293,7 @@ def demo(node_id="iToldYouAboutStairs.", server_key=PrivateKey()): assert len(skeys) == 72 assert len(ckeys) == 72 assert skeys == ckeys print "OK" # ====================================================================== def timing(): Loading Loading @@ -368,13 +376,15 @@ def test_tor(): assert c_keys == s_keys assert len(c_keys) == 90 print "We just interoperated." print "OK" # ====================================================================== if __name__ == '__main__': import sys if sys.argv[1] == 'gen_kdf_vectors': if len(sys.argv) < 2: print __doc__ elif sys.argv[1] == 'gen_kdf_vectors': kdf_vectors() elif sys.argv[1] == 'timing': timing() Loading src/test/test_cmdline_args.py +12 −3 Original line number Diff line number Diff line Loading @@ -6,11 +6,20 @@ import os import re import shutil import subprocess import sys import tempfile import unittest TOR = "./src/or/tor-cov" TOPDIR = "." TOR = "./src/or/tor" TOP_SRCDIR = "." if len(sys.argv) > 1: TOR = sys.argv[1] del sys.argv[1] if len(sys.argv) > 1: TOP_SRCDIR = sys.argv[1] del sys.argv[1] class UnexpectedSuccess(Exception): pass Loading Loading @@ -110,7 +119,7 @@ class CmdlineTests(unittest.TestCase): self.assertEquals(hashlib.sha1(inp).digest(), hashed) def test_digests(self): main_c = os.path.join(TOPDIR, "src", "or", "main.c") main_c = os.path.join(TOP_SRCDIR, "src", "or", "main.c") if os.stat(TOR).st_mtime < os.stat(main_c).st_mtime: self.skipTest(TOR+" not up to date") Loading Loading
src/test/include.am +14 −3 Original line number Diff line number Diff line Loading @@ -74,11 +74,22 @@ src_test_test_ntor_cl_LDADD = src/or/libtor.a src/common/libor.a \ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ src_test_test_ntor_cl_AM_CPPFLAGS = \ -I"$(top_srcdir)/src/or" NTOR_TEST_DEPS=src/test/test-ntor-cl else NTOR_TEST_DEPS= endif if COVERAGE_ENABLED CMDLINE_TEST_TOR = ./src/or/tor-cov else CMDLINE_TEST_TOR = ./src/or/tor endif check-local: check-local: $(NTOR_TEST_DEPS) $(CMDLINE_TEST_TOR) if USEPYTHON $(PYTHON) src/test/test_cmdline_args.py $(PYTHON) src/test/test_cmdline_args.py $(CMDLINE_TEST_TOR) "${top_srcdir}" if CURVE25519_ENABLED $(PYTHON) src/test/ntor_ref.py test-tor $(PYTHON) src/test/ntor_ref.py self-test endif endif
src/test/ntor_ref.py 100644 → 100755 +13 −3 Original line number Diff line number Diff line #!/usr/bin/python # Copyright 2012-2013, The Tor Project, Inc # See LICENSE for licensing information Loading Loading @@ -27,7 +28,13 @@ commands: """ import binascii try: import curve25519 except ImportError: curve25519 = None print "SKIPPING: No Python curve25519 module installed" import sys sys.exit(0) import hashlib import hmac import subprocess Loading Loading @@ -286,6 +293,7 @@ def demo(node_id="iToldYouAboutStairs.", server_key=PrivateKey()): assert len(skeys) == 72 assert len(ckeys) == 72 assert skeys == ckeys print "OK" # ====================================================================== def timing(): Loading Loading @@ -368,13 +376,15 @@ def test_tor(): assert c_keys == s_keys assert len(c_keys) == 90 print "We just interoperated." print "OK" # ====================================================================== if __name__ == '__main__': import sys if sys.argv[1] == 'gen_kdf_vectors': if len(sys.argv) < 2: print __doc__ elif sys.argv[1] == 'gen_kdf_vectors': kdf_vectors() elif sys.argv[1] == 'timing': timing() Loading
src/test/test_cmdline_args.py +12 −3 Original line number Diff line number Diff line Loading @@ -6,11 +6,20 @@ import os import re import shutil import subprocess import sys import tempfile import unittest TOR = "./src/or/tor-cov" TOPDIR = "." TOR = "./src/or/tor" TOP_SRCDIR = "." if len(sys.argv) > 1: TOR = sys.argv[1] del sys.argv[1] if len(sys.argv) > 1: TOP_SRCDIR = sys.argv[1] del sys.argv[1] class UnexpectedSuccess(Exception): pass Loading Loading @@ -110,7 +119,7 @@ class CmdlineTests(unittest.TestCase): self.assertEquals(hashlib.sha1(inp).digest(), hashed) def test_digests(self): main_c = os.path.join(TOPDIR, "src", "or", "main.c") main_c = os.path.join(TOP_SRCDIR, "src", "or", "main.c") if os.stat(TOR).st_mtime < os.stat(main_c).st_mtime: self.skipTest(TOR+" not up to date") Loading