1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-28 02:50:41 +03:00

Add provisions to flag tests that we know will fail, without flagging the build

(i.e. an expected failure).
This commit is contained in:
Petr Rockai 2012-05-16 10:43:41 +00:00
parent f1aabd5c60
commit 03885b6863
2 changed files with 24 additions and 4 deletions

View File

@ -17,6 +17,10 @@ run_valgrind() {
exec "${VALGRIND:-valg}" "$@"
}
expect_failure() {
echo "TEST EXPECT FAILURE"
}
prepare_clvmd() {
test "${LVM_TEST_LOCKING:-0}" -ne 3 && return # not needed

View File

@ -32,6 +32,7 @@ struct stats {
int nfailed;
int nskipped;
int npassed;
int nknownfail;
int nwarned;
int status[MAX];
};
@ -55,6 +56,7 @@ static struct subst subst[2];
#define SKIPPED 1
#define FAILED 2
#define WARNED 3
#define KNOWNFAIL 4
static void handler( int sig ) {
signal( sig, SIG_DFL );
@ -227,7 +229,11 @@ static const char *duration(time_t start)
}
static void passed(int i, char *f, time_t t) {
if (readbuf && strstr(readbuf, "TEST WARNING")) {
if (readbuf && strstr(readbuf, "TEST EXPECT FAIL")) {
++ s.npassed;
s.status[i] = PASSED;
printf("passed (UNEXPECTED). %s\n", duration(t));
} else if (readbuf && strstr(readbuf, "TEST WARNING")) {
++s.nwarned;
s.status[i] = WARNED;
printf("warnings %s\n", duration(t));
@ -245,6 +251,13 @@ static void skipped(int i, char *f) {
}
static void failed(int i, char *f, int st) {
if (readbuf && strstr(readbuf, "TEST EXPECT FAIL")) {
printf("FAILED (expected).\n");
s.status[i] = KNOWNFAIL;
++ s.nknownfail;
return;
}
++ s.nfailed;
s.status[i] = FAILED;
if(die == 2) {
@ -343,18 +356,21 @@ int main(int argc, char **argv) {
break;
}
printf("\n## %d tests %s : %d OK, %d warnings, %d failures; %d skipped\n",
printf("\n## %d tests %s : %d OK, %d warnings, %d failures, %d known failures; %d skipped\n",
s.nwarned + s.npassed + s.nfailed + s.nskipped,
duration(start),
s.npassed, s.nwarned, s.nfailed, s.nskipped);
s.npassed, s.nwarned, s.nfailed, s.nknownfail, s.nskipped);
/* print out a summary */
if (s.nfailed || s.nskipped) {
if (s.nfailed || s.nskipped || s.nknownfail) {
for (i = 1; i < argc; ++ i) {
switch (s.status[i]) {
case FAILED:
printf("FAILED: %s\n", argv[i]);
break;
case KNOWNFAIL:
printf("FAILED (expected): %s\n", argv[i]);
break;
case SKIPPED:
printf("skipped: %s\n", argv[i]);
break;