Skip to content

Commit

Permalink
testsuite: sort modnames only, if available
Browse files Browse the repository at this point in the history
In some tests we expect zero modules to be loaded. In those cases, skip
the sorting - qsort is annotated as non-null(1,2) so we shouldn't
provide null as expected/loaded modules.

Signed-off-by: Emil Velikov <[email protected]>
Link: #144
Signed-off-by: Lucas De Marchi <[email protected]>
  • Loading branch information
evelikov authored and lucasdemarchi committed Sep 22, 2024
1 parent f2c7b08 commit a49a96b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions testsuite/testsuite.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,10 @@ static int check_loaded_modules(const struct test *t)
a2 = read_loaded_modules(t, &buf2, &l2);
if (l2 < 0)
goto out_a1;
qsort(a1, l1, sizeof(char *), cmp_modnames);
qsort(a2, l2, sizeof(char *), cmp_modnames);
if (a1 && l1)
qsort(a1, l1, sizeof(char *), cmp_modnames);
if (a2 && l2)
qsort(a2, l2, sizeof(char *), cmp_modnames);
i1 = i2 = 0;
err = true;
while (i1 < l1 || i2 < l2) {
Expand Down

0 comments on commit a49a96b

Please sign in to comment.