From: lufei <lufei@uniontech.com>
To: ltp@lists.linux.it
Cc: lufei <lufei@uniontech.com>
Subject: [LTP] [PATCH 2/2] Rewrite ftrace_regression02.sh with new C API
Date: Wed, 4 Mar 2026 16:05:39 +0800 [thread overview]
Message-ID: <20260304080538.1793-2-lufei@uniontech.com> (raw)
In-Reply-To: <20260304080538.1793-1-lufei@uniontech.com>
This test is for checking signal:signal_generate gives 2 more fields:
grp res.
Signed-off-by: lufei <lufei@uniontech.com>
---
.../tracing/ftrace_test/ftrace_regression02.c | 73 +++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_regression02.c
diff --git a/testcases/kernel/tracing/ftrace_test/ftrace_regression02.c b/testcases/kernel/tracing/ftrace_test/ftrace_regression02.c
new file mode 100644
index 000000000..aa3500090
--- /dev/null
+++ b/testcases/kernel/tracing/ftrace_test/ftrace_regression02.c
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2015 Red Hat Inc.
+ * Copyright (c) 2026 lufei <lufei@uniontech.com>
+ */
+
+/*\
+ *
+ * Check signal:signal_generate gives 2 more fields: grp res
+ *
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include "ftrace_regression.h"
+
+#define DEBUGFS_DIR "debugfs"
+#define SET_EVENT DEBUGFS_DIR "/tracing/set_event"
+#define TRACING_ON DEBUGFS_DIR "/tracing/tracing_on"
+#define TRACE_FILE DEBUGFS_DIR "/tracing/trace"
+
+#define LOOP 100
+
+static void setup(void)
+{
+ SAFE_MKDIR(DEBUGFS_DIR, 0755);
+ SAFE_MOUNT(NULL, DEBUGFS_DIR, "debugfs", 0, NULL);
+}
+
+static void run(void)
+{
+ int i;
+
+ SAFE_FILE_PRINTF(SET_EVENT, "signal:signal_generate");
+ SAFE_FILE_PRINTF(TRACING_ON, "1");
+ SAFE_FILE_PRINTF(TRACE_FILE, "\n");
+
+ for (i = 0; i < LOOP; i++)
+ tst_cmd((const char *[]){"ls", "-l", "/proc", NULL},
+ "/dev/null", "/dev/null", 0);
+
+ if (file_contains(TRACE_FILE, "grp=") && file_contains(TRACE_FILE, "res="))
+ tst_res(TPASS, "Finished running the test");
+ else
+ tst_res(TFAIL, "Pattern grp=[0-9] res=[0-9] not found in trace");
+}
+
+static void cleanup(void)
+{
+ SAFE_UMOUNT(DEBUGFS_DIR);
+}
+
+static struct tst_test test = {
+ .needs_root = 1,
+ .needs_tmpdir = 1,
+ .setup = setup,
+ .test_all = run,
+ .cleanup = cleanup,
+ .needs_cmds = (struct tst_cmd[]) {
+ {.cmd = "ls"},
+ {}
+ },
+ .save_restore = (const struct tst_path_val[]) {
+ {"/proc/sys/kernel/stack_tracer_enabled", NULL, TST_SR_TCONF},
+ {}
+ },
+ .tags = (const struct tst_tag[]) {
+ {"linux-git", "6c303d3"},
+ {"linux-git", "163566f"},
+ {}
+ },
+};
+
--
2.39.3
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-03-04 8:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 8:05 [LTP] [PATCH 1/2] Rewrite ftrace_regression01.sh with new C API lufei
2026-03-04 8:05 ` lufei [this message]
2026-03-27 10:34 ` Andrea Cervesato via ltp
2026-03-30 7:15 ` [LTP] [PATCH v2] Rewrite ftrace_regression tests " lufei
2026-03-30 8:39 ` Andrea Cervesato via ltp
2026-03-31 1:55 ` [LTP] [PATCH v3] " lufei
2026-03-31 7:53 ` Petr Vorel
2026-03-31 7:56 ` Petr Vorel
2026-03-31 18:28 ` Cyril Hrubis
2026-03-31 10:01 ` [LTP] [PATCH v4] " lufei
2026-04-24 2:08 ` [LTP] [PATCH v5] " lufei
2026-04-24 2:42 ` [LTP] " linuxtestproject.agent
2026-04-27 8:40 ` [LTP] [PATCH v5] " Li Wang
2026-04-28 7:33 ` Cyril Hrubis
2026-04-28 7:50 ` [LTP] [PATCH v6] " lufei
2026-04-28 9:30 ` [LTP] " linuxtestproject.agent
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=20260304080538.1793-2-lufei@uniontech.com \
--to=lufei@uniontech.com \
--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.