mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
make 'make test' exit(1) if a test fails.
svn:r1190
This commit is contained in:
parent
3138941e68
commit
5072488a95
@ -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__, \
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "or.h"
|
||||
#include "../common/test.h"
|
||||
|
||||
int have_failed = 0;
|
||||
|
||||
void
|
||||
dump_hex(char *s, int len)
|
||||
{
|
||||
@ -715,7 +717,11 @@ main(int c, char**v){
|
||||
puts("\n========================= Directory Formats ===============");
|
||||
test_dir_format();
|
||||
puts("");
|
||||
return 0;
|
||||
|
||||
if (have_failed)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user