Merge lp:~gl-az/percona-xtrabackup/2.1-testrun-summary into lp:percona-xtrabackup/2.1

Proposed by George Ormond Lorch III
Status: Superseded
Proposed branch: lp:~gl-az/percona-xtrabackup/2.1-testrun-summary
Merge into: lp:percona-xtrabackup/2.1
Diff against target: 95 lines (+39/-4)
1 file modified
test/testrun.c (+39/-4)
To merge this branch: bzr merge lp:~gl-az/percona-xtrabackup/2.1-testrun-summary
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Fixing
Registry Administrators Pending
Review via email: mp+166844@code.launchpad.net

This proposal has been superseded by a proposal from 2013-06-03.

Description of the change

Added test status tracking and summary report at end of test run cycle to make it wasy to see what failed at a glance, similar to MTR.

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Same comments as for the 2.0 MP.

review: Needs Fixing
610. By George Ormond Lorch III

Fixed issue in testrun.c where specifying testsuite would find the tests in the corredt directory but would still try to execute them out of ./t

Added test status tracking and summary report at end of test run cycle to make it wasy to see what passed, skipped and failed at a glance, similar to MTR.

Changed testrun.sh slightly to return same code out of testrun.sh as the test that was executed when only a single test was run.

Unmerged revisions

610. By George Ormond Lorch III

Fixed issue in testrun.c where specifying testsuite would find the tests in the corredt directory but would still try to execute them out of ./t

Added test status tracking and summary report at end of test run cycle to make it wasy to see what passed, skipped and failed at a glance, similar to MTR.

Changed testrun.sh slightly to return same code out of testrun.sh as the test that was executed when only a single test was run.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test/testrun.c'
2--- test/testrun.c 2013-01-11 13:00:50 +0000
3+++ test/testrun.c 2013-06-03 18:33:30 +0000
4@@ -41,6 +41,7 @@
5 char *buf;
6 size_t end_of_buf;
7 size_t bufsz;
8+ int status;
9 };
10
11 pid_t *childpid;
12@@ -96,6 +97,7 @@
13 (*cases)[i].buf= NULL;
14 (*cases)[i].end_of_buf= 0;
15 (*cases)[i].bufsz= 0;
16+ (*cases)[i].status= 0;
17 free(namelist[i]);
18 }
19
20@@ -113,6 +115,38 @@
21 free(cases);
22 }
23
24+static void report_status(struct testcase *cases, int n)
25+{
26+ int i;
27+ int failed=0;
28+ int skipped=0;
29+ for (i=0; i<n; i++)
30+ if (WEXITSTATUS(cases[i].status) != 0)
31+ if (WEXITSTATUS(cases[i].status) == 200)
32+ skipped++;
33+ else
34+ failed++;
35+
36+ printf("SUMMARY: %d run, %d successful, %d skipped, %d failed\n", n, n - failed - skipped, skipped, failed);
37+ if (skipped)
38+ {
39+ printf("Skipped cases:");
40+ for (i=0; i<n; i++)
41+ if (WEXITSTATUS(cases[i].status) == 200)
42+ printf(" %s", cases[i].name);
43+ printf("\n");
44+ }
45+
46+ if (failed)
47+ {
48+ printf("Failing cases:");
49+ for (i=0; i<n; i++)
50+ if (WEXITSTATUS(cases[i].status) != 0)
51+ printf(" %s", cases[i].name);
52+ printf("\n");
53+ }
54+}
55+
56 static int run_testcase_in_child(int nr, struct testcase *t, pid_t *cpid, const char* xbtarget)
57 {
58 int fd[2];
59@@ -202,7 +236,6 @@
60 int nfds= 0;
61 int retval;
62 pid_t chpid[njobs];
63- int status;
64 int next_testcase= 0;
65 int i;
66 fd_set rfds;
67@@ -277,8 +310,8 @@
68 t->end_of_buf+= r;
69 } while(r>0);
70
71- pid_t waited= waitpid(childpid[i], &status, WNOHANG);
72- if (!(WIFEXITED(status) || WIFSIGNALED(status)))
73+ pid_t waited= waitpid(childpid[i], &testcases[childtest[i]].status, WNOHANG);
74+ if (!(WIFEXITED(testcases[childtest[i]].status) || WIFSIGNALED(testcases[childtest[i]].status)))
75 continue;
76
77 if (waited != childpid[i])
78@@ -289,7 +322,7 @@
79
80 close(childfd[i]);
81 printf("[%d] completed %s status %d\n",
82- i, testcases[childtest[i]].name, WEXITSTATUS(status));
83+ i, testcases[childtest[i]].name, WEXITSTATUS(testcases[childtest[i]].status));
84 childfd[i]=-1;
85 nchildren--;
86
87@@ -399,6 +432,8 @@
88
89 run_testcases(testcases, nrcases, njobs, timeout, xbtarget);
90
91+ report_status(testcases, nrcases);
92+
93 free_testcases(testcases, nrcases);
94
95 return 0;

Subscribers

People subscribed via source and target branches