diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-03-01 06:45:32 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-03-01 06:45:32 +0000 |
commit | 5072488a950e6775bf1d02db2d4dfc473007ab75 (patch) | |
tree | 5c8b8a3e53f50cdbb9f13dfa00e4983a0b65aac9 /src/common | |
parent | 3138941e682264dd3d22e28370c4ba0205c65231 (diff) | |
download | tor-5072488a950e6775bf1d02db2d4dfc473007ab75.tar tor-5072488a950e6775bf1d02db2d4dfc473007ab75.tar.gz |
make 'make test' exit(1) if a test fails.
svn:r1190
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/test.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common/test.h b/src/common/test.h index 017ecf22d..d30a458e0 100644 --- a/src/common/test.h +++ b/src/common/test.h @@ -16,8 +16,11 @@ #define PRETTY_FUNCTION "" #endif +extern int have_failed; + #define test_fail() \ STMT_BEGIN \ + have_failed = 1; \ printf("\nFile %s: line %d (%s): assertion failed.", \ __FILE__, \ __LINE__, \ @@ -28,6 +31,7 @@ #define test_assert(expr) \ STMT_BEGIN \ if(expr) { printf("."); } else { \ + have_failed = 1; \ printf("\nFile %s: line %d (%s): assertion failed: (%s)\n", \ __FILE__, \ __LINE__, \ @@ -40,6 +44,7 @@ STMT_BEGIN \ long v1=(long)(expr1), v2=(long)(expr2); \ if(v1==v2) { printf("."); } else { \ + have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n"\ " (%ld != %ld)\n", \ __FILE__, \ @@ -54,6 +59,7 @@ STMT_BEGIN \ long v1=(long)(expr1), v2=(long)(expr2); \ if(v1!=v2) { printf("."); } else { \ + have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n"\ " (%ld == %ld)\n", \ __FILE__, \ @@ -68,6 +74,7 @@ STMT_BEGIN \ char *v1=(expr1), *v2=(expr2); \ if(!strcmp(v1,v2)) { printf("."); } else { \ + have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n"\ " (\"%s\" != \"%s\")\n", \ __FILE__, \ @@ -82,6 +89,7 @@ STMT_BEGIN \ char *v1=(expr1), *v2=(expr2); \ if(strcmp(v1,v2)) { printf("."); } else { \ + have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n"\ " (\"%s\" == \"%s\")\n", \ __FILE__, \ @@ -96,6 +104,7 @@ STMT_BEGIN \ void *v1=(expr1), *v2=(expr2); \ if(!memcmp(v1,v2,(len))) { printf("."); } else { \ + have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n", \ __FILE__, \ __LINE__, \ @@ -108,6 +117,7 @@ STMT_BEGIN \ void *v1=(expr1), *v2=(expr2); \ if(memcmp(v1,v2,(len))) { printf("."); } else { \ + have_failed = 1; \ printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n", \ __FILE__, \ __LINE__, \ |