From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH 10/20] trace: add testing of 'nop' trace backend
Date: Thu, 1 Oct 2026 16:12:18 +0100 [thread overview]
Message-ID: <20261001151228.3373747-11-berrange@redhat.com> (raw)
In-Reply-To: <20261001151228.3373747-1-berrange@redhat.com>
This will be used to demonstrate that tracetool outputs the bare
minimum of code when tracing is disabled. Currently, as of this
initial commit of reference output, too much code is generated.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/tracetool/meson.build | 1 +
tests/tracetool/nop.c | 36 ++++++++++++++++++++++
tests/tracetool/nop.h | 29 ++++++++++++++++++
tests/tracetool/nop.rs | 51 +++++++++++++++++++++++++++++++
tests/tracetool/tracetool-test.py | 2 +-
5 files changed, 118 insertions(+), 1 deletion(-)
create mode 100644 tests/tracetool/nop.c
create mode 100644 tests/tracetool/nop.h
create mode 100644 tests/tracetool/nop.rs
diff --git a/tests/tracetool/meson.build b/tests/tracetool/meson.build
index 09bbaaa86bf..f4f583e6224 100644
--- a/tests/tracetool/meson.build
+++ b/tests/tracetool/meson.build
@@ -5,6 +5,7 @@ test_env.set('PYTHONPATH', meson.project_source_root() / 'scripts')
test_env.set('PYTHONIOENCODING', 'utf-8')
backends = [
+ 'nop',
'dtrace',
'ftrace',
'log',
diff --git a/tests/tracetool/nop.c b/tests/tracetool/nop.c
new file mode 100644
index 00000000000..f83d06252ea
--- /dev/null
+++ b/tests/tracetool/nop.c
@@ -0,0 +1,36 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qemu/module.h"
+#include "trace-testsuite.h"
+
+uint8_t _TRACE_TEST_BLAH_DSTATE;
+uint8_t _TRACE_TEST_WIBBLE_DSTATE;
+TraceEvent _TRACE_TEST_BLAH_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
+ .id = 0,
+#endif
+ .name = "test_blah",
+ .sstate = TRACE_TEST_BLAH_ENABLED,
+ .dstate = &_TRACE_TEST_BLAH_DSTATE
+};
+TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
+#ifdef CONFIG_TRACE_SIMPLE
+ .id = 0,
+#endif
+ .name = "test_wibble",
+ .sstate = TRACE_TEST_WIBBLE_ENABLED,
+ .dstate = &_TRACE_TEST_WIBBLE_DSTATE
+};
+TraceEvent *testsuite_trace_events[] = {
+ &_TRACE_TEST_BLAH_EVENT,
+ &_TRACE_TEST_WIBBLE_EVENT,
+ NULL,
+};
+
+static void trace_testsuite_register_events(void)
+{
+ trace_event_register_group(testsuite_trace_events);
+}
+trace_init(trace_testsuite_register_events)
diff --git a/tests/tracetool/nop.h b/tests/tracetool/nop.h
new file mode 100644
index 00000000000..443f5e0cf6e
--- /dev/null
+++ b/tests/tracetool/nop.h
@@ -0,0 +1,29 @@
+/* This file is autogenerated by tracetool, do not edit. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef TRACE_TESTSUITE_GENERATED_TRACERS_H
+#define TRACE_TESTSUITE_GENERATED_TRACERS_H
+
+#include "trace/control.h"
+
+extern TraceEvent _TRACE_TEST_BLAH_EVENT;
+extern TraceEvent _TRACE_TEST_WIBBLE_EVENT;
+extern uint8_t _TRACE_TEST_BLAH_DSTATE;
+extern uint8_t _TRACE_TEST_WIBBLE_DSTATE;
+#define TRACE_TEST_BLAH_ENABLED 1
+#define TRACE_TEST_WIBBLE_ENABLED 1
+
+#define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
+ false)
+
+static inline void trace_test_blah(void *context, const char *filename)
+{
+}
+
+#define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
+ false)
+
+static inline void trace_test_wibble(void *context, int value)
+{
+}
+#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
diff --git a/tests/tracetool/nop.rs b/tests/tracetool/nop.rs
new file mode 100644
index 00000000000..5f007cecd04
--- /dev/null
+++ b/tests/tracetool/nop.rs
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// This file is @generated by tracetool, do not edit.
+
+#[allow(unused_imports)]
+use std::ffi::c_char;
+#[allow(unused_imports)]
+use util::bindings;
+
+#[allow(dead_code)]
+#[inline(always)]
+fn trace_event_state_is_enabled(dstate: u8) -> bool {
+ (unsafe { trace_events_enabled_count }) != 0 && dstate != 0
+}
+
+extern "C" {
+ #[allow(dead_code)]
+ static mut trace_events_enabled_count: u32;
+}
+extern "C" {
+ #[allow(dead_code)]
+ static mut _TRACE_TEST_BLAH_DSTATE: u8;
+ #[allow(dead_code)]
+ static mut _TRACE_TEST_WIBBLE_DSTATE: u8;
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_blah_enabled() -> bool
+{
+ false
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_blah(_context: *mut (), _filename: &std::ffi::CStr)
+{
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_wibble_enabled() -> bool
+{
+ false
+}
+
+#[inline(always)]
+#[allow(dead_code)]
+pub fn trace_test_wibble(_context: *mut (), _value: std::ffi::c_int)
+{
+}
+
diff --git a/tests/tracetool/tracetool-test.py b/tests/tracetool/tracetool-test.py
index 59e9ab3d6ef..74f315a4629 100755
--- a/tests/tracetool/tracetool-test.py
+++ b/tests/tracetool/tracetool-test.py
@@ -14,7 +14,7 @@ def get_formats(backend):
"c",
"h",
]
- if backend in {"dtrace", "ftrace", "log", "simple", "syslog"}:
+ if backend in {"nop", "dtrace", "ftrace", "log", "simple", "syslog"}:
formats += ["rs"]
if backend == "dtrace":
formats += [
--
2.55.0
next prev parent reply other threads:[~2026-10-01 15:17 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 15:12 [PATCH 00/20] trace: bugfixes, cleanups and optimizations Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 01/20] osdep: add 'ignore_value(x)' macro Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 02/20] trace: use 'ignore_value()' instead of a dummy variable Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 03/20] trace: fix handling of char** in UST backend Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 04/20] hw/xen: replace "long unsigned int" with "unsigned long " for dtrace Daniel P. Berrangé
2026-10-01 17:56 ` Philippe Mathieu-Daudé
2026-10-01 15:12 ` [PATCH 05/20] trace: block use of "long int" " Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 06/20] trace: drop unused trace_event_set_state_dynamic_init() Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 07/20] trace: remove obsolete references to vcpu property Daniel P. Berrangé
2026-10-01 17:58 ` Philippe Mathieu-Daudé
2026-10-01 15:12 ` [PATCH 08/20] trace: drop 'id' from TraceEvent struct when not required Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 09/20] trace: change "DSTATE" variables from uint16_t to uint8_t Daniel P. Berrangé
2026-10-01 15:12 ` Daniel P. Berrangé [this message]
2026-10-01 15:12 ` [PATCH 11/20] trace: don't emit TraceEvent structs when 'nop' backend is used Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 12/20] trace: add test of generation with all backends enabled Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 13/20] trace: remove redundant headers from simple trace backend code Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 14/20] audio: remove mistaken use of trace_event_get_state() Daniel P. Berrangé
2026-10-01 18:00 ` Philippe Mathieu-Daudé
2026-10-01 19:14 ` marcandre.lureau
2026-10-02 7:12 ` Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 15/20] hw/ppc: " Daniel P. Berrangé
2026-10-01 18:01 ` Philippe Mathieu-Daudé
2026-10-01 15:12 ` [PATCH 16/20] trace: include qemu_loglevel_mask(LOG_TRACE) in guard Daniel P. Berrangé
2026-10-02 10:45 ` Paolo Bonzini
2026-10-02 11:03 ` Daniel P. Berrangé
2026-10-02 14:49 ` Paolo Bonzini
2026-10-05 12:08 ` Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 17/20] trace: remove "disable" property from trace files Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 18/20] trace: stop tracking static disabled state Daniel P. Berrangé
2026-10-01 19:14 ` marcandre.lureau
2026-10-02 9:22 ` Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 19/20] trace: remove parsing of "disable" event property Daniel P. Berrangé
2026-10-01 15:12 ` [PATCH 20/20] trace: remove 'trace_event_get_state' wrapper Daniel P. Berrangé
2026-10-01 19:14 ` [PATCH 00/20] trace: bugfixes, cleanups and optimizations marcandre.lureau
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=20261001151228.3373747-11-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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.