[PATCH liburing 6/6] tests: correctly exit with failure in a looped test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A common test pattern in this project is to test a couple related things
in a single test binary, and return failure on the first one that fails,
if any. Tracking subtest failures cannot be done well with simple exit()
statuses, though it can using something like TAP and parsing a generated
report.

However, this test simply set the value of `ret`, then proceeded to
another test. If the first failed and the second succeeded, we would log
a failure but then return a success.

Just return immediately on failure as is done elsewhere.

Signed-off-by: Eli Schwartz <eschwartz93@xxxxxxxxx>
---
 test/multicqes_drain.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/multicqes_drain.c b/test/multicqes_drain.c
index b7448ac..1423f92 100644
--- a/test/multicqes_drain.c
+++ b/test/multicqes_drain.c
@@ -373,7 +373,7 @@ int main(int argc, char *argv[])
 		ret = test_simple_drain(&ring);
 		if (ret) {
 			fprintf(stderr, "test_simple_drain failed\n");
-			break;
+			return T_EXIT_FAIL;
 		}
 	}
 
@@ -381,8 +381,8 @@ int main(int argc, char *argv[])
 		ret = test_generic_drain(&ring);
 		if (ret) {
 			fprintf(stderr, "test_generic_drain failed\n");
-			break;
+			return T_EXIT_FAIL;
 		}
 	}
-	return ret;
+	return T_EXIT_PASS;
 }
-- 
2.35.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux