[LTP] [PATCH v1 30/31] testcases: sysfs: Add sys_swap01

Li Wang li.wang@linux.dev
Wed Aug 19 03:23:59 CEST 2026


> --- a/runtest/sysfs
> +++ b/runtest/sysfs
> @@ -25,3 +25,4 @@ sys_block_size01 sys_block_size01
>  sys_hugepages01 sys_hugepages01
>  sys_hugepages02 sys_hugepages02
>  sys_ksm01 sys_ksm01
> +sys_swap01 sys_swap01

This should be sys_mm_swap01; otherwise, the runtest file cannot
find the correct test to execute.

> --- /dev/null
> +++ b/testcases/kernel/sysfs/kernel/mm/swap/sys_mm_swap01.c
> @@ -0,0 +1,32 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2026 Cyril Hrubis <chrubis@suse.cz>
> + */
> +
> +/*\
> + * Sanity check for /sys/kernel/mm/swap/vma_ra_enabled.
> + *
> + * Unlike most other boolean sysfs tunables which use 0/1, this one is
> + * formatted as the strings "true" or "false", so it needs its own check
> + * rather than TST_SYSFS_ASSERT_BOOL().
> + *
> + * The test skips with TCONF when the attribute is not present.
> + */
> +
> +#include "tst_test.h"
> +#include "tst_sysfs_assert.h"
> +
> +#define VMA_RA "/sys/kernel/mm/swap/vma_ra_enabled"

I suggest adding all of those path definitions to tst_path_defs.h
and unifying the common macro names.


Also, we need to add the sysfs/ directory to testcases/kernel/Makefile
so they can build successfully by default.

--- a/testcases/kernel/Makefile
+++ b/testcases/kernel/Makefile
@@ -36,6 +36,7 @@ SUBDIRS                       += connectors \
                           sched \
                           security \
                           sound \
+                          sysfs \
                           thermal \
                           tracing \
                           uevents \


-- 
Regards,
Li Wang


More information about the ltp mailing list