diff mbox

[5/6] testsuite: add missing error handling

Message ID 20180103222924.26347-6-lucas.demarchi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas De Marchi Jan. 3, 2018, 10:29 p.m. UTC
If we passed an invalid argument to a test it would segfault rather than
returning an error code.
---
 testsuite/testsuite.h | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h
index bb0eb50..2b31483 100644
--- a/testsuite/testsuite.h
+++ b/testsuite/testsuite.h
@@ -151,6 +151,8 @@  int test_run(const struct test *t);
 		arg = test_init(__start_kmod_tests, __stop_kmod_tests, argc, argv);		\
 		if (arg == 0)									\
 			return 0;								\
+		if (arg < 0)									\
+			return EXIT_FAILURE;							\
 												\
 		if (arg < argc) {								\
 			t = test_find(__start_kmod_tests, __stop_kmod_tests, argv[arg]);	\