mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
When possible, run the ntor python integration tests too
This commit is contained in:
parent
187398318e
commit
f308adf838
@ -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
|
||||
|
||||
check-local:
|
||||
if COVERAGE_ENABLED
|
||||
CMDLINE_TEST_TOR = ./src/or/tor-cov
|
||||
else
|
||||
CMDLINE_TEST_TOR = ./src/or/tor
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
|
14
src/test/ntor_ref.py
Normal file → Executable file
14
src/test/ntor_ref.py
Normal file → Executable file
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
# Copyright 2012-2013, The Tor Project, Inc
|
||||
# See LICENSE for licensing information
|
||||
|
||||
@ -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
|
||||
@ -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():
|
||||
@ -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()
|
||||
|
@ -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
|
||||
@ -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…
Reference in New Issue
Block a user