From c7b519524c10d8e222456b41db1bb8fef24e403e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 30 Aug 2012 17:12:35 +0200 Subject: [PATCH] iscsi-test: prepare to return exit status 77 for skipped tests Teach the test harness to distinguish skipped tests from failed tests. Return -2 from a skipped test and, if no test was failed but some were skipped, return 77 from the main program. Signed-off-by: Paolo Bonzini --- test-tool/iscsi-test.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test-tool/iscsi-test.c b/test-tool/iscsi-test.c index 472fa3b..4c27cf4 100644 --- a/test-tool/iscsi-test.c +++ b/test-tool/iscsi-test.c @@ -331,7 +331,7 @@ int main(int argc, const char *argv[]) int extra_argc = 0; const char *url = NULL; int show_help = 0, show_usage = 0, list_tests = 0; - int res, ret; + int res, num_failed, num_skipped; struct scsi_test *test; char *testname = NULL; @@ -390,7 +390,7 @@ int main(int argc, const char *argv[]) exit(10); } - ret = 0; + num_failed = num_skipped = 0; for (test = &tests[0]; test->name; test++) { if (testname != NULL && fnmatch(testname, test->name, 0)) { continue; @@ -399,13 +399,16 @@ int main(int argc, const char *argv[]) res = test->test(initiator, url, data_loss, show_info); if (res == 0) { printf("TEST %s [OK]\n", test->name); + } else if (res == -2) { + printf("TEST %s [SKIPPED]\n", test->name); + num_skipped++; } else { printf("TEST %s [FAILED]\n", test->name); - ret++; + num_failed++; } printf("\n"); } - return ret; + return num_failed ? num_failed : num_skipped ? 77 : 0; }