mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Keep the testsuite stats correct in spite of failed-test repetition.
This commit is contained in:
parent
065988dcd7
commit
c48d915f11
@ -8,10 +8,18 @@
|
|||||||
|
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int fds[2];
|
int fds[2];
|
||||||
int *status;
|
|
||||||
int nfailed = 0;
|
#define MAX 1024
|
||||||
int nskipped = 0;
|
|
||||||
int npassed = 0;
|
struct stats {
|
||||||
|
int nfailed;
|
||||||
|
int nskipped;
|
||||||
|
int npassed;
|
||||||
|
int status[MAX];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct stats s;
|
||||||
|
struct stats backup;
|
||||||
|
|
||||||
char *readbuf = NULL;
|
char *readbuf = NULL;
|
||||||
int readbuf_sz = 0, readbuf_used = 0;
|
int readbuf_sz = 0, readbuf_used = 0;
|
||||||
@ -55,20 +63,20 @@ void drain() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void passed(int i, char *f) {
|
void passed(int i, char *f) {
|
||||||
++ npassed;
|
++ s.npassed;
|
||||||
status[i] = PASSED;
|
s.status[i] = PASSED;
|
||||||
printf("passed.\n");
|
printf("passed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void skipped(int i, char *f) {
|
void skipped(int i, char *f) {
|
||||||
++ nskipped;
|
++ s.nskipped;
|
||||||
status[i] = SKIPPED;
|
s.status[i] = SKIPPED;
|
||||||
printf("skipped.\n");
|
printf("skipped.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void failed(int i, char *f, int st) {
|
void failed(int i, char *f, int st) {
|
||||||
++ nfailed;
|
++ s.nfailed;
|
||||||
status[i] = FAILED;
|
s.status[i] = FAILED;
|
||||||
if(die == 2) {
|
if(die == 2) {
|
||||||
printf("interrupted.\n");
|
printf("interrupted.\n");
|
||||||
return;
|
return;
|
||||||
@ -125,7 +133,14 @@ void run(int i, char *f) {
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
int i;
|
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"),
|
char *config = getenv("LVM_TEST_CONFIG"),
|
||||||
*config_debug;
|
*config_debug;
|
||||||
config = config ? config : "";
|
config = config ? config : "";
|
||||||
@ -153,21 +168,22 @@ int main(int argc, char **argv) {
|
|||||||
run(i, argv[i]);
|
run(i, argv[i]);
|
||||||
if (die)
|
if (die)
|
||||||
break;
|
break;
|
||||||
if ( status[i] == FAILED ) {
|
if ( s.status[i] == FAILED ) {
|
||||||
|
backup = s;
|
||||||
setenv("LVM_TEST_CONFIG", config_debug, 1);
|
setenv("LVM_TEST_CONFIG", config_debug, 1);
|
||||||
run(i, argv[i]);
|
run(i, argv[i]);
|
||||||
setenv("LVM_TEST_CONFIG", config, 1);
|
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",
|
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 */
|
/* print out a summary */
|
||||||
if (nfailed || nskipped) {
|
if (s.nfailed || s.nskipped) {
|
||||||
for (i = 1; i < argc; ++ i) {
|
for (i = 1; i < argc; ++ i) {
|
||||||
switch (status[i]) {
|
switch (s.status[i]) {
|
||||||
case FAILED:
|
case FAILED:
|
||||||
printf("FAILED: %s\n", argv[i]);
|
printf("FAILED: %s\n", argv[i]);
|
||||||
break;
|
break;
|
||||||
@ -177,7 +193,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return nfailed > 0 || die;
|
return s.nfailed > 0 || die;
|
||||||
}
|
}
|
||||||
return !die;
|
return !die;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user