From owner-svn-src-all@freebsd.org  Sun Aug 13 00:04:52 2017
Return-Path: <owner-svn-src-all@freebsd.org>
Delivered-To: svn-src-all@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50837DD3D8B;
 Sun, 13 Aug 2017 00:04:52 +0000 (UTC)
 (envelope-from ngie@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 2C64777565;
 Sun, 13 Aug 2017 00:04:52 +0000 (UTC)
 (envelope-from ngie@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7D04pYU054623;
 Sun, 13 Aug 2017 00:04:51 GMT (envelope-from ngie@FreeBSD.org)
Received: (from ngie@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7D04p6X054619;
 Sun, 13 Aug 2017 00:04:51 GMT (envelope-from ngie@FreeBSD.org)
Message-Id: <201708130004.v7D04p6X054619@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ngie set sender to
 ngie@FreeBSD.org using -f
From: Ngie Cooper <ngie@FreeBSD.org>
Date: Sun, 13 Aug 2017 00:04:51 +0000 (UTC)
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
X-SVN-Group: head
X-SVN-Commit-Author: ngie
X-SVN-Commit-Paths: in head/lib/libcasper/services: cap_dns/tests
 cap_grp/tests cap_pwd/tests cap_sysctl/tests
X-SVN-Commit-Revision: 322447
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 13 Aug 2017 00:04:52 -0000

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);