If anything but the first step of the last test fails, the exit code
(fail_count) was not properly set. Fix this such that follow on patches
will be able to save error output and correctly inform the script that a
failure has occurred rather than just expecting random output to fail
the diff check.
The issue is last_test is not properly tracking which test the loop is
currently on. Therefore fail_count would not be incremented correctly.
Remove the special case of checking for the end of the steps array and
track last_test properly. Then adjust test_count to be correct for the
new code.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
int end = 0;
int result = 0;
int last_test = 0;
- int test_count = 0;
+ int test_count = -1;
int fail_flag = 0;
while(!end) {
if (server) {
}
}
}
- if(tests[index][TEST_NUM] != 0) {
- if(last_test != tests[index][TEST_NUM]) {
- test_count++;
- if(fail_flag)
- fail_count++;
- fail_flag = 0;
- }
- last_test = tests[index][TEST_NUM];
+ if(last_test != tests[index][TEST_NUM]) {
+ test_count++;
+ if(fail_flag)
+ fail_count++;
+ fail_flag = 0;
+ last_test = tests[index][TEST_NUM];
}
index++;
fprintf(stderr,"client: sending result to server (%d)\n", ctl.index);
/* Send result to the server */
send_ctl();
- if(tests[index][TEST_NUM] != 0) {
- if(last_test != tests[index][TEST_NUM])
- test_count++;
+ if(last_test != tests[index][TEST_NUM]) {
+ test_count++;
last_test = tests[index][TEST_NUM];
}
}