Fix result printing

- Flushing stdout prevents the buffer from being printed twice, fixing
  issues with stdout printing out the testplan, etc, twice.
- Don't print out raw source/line numbers; hide them behind comments.

MFC after:	1 week
This commit is contained in:
ngie 2017-08-13 00:04:50 +00:00
parent d52715ee3c
commit 0a031585ff
4 changed files with 24 additions and 12 deletions

View File

@ -52,18 +52,20 @@ static int ntest = 1;
#define CHECK(expr) do { \
if ((expr)) \
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
else \
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
fflush(stdout); \
ntest++; \
} while (0)
#define CHECKX(expr) do { \
if ((expr)) { \
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
} else { \
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
exit(1); \
} \
fflush(stdout); \
ntest++; \
} while (0)
@ -332,6 +334,7 @@ main(void)
int families[2];
printf("1..91\n");
fflush(stdout);
capcas = cap_init();
CHECKX(capcas != NULL);

View File

@ -52,6 +52,7 @@ static int ntest = 1;
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
else \
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
fflush(stdout); \
ntest++; \
} while (0)
#define CHECKX(expr) do { \
@ -61,6 +62,7 @@ static int ntest = 1;
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
exit(1); \
} \
fflush(stdout); \
ntest++; \
} while (0)
@ -1524,6 +1526,7 @@ main(void)
cap_channel_t *capcas, *capgrp;
printf("1..199\n");
fflush(stdout);
capcas = cap_init();
CHECKX(capcas != NULL);

View File

@ -49,18 +49,20 @@ static int ntest = 1;
#define CHECK(expr) do { \
if ((expr)) \
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
else \
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\
printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
fflush(stdout); \
ntest++; \
} while (0)
#define CHECKX(expr) do { \
if ((expr)) { \
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
} else { \
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__);\
printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
exit(1); \
} \
fflush(stdout); \
ntest++; \
} while (0)
@ -1510,6 +1512,7 @@ main(void)
cap_channel_t *capcas, *cappwd;
printf("1..188\n");
fflush(stdout);
capcas = cap_init();
CHECKX(capcas != NULL);

View File

@ -61,18 +61,20 @@ static int ntest = 1;
#define CHECK(expr) do { \
if ((expr)) \
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
else \
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
fflush(stdout); \
ntest++; \
} while (0)
#define CHECKX(expr) do { \
if ((expr)) { \
printf("ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
} else { \
printf("not ok %d %s:%u\n", ntest, __FILE__, __LINE__); \
printf("not ok %d # %s:%u\n", ntest, __FILE__, __LINE__); \
exit(1); \
} \
fflush(stdout); \
ntest++; \
} while (0)
@ -1472,6 +1474,7 @@ main(void)
size_t scsize;
printf("1..256\n");
fflush(stdout);
scsize = sizeof(scvalue0);
CHECKX(sysctlbyname(SYSCTL0_NAME, &scvalue0, &scsize, NULL, 0) == 0);