public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/test harness.c
@ 2010-04-07  9:48 mornfall
  0 siblings, 0 replies; 7+ messages in thread
From: mornfall @ 2010-04-07  9:48 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-07 09:48:11

Modified files:
	test           : harness.c 

Log message:
	In test harness, use fwrite(3) in place of write(2) to avoid mixing fd-level
	and FILE-level IO on stdout.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/harness.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8

--- LVM2/test/harness.c	2010/04/07 09:41:33	1.7
+++ LVM2/test/harness.c	2010/04/07 09:48:11	1.8
@@ -37,7 +37,7 @@
 }
 
 void dump() {
-	write(1, readbuf, readbuf_used);
+	fwrite(readbuf, 1, readbuf_used, stdout);
 }
 
 void clear() {


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2/test harness.c
@ 2010-04-13  7:34 mornfall
  0 siblings, 0 replies; 7+ messages in thread
From: mornfall @ 2010-04-13  7:34 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-13 07:34:19

Modified files:
	test           : harness.c 

Log message:
	Fix a reversed exit status from test harness.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/harness.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10

--- LVM2/test/harness.c	2010/04/13 07:33:34	1.9
+++ LVM2/test/harness.c	2010/04/13 07:34:19	1.10
@@ -196,5 +196,5 @@
 		printf("\n");
 		return s.nfailed > 0 || die;
 	}
-	return !die;
+	return die;
 }


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2/test harness.c
@ 2010-04-13  7:33 mornfall
  0 siblings, 0 replies; 7+ messages in thread
From: mornfall @ 2010-04-13  7:33 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-13 07:33:34

Modified files:
	test           : harness.c 

Log message:
	Optionally disable the verbose repeat of a failed test (export
	LVM_TEST_NOVERBOSE=1).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/harness.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9

--- LVM2/test/harness.c	2010/04/07 09:48:11	1.8
+++ LVM2/test/harness.c	2010/04/13 07:33:34	1.9
@@ -133,6 +133,7 @@
 
 int main(int argc, char **argv) {
 	int i;
+	int repeat = getenv("LVM_TEST_NOVERBOSE") ? 0 : 1;
 
 	if (argc >= MAX) {
 		fprintf(stderr, "Sorry, my head exploded. Please increase MAX.\n");
@@ -168,7 +169,7 @@
 		run(i, argv[i]);
 		if (die)
 			break;
-		if ( s.status[i] == FAILED ) {
+		if ( repeat && s.status[i] == FAILED ) {
 			backup = s;
 			setenv("LVM_TEST_CONFIG", config_debug, 1);
 			run(i, argv[i]);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2/test harness.c
@ 2010-04-07  9:41 mornfall
  0 siblings, 0 replies; 7+ messages in thread
From: mornfall @ 2010-04-07  9:41 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-04-07 09:41:34

Modified files:
	test           : harness.c 

Log message:
	Keep the testsuite stats correct in spite of failed-test repetition.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/harness.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7

--- LVM2/test/harness.c	2010/03/31 23:11:12	1.6
+++ LVM2/test/harness.c	2010/04/07 09:41:33	1.7
@@ -8,10 +8,18 @@
 
 pid_t pid;
 int fds[2];
-int *status;
-int nfailed = 0;
-int nskipped = 0;
-int npassed = 0;
+
+#define MAX 1024
+
+struct stats {
+	int nfailed;
+	int nskipped;
+	int npassed;
+	int status[MAX];
+};
+
+struct stats s;
+struct stats backup;
 
 char *readbuf = NULL;
 int readbuf_sz = 0, readbuf_used = 0;
@@ -55,20 +63,20 @@
 }
 
 void passed(int i, char *f) {
-	++ npassed;
-	status[i] = PASSED;
+	++ s.npassed;
+	s.status[i] = PASSED;
 	printf("passed.\n");
 }
 
 void skipped(int i, char *f) {
-	++ nskipped;
-	status[i] = SKIPPED;
+	++ s.nskipped;
+	s.status[i] = SKIPPED;
 	printf("skipped.\n");
 }
 
 void failed(int i, char *f, int st) {
-	++ nfailed;
-	status[i] = FAILED;
+	++ s.nfailed;
+	s.status[i] = FAILED;
 	if(die == 2) {
 		printf("interrupted.\n");
 		return;
@@ -125,7 +133,14 @@
 
 int main(int argc, char **argv) {
 	int i;
-	status = alloca(sizeof(int)*argc);
+
+	if (argc >= MAX) {
+		fprintf(stderr, "Sorry, my head exploded. Please increase MAX.\n");
+		exit(1);
+	}
+
+	s.nfailed = s.npassed = s.nskipped = 0;
+
 	char *config = getenv("LVM_TEST_CONFIG"),
 	     *config_debug;
 	config = config ? config : "";
@@ -153,21 +168,22 @@
 		run(i, argv[i]);
 		if (die)
 			break;
-		if ( status[i] == FAILED ) {
+		if ( s.status[i] == FAILED ) {
+			backup = s;
 			setenv("LVM_TEST_CONFIG", config_debug, 1);
 			run(i, argv[i]);
 			setenv("LVM_TEST_CONFIG", config, 1);
-			status[i] = FAILED; /* just in case */
+			s = backup;
 		}
 	}
 
 	printf("\n## %d tests: %d OK, %d failed, %d skipped\n",
-	       npassed + nfailed + nskipped, npassed, nfailed, nskipped);
+	       s.npassed + s.nfailed + s.nskipped, s.npassed, s.nfailed, s.nskipped);
 
 	/* print out a summary */
-	if (nfailed || nskipped) {
+	if (s.nfailed || s.nskipped) {
 		for (i = 1; i < argc; ++ i) {
-			switch (status[i]) {
+			switch (s.status[i]) {
 			case FAILED:
 				printf("FAILED: %s\n", argv[i]);
 				break;
@@ -177,7 +193,7 @@
 			}
 		}
 		printf("\n");
-		return nfailed > 0 || die;
+		return s.nfailed > 0 || die;
 	}
 	return !die;
 }


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2/test harness.c
@ 2010-03-31 23:11 mornfall
  0 siblings, 0 replies; 7+ messages in thread
From: mornfall @ 2010-03-31 23:11 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-03-31 23:11:13

Modified files:
	test           : harness.c 

Log message:
	Do not pass NULL to setenv in the test harness.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/harness.c.diff?cvsroot=lvm2&r1=1.5&r2=1.6

--- LVM2/test/harness.c	2010/03/31 22:18:17	1.5
+++ LVM2/test/harness.c	2010/03/31 23:11:12	1.6
@@ -128,7 +128,8 @@
 	status = alloca(sizeof(int)*argc);
 	char *config = getenv("LVM_TEST_CONFIG"),
 	     *config_debug;
-	asprintf(&config_debug, "%s\n%s", config ? config : "", "log {\n verbose=4\n }");
+	config = config ? config : "";
+	asprintf(&config_debug, "%s\n%s\n", config, "log { verbose=4 }");
 
 	if (socketpair(PF_UNIX, SOCK_STREAM, 0, fds)) {
 		perror("socketpair");


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2/test harness.c
@ 2009-02-17 19:36 mornfall
  0 siblings, 0 replies; 7+ messages in thread
From: mornfall @ 2009-02-17 19:36 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2009-02-17 19:36:16

Modified files:
	test           : harness.c 

Log message:
	Fix test output collection in harness.c.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/harness.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3

--- LVM2/test/harness.c	2009/02/16 16:49:21	1.2
+++ LVM2/test/harness.c	2009/02/17 19:36:16	1.3
@@ -106,6 +106,7 @@
 			perror("waitpid");
 			exit(206);
 		}
+		drain();
 		if (WIFEXITED(st)) {
 			if (WEXITSTATUS(st) == 0) {
 				passed(i, f);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* LVM2/test harness.c
@ 2009-02-16 16:49 mornfall
  0 siblings, 0 replies; 7+ messages in thread
From: mornfall @ 2009-02-16 16:49 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2009-02-16 16:49:22

Modified files:
	test           : harness.c 

Log message:
	Only fail when tests have failed, but not when they have been just skipped.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/harness.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2

--- LVM2/test/harness.c	2009/02/12 19:54:45	1.1
+++ LVM2/test/harness.c	2009/02/16 16:49:21	1.2
@@ -153,7 +153,7 @@
 	       npassed + nfailed + nskipped, npassed, nfailed, nskipped);
 
 	/* print out a summary */
-	if (nfailed || nskipped ) {
+	if (nfailed || nskipped) {
 		for (i = 1; i < argc; ++ i) {
 			switch (status[i]) {
 			case FAILED:
@@ -165,7 +165,7 @@
 			}
 		}
 		printf("\n");
-		return 1;
+		return nfailed > 0 || die;
 	}
 	return !die;
 }


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-04-13  7:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-07  9:48 LVM2/test harness.c mornfall
  -- strict thread matches above, loose matches on Subject: below --
2010-04-13  7:34 mornfall
2010-04-13  7:33 mornfall
2010-04-07  9:41 mornfall
2010-03-31 23:11 mornfall
2009-02-17 19:36 mornfall
2009-02-16 16:49 mornfall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).