All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 16/31] testcases: sysfs: Add sys_wakeup01
Date: Thu, 20 Aug 2026 21:12:23 +0200	[thread overview]
Message-ID: <20260820191223.GA511766@pevik> (raw)
In-Reply-To: <20260819161634.1341577-17-chrubis@suse.cz>

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 <chrubis@suse.cz>
> + */
> +
> +/*\
> + * 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

  reply	other threads:[~2026-08-20 19:12 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 16:16 [LTP] [PATCH v1 00/31] Add sysfs sanity tests Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 01/31] lib: Add tst_sysfs_assert Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 02/31] testcases: sysfs: Add sys_power01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 03/31] testcases: sysfs: Add sys_kernel01 Cyril Hrubis
2026-08-20  7:58   ` [LTP] lib: Add tst_sysfs_assert linuxtestproject.agent
2026-08-19 16:16 ` [LTP] [PATCH v2 04/31] testcases: sysfs: Add sys_clocksource01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 05/31] testcases: sysfs: Add sys_node01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 06/31] testcases: sysfs: Add sys_cpu_topology01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 07/31] testcases: sysfs: Add sys_cpu_topology02 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 08/31] testcases: sysfs: Add sys_cpu_vulnerabilities01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 09/31] testcases: sysfs: Add sys_cpu_smt01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 10/31] testcases: sysfs: Add sys_cpu_cache01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 11/31] testcases: sysfs: Add sys_clockevents01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 12/31] testcases: sysfs: Add sys_ata01 Cyril Hrubis
2026-08-20 15:57   ` Petr Vorel
2026-08-20 16:21     ` Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 13/31] testcases: sysfs: Add sys_bdi01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 14/31] testcases: sysfs: sys_hwmon01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 15/31] testcases: sysfs: sys_leds01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 16/31] testcases: sysfs: Add sys_wakeup01 Cyril Hrubis
2026-08-20 19:12   ` Petr Vorel [this message]
2026-08-19 16:16 ` [LTP] [PATCH v2 17/31] testcases: sysfs: Add sys_rtc01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 18/31] testcases: sysfs: Add sys_thermal01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 19/31] tst_netdevice: Add two more helper macros Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 20/31] testcases: sysfs: Add sys_net01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 21/31] testcases: sysfs: Add sys_net02 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 22/31] testcases: sysfs: Add sys_net03 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 23/31] testcases: sysfs: Add sys_net04 Cyril Hrubis
2026-08-19 20:20   ` Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 24/31] testcases: sysfs: Add sys_block_loop01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 25/31] testcases: sysfs: Add sys_block_queue01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 26/31] testcases: sysfs: Add sys_block_size01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 27/31] testcases: sysfs: Add sys_hugepages01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 28/31] testcases: sysfs: Add sys_hugepages02 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 29/31] testcases: sysfs: Add sys_ksm01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 30/31] testcases: sysfs: Add sys_swap01 Cyril Hrubis
2026-08-19 16:16 ` [LTP] [PATCH v2 31/31] testcases: sysfs: Add sys_thp01 Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260820191223.GA511766@pevik \
    --to=pvorel@suse.cz \
    --cc=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.