From f58b39075c59a4e354836fd6fc8aaacde1fbdabf Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 11 Oct 2009 10:19:19 +0200 Subject: [PATCH 1/3] New upstream version --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index c2c5612632..c74b1280f9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +tor (0.2.2.4-alpha-1) experimental; urgency=low + + * New upstream version. + + -- Peter Palfrader Sun, 11 Oct 2009 10:19:03 +0200 + tor (0.2.2.3-alpha-1) experimental; urgency=low * New upstream version. From 51a3afd6ac2bd2f48165d834dcde01d2893ca4f1 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 11 Oct 2009 10:19:45 +0200 Subject: [PATCH 2/3] New testsuite location The testsuite moved from src/or/test to src/test/test, but let's call it using "make check" now. --- debian/changelog | 4 +++- debian/rules | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index c74b1280f9..9afb2d3c4e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ tor (0.2.2.4-alpha-1) experimental; urgency=low * New upstream version. + * The testsuite moved from src/or/test to src/test/test, + but let's call it using "make check" now. - -- Peter Palfrader Sun, 11 Oct 2009 10:19:03 +0200 + -- Peter Palfrader Sun, 11 Oct 2009 10:19:21 +0200 tor (0.2.2.3-alpha-1) experimental; urgency=low diff --git a/debian/rules b/debian/rules index 0de4103742..d164d4c753 100755 --- a/debian/rules +++ b/debian/rules @@ -91,11 +91,11 @@ build-stamp: config.status @if [ "$(RUN_TEST)" != "no" ]; then \ if [ "$(LOCALHOST_IP)" != "127.0.0.1" ]; then \ echo; echo; echo "######################################################################"; echo "WARNING: This system does not think localhost is 127.0.0.1. Will ignore result of testsuite. Please fix your system/chroot."; echo "######################################################################"; echo; echo; \ - echo "src/or/test || true"; \ - src/or/test || true; \ + echo "make check || true"; \ + make check || true; \ else \ - echo "src/or/test"; \ - src/or/test; \ + echo "make check"; \ + make check; \ fi; \ else \ echo -e "\n\nSkipping unittests\n\n"; \ From 4cb31d27b551df552647c1450dc1d687df142f56 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 11 Oct 2009 10:39:49 +0200 Subject: [PATCH 3/3] Ship debian source with src/test/test.h Upstream failed to ship src/test/test.h. Ship it in debian/ and manually copy it in place during configure and clean up in clean. Let's not use the patch system as this will most likely be rectified by next release. --- debian/changelog | 6 +++- debian/rules | 9 +++++ debian/src-test-test.h | 75 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 debian/src-test-test.h diff --git a/debian/changelog b/debian/changelog index 9afb2d3c4e..16eb6d5bad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,12 @@ tor (0.2.2.4-alpha-1) experimental; urgency=low * New upstream version. * The testsuite moved from src/or/test to src/test/test, but let's call it using "make check" now. + * Upstream failed to ship src/test/test.h. Ship it in debian/ and + manually copy it in place during configure and clean up in clean. + Let's not use the patch system as this will most likely be rectified + by next release. - -- Peter Palfrader Sun, 11 Oct 2009 10:19:21 +0200 + -- Peter Palfrader Sun, 11 Oct 2009 10:38:55 +0200 tor (0.2.2.3-alpha-1) experimental; urgency=low diff --git a/debian/rules b/debian/rules index d164d4c753..dc12c16943 100755 --- a/debian/rules +++ b/debian/rules @@ -66,6 +66,11 @@ endif configure: patch-stamp config.status: configure + # clean up test.h stuff. XXX - expected to no longer be needed after tor-0.2.2.4-alpha + rm -f src/test/test.h.orig + ! [ -e src/test/test.h ] || mv src/test/test.h src/test/test.h.orig + cp debian/src-test-test.h src/test/test.h + @if [ "$(LOCALHOST_IP)" != "127.0.0.1" ]; then echo; echo; echo; echo; echo; echo "######################################################################"; echo "WARNING: This system does not think localhost is 127.0.0.1. Will ignore result of testsuite. Please fix your system/chroot."; echo "######################################################################"; echo; echo; echo; echo; echo "Note: 'getent hosts localhost' should return '127.0.0.1 localhost'"; echo; fi dh_testdir CFLAGS="$(CFLAGS)" ./configure \ @@ -135,6 +140,10 @@ clean: unpatch [ ! -f Makefile ] || $(MAKE) distclean + # clean up test.h stuff. XXX - expected to no longer be needed after tor-0.2.2.4-alpha + rm -f src/test/test.h + ! [ -e src/test/test.h.orig ] || mv src/test/test.h.orig src/test/test.h + # Normally the .deb wouldn't ship with a ../.git if [ -d .git ] && which git >/dev/null; then \ echo "\"`git rev-parse --short=16 HEAD`\"" > "debian/micro-revision.i" ; \ diff --git a/debian/src-test-test.h b/debian/src-test-test.h new file mode 100644 index 0000000000..ed0eb316ad --- /dev/null +++ b/debian/src-test-test.h @@ -0,0 +1,75 @@ +/* Copyright (c) 2001-2003, Roger Dingledine. + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. + * Copyright (c) 2007-2009, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +#ifndef _TOR_TEST_H +#define _TOR_TEST_H + +/** + * \file test.h + * \brief Macros and functions used by unit tests. + */ + +#include "compat.h" +#include "tinytest.h" +#define TT_EXIT_TEST_FUNCTION STMT_BEGIN goto done; STMT_END +#include "tinytest_macros.h" + +#ifdef __GNUC__ +#define PRETTY_FUNCTION __PRETTY_FUNCTION__ +#else +#define PRETTY_FUNCTION "" +#endif + +#define test_fail_msg(msg) TT_DIE((msg)) + +#define test_fail() test_fail_msg("Assertion failed.") + +#define test_assert(expr) tt_assert(expr) + +#define test_eq(expr1, expr2) tt_int_op((expr1), ==, (expr2)) +#define test_eq_ptr(expr1, expr2) tt_ptr_op((expr1), ==, (expr2)) +#define test_neq(expr1, expr2) tt_int_op((expr1), !=, (expr2)) +#define test_neq_ptr(expr1, expr2) tt_ptr_op((expr1), !=, (expr2)) +#define test_streq(expr1, expr2) tt_str_op((expr1), ==, (expr2)) +#define test_strneq(expr1, expr2) tt_str_op((expr1), !=, (expr2)) +#define test_streq(expr1, expr2) tt_str_op((expr1), ==, (expr2)) + +#define test_mem_op(expr1, op, expr2, len) \ + tt_assert_test_fmt_type(expr1,expr2,#expr1" "#op" "#expr2, \ + const char *, \ + (memcmp(_val1, _val2, len) op 0), \ + char *, "%s", \ + { size_t printlen = (len)*2+1; \ + _print = tor_malloc(printlen); \ + base16_encode(_print, printlen, _value, \ + (len)); }, \ + { tor_free(_print); } \ + ); + +#define test_memeq(expr1, expr2, len) test_mem_op((expr1), ==, (expr2), len) +#define test_memneq(expr1, expr2, len) test_mem_op((expr1), !=, (expr2), len) + +/* As test_mem_op, but decodes 'hex' before comparing. There must be a + * local char* variable called mem_op_hex_tmp for this to work. */ +#define test_mem_op_hex(expr1, op, hex) \ + STMT_BEGIN \ + size_t length = strlen(hex); \ + tor_free(mem_op_hex_tmp); \ + mem_op_hex_tmp = tor_malloc(length/2); \ + tor_assert((length&1)==0); \ + base16_decode(mem_op_hex_tmp, length/2, hex, length); \ + test_mem_op(expr1, op, mem_op_hex_tmp, length/2); \ + STMT_END + +#define test_memeq_hex(expr1, hex) test_mem_op_hex(expr1, ==, hex) + +const char *get_fname(const char *name); +crypto_pk_env_t *pk_generate(int idx); + +void legacy_test_helper(void *data); +extern const struct testcase_setup_t legacy_setup; + +#endif +