Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Aug 2017 00:04:51 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322447 - in head/lib/libcasper/services: cap_dns/tests cap_grp/tests cap_pwd/tests cap_sysctl/tests
Message-ID:  <201708130004.v7D04p6X054619@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun Aug 13 00:04:50 2017
New Revision: 322447
URL: https://svnweb.freebsd.org/changeset/base/322447

Log:
  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

Modified:
  head/lib/libcasper/services/cap_dns/tests/dns_test.c
  head/lib/libcasper/services/cap_grp/tests/grp_test.c
  head/lib/libcasper/services/cap_pwd/tests/pwd_test.c
  head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c

Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c
==============================================================================
--- head/lib/libcasper/services/cap_dns/tests/dns_test.c	Sat Aug 12 23:40:01 2017	(r322446)
+++ head/lib/libcasper/services/cap_dns/tests/dns_test.c	Sun Aug 13 00:04:50 2017	(r322447)
@@ -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);

Modified: head/lib/libcasper/services/cap_grp/tests/grp_test.c
==============================================================================
--- head/lib/libcasper/services/cap_grp/tests/grp_test.c	Sat Aug 12 23:40:01 2017	(r322446)
+++ head/lib/libcasper/services/cap_grp/tests/grp_test.c	Sun Aug 13 00:04:50 2017	(r322447)
@@ -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);

Modified: head/lib/libcasper/services/cap_pwd/tests/pwd_test.c
==============================================================================
--- head/lib/libcasper/services/cap_pwd/tests/pwd_test.c	Sat Aug 12 23:40:01 2017	(r322446)
+++ head/lib/libcasper/services/cap_pwd/tests/pwd_test.c	Sun Aug 13 00:04:50 2017	(r322447)
@@ -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);

Modified: head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c
==============================================================================
--- head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c	Sat Aug 12 23:40:01 2017	(r322446)
+++ head/lib/libcasper/services/cap_sysctl/tests/sysctl_test.c	Sun Aug 13 00:04:50 2017	(r322447)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708130004.v7D04p6X054619>