Re: [PATCH v2 16/31] testcases: sysfs: Add sys_wakeup01
Petr Vorel <[email protected]>
| Newsgroups | gmane.linux.ltp |
|---|---|
| Message-ID | <20260820191223.GA511766@pevik> |
Hi Cyril, > A test for /sys/class/wakeup/*/* files. > +++ b/testcases/kernel/sysfs/class/wakeup/sys_wakeup01.c > @@ -0,0 +1,118 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (c) 2026 Cyril Hrubis <[email protected]> > + */ > + > +/*\ > + * Sanity checks for the wakeup source statistics exported under > + * /sys/class/wakeup/wakeupN/. > + * > + * For every wakeup source the test verifies that: > + * > + * - name is a non-empty string > + * - active_count, active_time_ms, event_count, expire_count, last_change_ms, > + * max_time_ms, prevent_suspend_time_ms, total_time_ms and wakeup_count are > + * all non-negative > + * - active_time_ms <= total_time_ms (currently active time is part of the > + * accumulated total) > + * - max_time_ms <= total_time_ms (the longest single event cannot exceed the > + * accumulated total) > + * > + * The test skips with TCONF when no wakeup source is present. > + */ > + > +#include <string.h> > +#include <limits.h> > +#include <dirent.h> > +#include "tst_test.h" > +#include "tst_sysfs_assert.h" > + > +#define WAKEUP "/sys/class/wakeup" FYI some archs does not have wake up support therefore it does not have /sys/class/wakeup directory, e.g. s390x. ... > +static void do_test(void) > +{ > + DIR *d; > + struct dirent *ent; > + int found = 0; > + > + d = SAFE_OPENDIR(WAKEUP); Therefore this fails: sys_wakeup01.c:100: TBROK: opendir(/sys/class/wakeup) failed: ENOENT (2) I believe we need CONFIG_PM_SLEEP=y kconfig check. drivers/base/power/wakeup_stats.c creates that directory in __init wakeup_sources_sysfs_init(), and that source is guarded by CONFIG_PM_SLEEP=y, which depends on CONFIG_SUSPEND=y. > + > + while ((ent = SAFE_READDIR(d))) { > + if (strncmp(ent->d_name, "wakeup", 6)) > + continue; > + > + found = 1; > + check_wakeup(ent->d_name); > + } > + > + SAFE_CLOSEDIR(d); > + > + if (!found) > + tst_res(TCONF, "No wakeup source found"); This TCONF is also valid, but too late. There are similar failures in other tests, I guess I'll post you CI links. Kind regards, Petr > +} > + > +static struct tst_test test = { > + .test_all = do_test, > +}; -- Mailing list info: https://lists.linux.it/listinfo/ltp