[LTP] [PATCH 09/13] testcases/kernel/mem: Move KSM bits to ksm tests

Petr Vorel pvorel@suse.cz
Fri Dec 27 12:15:48 CET 2024


Hi Cyril,

> --- /dev/null
> +++ b/testcases/kernel/mem/ksm/ksm_test.h
> @@ -0,0 +1,299 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) Linux Test Project, 2011-2021
> + * Copyright (c) Cyril Hrubis <chrubis@suse.cz> 2024
> + */
> +#ifndef KSM_TEST_
> +#define KSM_TEST_
> +
> +#include <sys/wait.h>
> +
> +static inline void check(char *path, long int value)
> +{
> +	char fullpath[BUFSIZ];
> +	long actual_val;
> +
> +	snprintf(fullpath, BUFSIZ, PATH_KSM "%s", path);
> +	SAFE_FILE_SCANF(fullpath, "%ld", &actual_val);

FYI there is an old warning (not relevant to this change), not sure if it's an
false positive or how to fix it:

mem.c: In function ‘write_cpusets’:
mem.c:555:52: warning: ‘/online’ directive output may be truncated writing 7 bytes into a region of size between 1 and 8192 [-Wformat-truncation=]
  555 |                         snprintf(path1, BUFSIZ, "%s/online", path);
      |                                                    ^~~~~~~ 

Kind regards,
Petr


More information about the ltp mailing list