]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: Assert a test binary is non-empty
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Mon, 6 Jan 2025 16:07:07 +0000 (10:07 -0600)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Mon, 6 Jan 2025 16:23:17 +0000 (10:23 -0600)
Avoid issues like https://github.com/kmod-project/kmod/issues/269
by asserting the test binary is non-empty:

Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
testsuite/testsuite.c

index 0490d5e77f530e108cc8e16ef67aa9c146a85392..3a55e2f2f30530ff22b0ca7d0b5e6bf8f3652d7b 100644 (file)
@@ -82,6 +82,9 @@ int test_init(const struct test *start, const struct test *stop, int argc,
 {
        progname = argv[0];
 
+       /* An empty testsuite is not likely intended */
+       assert_return(start != stop, -EINVAL);
+
        for (;;) {
                int c, idx = 0;
                c = getopt_long(argc, argv, options_short, options, &idx);