Skip to content

Commit 4ae132c

Browse files
broonieakpm00
authored andcommitted
selftest: hugetlb_dio: fix test naming
The string logged when a test passes or fails is used by the selftest framework to identify which test is being reported. The hugetlb_dio test not only uses the same strings for every test that is run but it also uses different strings for test passes and failures which means that test automation is unable to follow what the test is doing at all. Pull the existing duplicated logging of the number of free huge pages before and after the test out of the conditional and replace that and the logging of the result with a single ksft_print_result() which incorporates the parameters passed into the test into the output. Link: https://lkml.kernel.org/r/20241127-kselftest-mm-hugetlb-dio-names-v1-1-22aab01bf550@kernel.org Fixes: fae1980 ("selftests: hugetlb_dio: fixup check for initial conditions to skip in the start") Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Muhammad Usama Anjum <[email protected]> Cc: Donet Tom <[email protected]> Cc: Ritesh Harjani (IBM) <[email protected]> Cc: Shuah Khan <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 965b5dd commit 4ae132c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tools/testing/selftests/mm/hugetlb_dio.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,15 @@ void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off)
7676
/* Get the free huge pages after unmap*/
7777
free_hpage_a = get_free_hugepages();
7878

79+
ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
80+
ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
81+
7982
/*
8083
* If the no. of free hugepages before allocation and after unmap does
8184
* not match - that means there could still be a page which is pinned.
8285
*/
83-
if (free_hpage_a != free_hpage_b) {
84-
ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
85-
ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
86-
ksft_test_result_fail(": Huge pages not freed!\n");
87-
} else {
88-
ksft_print_msg("No. Free pages before allocation : %d\n", free_hpage_b);
89-
ksft_print_msg("No. Free pages after munmap : %d\n", free_hpage_a);
90-
ksft_test_result_pass(": Huge pages freed successfully !\n");
91-
}
86+
ksft_test_result(free_hpage_a == free_hpage_b,
87+
"free huge pages from %u-%u\n", start_off, end_off);
9288
}
9389

9490
int main(void)

0 commit comments

Comments
 (0)