[LTP] [PATCH] migrate_pages02: check file exist before opening it
Cyril Hrubis
chrubis@suse.cz
Fri Mar 4 17:03:42 CET 2022
Hi!
> This test reports a warning on some special kernel (with NUMA BALANCE
> disabling). The main reason is that prefix '?' makes tst_sys_conf_save
> only silent ignores non-exist paths. But seems we still open it in other
> places (e.g. in setup function).
>
> tst_sys_conf.c:58: TINFO: Path not found: '/proc/sys/kernel/numa_balancing'
> tst_test.c:1365: TINFO: Timeout per run is 0h 05m 00s
> migrate_pages02.c:279: TWARN: Failed to open FILE '/proc/sys/kernel/numa_balancing'
> migrate_pages02.c:317: TINFO: Using nodes: 0 1
>
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
>
> Notes:
> Looks like we have many tests use the prefix '?' for knob save/restore,
> but none of them check if the paths are valid when opening at other places,
> by now, I just get informed that migrate_pages02 threw a warning.
>
> I'm thinking maybe we can keep the return value of tst_sys_conf_save
> as a check condition before opening the file, but this is not fit for
> test with many paths saving:
> e.g.
> add_key05.c- "?/proc/sys/kernel/keys/gc_delay",
> add_key05.c- "?/proc/sys/kernel/keys/maxkeys",
Looking at the test we set these values to make the test run faster and
the test works fine even without these knobs, right?
Maybe we just need to enhance the .save_restore with another parameter;
a value to set the knob to if it does exists, so in add_key05.c it would
look like:
struct tst_path_val {
const char *path;
const char *val;
};
.save_restore = (const struct tst_path_val const[]) {
{"?/proc/sys/kernel/keys/gc_delay", "1"},
{"?/proc/sys/kernel/keys/maxkeys", "200"},
{"?/proc/sys/kernel/keys/maxbytes", "20000"}
NULL,
},
And in cases we do not need to set value we would just pass NULL as val...
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list