mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
tracetool: add test suite for tracetool with reference output
When reviewing tracetool patches it is often very unclear what the expected output will be for the generated backends. Compounding this is that a default build will only enable the 'log' trace backend, so developers won't see generated code for other backends without making a special effort. Some backends are also platform specific, so can't be enabled in QEMU builds, even though tracetool could generate the code. To address this, introduce a test suite for tracetool which is conceptually similar to the qapi-schema test. It is a simple python program that runs tracetool and compares the actual output to historical reference output kept in git. The test directly emits TAP format logs for ease of integration with meson. This can be run with make check-tracetool to make it easier for developers changing generated output, the sample expected content can be auto-recreated QEMU_TEST_REGENERATE=1 make check-tracetool and the changes reviewed and added to the commit. This will also assist reviewers interpreting the change. Developers are reminded of this in the test output on failure: $ make check-tracetool 1/6 qemu:tracetool / dtrace OK 0.14s 2/6 qemu:tracetool / ftrace FAIL 0.06s exit status 1 ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 1..2 ok 1 - ftrace.c # not ok 1 - ftrace.h (set QEMU_TEST_REGENERATE=1 to recreate reference output if tracetool generator was intentionally changed) ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 3/6 qemu:tracetool / log OK 0.06s 4/6 qemu:tracetool / simple OK 0.06s 5/6 qemu:tracetool / syslog OK 0.06s 6/6 qemu:tracetool / ust OK 0.11s Summary of Failures: 2/6 qemu:tracetool / ftrace FAIL 0.06s exit status 1 Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20250916081638.764020-6-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
committed by
Stefan Hajnoczi
parent
52d1ec2929
commit
da949d495d
@@ -3562,6 +3562,7 @@ F: scripts/tracetool/
|
||||
F: scripts/qemu-trace-stap*
|
||||
F: docs/tools/qemu-trace-stap.rst
|
||||
F: docs/devel/tracing.rst
|
||||
F: tests/tracetool/
|
||||
T: git https://github.com/stefanha/qemu.git tracing
|
||||
|
||||
Simpletrace
|
||||
|
||||
@@ -178,6 +178,34 @@ parser (either fixing a bug or extending/modifying the syntax). To do this:
|
||||
|
||||
``qapi-schema += foo.json``
|
||||
|
||||
.. _tracetool-tests:
|
||||
|
||||
Tracetool tests
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
The tracetool tests validate the generated source files used for defining
|
||||
probes for various tracing backends and source formats. The test operates
|
||||
by running the tracetool program against a sample trace-events file, and
|
||||
comparing the generated output against known good reference output. The
|
||||
tests can be run with:
|
||||
|
||||
.. code::
|
||||
|
||||
make check-tracetool
|
||||
|
||||
The reference output is stored in files under tests/tracetool, and when
|
||||
the tracetool backend/format output is intentionally changed, the reference
|
||||
files need to be updated. This can be automated by setting the
|
||||
QEMU_TEST_REGENERATE=1 environment variable:
|
||||
|
||||
.. code::
|
||||
|
||||
QEMU_TEST_REGENERATE=1 make check-tracetool
|
||||
|
||||
The resulting changes must be reviewed by the author to ensure they match
|
||||
the intended results, before adding the updated reference output to the
|
||||
same commit that alters the generator code.
|
||||
|
||||
check-block
|
||||
~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ check-help:
|
||||
@echo " $(MAKE) check-functional-TARGET Run functional tests for a given target"
|
||||
@echo " $(MAKE) check-unit Run qobject tests"
|
||||
@echo " $(MAKE) check-qapi-schema Run QAPI schema tests"
|
||||
@echo " $(MAKE) check-tracetool Run tracetool generator tests"
|
||||
@echo " $(MAKE) check-block Run block tests"
|
||||
ifneq ($(filter $(all-check-targets), check-softfloat),)
|
||||
@echo " $(MAKE) check-tcg Run TCG tests"
|
||||
|
||||
@@ -88,3 +88,4 @@ subdir('qapi-schema')
|
||||
subdir('qtest')
|
||||
subdir('migration-stress')
|
||||
subdir('functional')
|
||||
subdir('tracetool')
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/* 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"
|
||||
|
||||
uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
TraceEvent _TRACE_TEST_BLAH_EVENT = {
|
||||
.id = 0,
|
||||
.name = "test_blah",
|
||||
.sstate = TRACE_TEST_BLAH_ENABLED,
|
||||
.dstate = &_TRACE_TEST_BLAH_DSTATE
|
||||
};
|
||||
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
|
||||
.id = 0,
|
||||
.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)
|
||||
@@ -0,0 +1,10 @@
|
||||
/* This file is autogenerated by tracetool, do not edit. */
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
provider qemu {
|
||||
|
||||
probe test_blah(void * context,const char * filename);
|
||||
|
||||
probe test_wibble(void * context,int value);
|
||||
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
/* 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 uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
#define TRACE_TEST_BLAH_ENABLED 1
|
||||
#define TRACE_TEST_WIBBLE_ENABLED 1
|
||||
#ifndef SDT_USE_VARIADIC
|
||||
#define SDT_USE_VARIADIC 1
|
||||
#endif
|
||||
#include "trace-dtrace-testsuite.h"
|
||||
|
||||
#undef SDT_USE_VARIADIC
|
||||
#ifndef QEMU_TEST_BLAH_ENABLED
|
||||
#define QEMU_TEST_BLAH_ENABLED() true
|
||||
#endif
|
||||
#ifndef QEMU_TEST_WIBBLE_ENABLED
|
||||
#define QEMU_TEST_WIBBLE_ENABLED() true
|
||||
#endif
|
||||
|
||||
#define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
|
||||
QEMU_TEST_BLAH_ENABLED() || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
QEMU_TEST_BLAH(context, filename);
|
||||
}
|
||||
|
||||
static inline void trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_blah(context, filename);
|
||||
}
|
||||
}
|
||||
|
||||
#define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
|
||||
QEMU_TEST_WIBBLE_ENABLED() || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_wibble(void *context, int value)
|
||||
{
|
||||
QEMU_TEST_WIBBLE(context, value);
|
||||
}
|
||||
|
||||
static inline void trace_test_wibble(void *context, int value)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_wibble(context, value);
|
||||
}
|
||||
}
|
||||
#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
|
||||
@@ -0,0 +1,15 @@
|
||||
/* This file is autogenerated by tracetool, do not edit. */
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
probe qemu.log.test_blah = qemu.test_blah ?
|
||||
{
|
||||
try {
|
||||
argfilename_str = filename ? user_string_n(filename, 512) : "<null>"
|
||||
} catch {}
|
||||
printf("%d@%d test_blah Blah context=%p filename=%s\n", pid(), gettimeofday_ns(), context, argfilename_str)
|
||||
}
|
||||
probe qemu.log.test_wibble = qemu.test_wibble ?
|
||||
{
|
||||
printf("%d@%d test_wibble Wibble context=%p value=%d\n", pid(), gettimeofday_ns(), context, value)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/* This file is autogenerated by tracetool, do not edit. */
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
probe qemu.simpletrace.test_blah = qemu.test_blah ?
|
||||
{
|
||||
try {
|
||||
argfilename_str = filename ? user_string_n(filename, 512) : "<null>"
|
||||
} catch {}
|
||||
argfilename_len = strlen(argfilename_str)
|
||||
printf("%8b%8b%8b%4b%4b%8b%4b%.*s", 1, 0, gettimeofday_ns(), 24 + 8 + 4 + argfilename_len, pid(), context, argfilename_len, argfilename_len, argfilename_str)
|
||||
}
|
||||
probe qemu.simpletrace.test_wibble = qemu.test_wibble ?
|
||||
{
|
||||
printf("%8b%8b%8b%4b%4b%8b%8b", 1, 1, gettimeofday_ns(), 24 + 8 + 8, pid(), context, value)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/* This file is autogenerated by tracetool, do not edit. */
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
probe qemu.test_blah = process("qemu").mark("test_blah")
|
||||
{
|
||||
context = $arg1;
|
||||
filename = $arg2;
|
||||
}
|
||||
probe qemu.test_wibble = process("qemu").mark("test_wibble")
|
||||
{
|
||||
context = $arg1;
|
||||
value = $arg2;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/* 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"
|
||||
|
||||
uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
TraceEvent _TRACE_TEST_BLAH_EVENT = {
|
||||
.id = 0,
|
||||
.name = "test_blah",
|
||||
.sstate = TRACE_TEST_BLAH_ENABLED,
|
||||
.dstate = &_TRACE_TEST_BLAH_DSTATE
|
||||
};
|
||||
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
|
||||
.id = 0,
|
||||
.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)
|
||||
@@ -0,0 +1,73 @@
|
||||
/* 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 uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
#define TRACE_TEST_BLAH_ENABLED 1
|
||||
#define TRACE_TEST_WIBBLE_ENABLED 1
|
||||
#include "trace/ftrace.h"
|
||||
|
||||
|
||||
#define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
|
||||
trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
{
|
||||
char ftrace_buf[MAX_TRACE_STRLEN];
|
||||
int unused __attribute__ ((unused));
|
||||
int trlen;
|
||||
if (trace_event_get_state(TRACE_TEST_BLAH)) {
|
||||
#line 4 "trace-events"
|
||||
trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,
|
||||
"test_blah " "Blah context=%p filename=%s" "\n" , context, filename);
|
||||
#line 33 "ftrace.h"
|
||||
trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);
|
||||
unused = write(trace_marker_fd, ftrace_buf, trlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_blah(context, filename);
|
||||
}
|
||||
}
|
||||
|
||||
#define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
|
||||
trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_wibble(void *context, int value)
|
||||
{
|
||||
{
|
||||
char ftrace_buf[MAX_TRACE_STRLEN];
|
||||
int unused __attribute__ ((unused));
|
||||
int trlen;
|
||||
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
|
||||
#line 5 "trace-events"
|
||||
trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,
|
||||
"test_wibble " "Wibble context=%p value=%d" "\n" , context, value);
|
||||
#line 61 "ftrace.h"
|
||||
trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);
|
||||
unused = write(trace_marker_fd, ftrace_buf, trlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void trace_test_wibble(void *context, int value)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_wibble(context, value);
|
||||
}
|
||||
}
|
||||
#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
|
||||
@@ -0,0 +1,32 @@
|
||||
/* 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"
|
||||
|
||||
uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
TraceEvent _TRACE_TEST_BLAH_EVENT = {
|
||||
.id = 0,
|
||||
.name = "test_blah",
|
||||
.sstate = TRACE_TEST_BLAH_ENABLED,
|
||||
.dstate = &_TRACE_TEST_BLAH_DSTATE
|
||||
};
|
||||
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
|
||||
.id = 0,
|
||||
.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)
|
||||
@@ -0,0 +1,57 @@
|
||||
/* 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 uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
#define TRACE_TEST_BLAH_ENABLED 1
|
||||
#define TRACE_TEST_WIBBLE_ENABLED 1
|
||||
#include "qemu/log-for-trace.h"
|
||||
|
||||
|
||||
#define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
|
||||
trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
if (trace_event_get_state(TRACE_TEST_BLAH) && qemu_loglevel_mask(LOG_TRACE)) {
|
||||
#line 4 "trace-events"
|
||||
qemu_log("test_blah " "Blah context=%p filename=%s" "\n", context, filename);
|
||||
#line 28 "log.h"
|
||||
}
|
||||
}
|
||||
|
||||
static inline void trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_blah(context, filename);
|
||||
}
|
||||
}
|
||||
|
||||
#define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
|
||||
trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_wibble(void *context, int value)
|
||||
{
|
||||
if (trace_event_get_state(TRACE_TEST_WIBBLE) && qemu_loglevel_mask(LOG_TRACE)) {
|
||||
#line 5 "trace-events"
|
||||
qemu_log("test_wibble " "Wibble context=%p value=%d" "\n", context, value);
|
||||
#line 48 "log.h"
|
||||
}
|
||||
}
|
||||
|
||||
static inline void trace_test_wibble(void *context, int value)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_wibble(context, value);
|
||||
}
|
||||
}
|
||||
#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
|
||||
@@ -0,0 +1,28 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
test_env = environment()
|
||||
test_env.set('PYTHONPATH', meson.project_source_root() / 'scripts')
|
||||
test_env.set('PYTHONIOENCODING', 'utf-8')
|
||||
|
||||
backends = [
|
||||
'dtrace',
|
||||
'ftrace',
|
||||
'log',
|
||||
'simple',
|
||||
'syslog',
|
||||
'ust'
|
||||
]
|
||||
|
||||
# The tracetool-test.py program has portability problems on Windows.
|
||||
if host_machine.system() != 'windows'
|
||||
foreach backend: backends
|
||||
test(backend,
|
||||
python,
|
||||
args: [meson.current_source_dir() / 'tracetool-test.py',
|
||||
meson.project_source_root() / 'scripts' / 'tracetool.py',
|
||||
backend,
|
||||
meson.current_source_dir(),
|
||||
meson.current_build_dir()],
|
||||
suite: ['tracetool'])
|
||||
endforeach
|
||||
endif
|
||||
@@ -0,0 +1,61 @@
|
||||
/* 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"
|
||||
|
||||
uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
TraceEvent _TRACE_TEST_BLAH_EVENT = {
|
||||
.id = 0,
|
||||
.name = "test_blah",
|
||||
.sstate = TRACE_TEST_BLAH_ENABLED,
|
||||
.dstate = &_TRACE_TEST_BLAH_DSTATE
|
||||
};
|
||||
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
|
||||
.id = 0,
|
||||
.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)
|
||||
#include "qemu/osdep.h"
|
||||
#include "trace/control.h"
|
||||
#include "trace/simple.h"
|
||||
|
||||
void _simple_trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
TraceBufferRecord rec;
|
||||
size_t argfilename_len = filename ? MIN(strlen(filename), MAX_TRACE_STRLEN) : 0;
|
||||
|
||||
if (trace_record_start(&rec, _TRACE_TEST_BLAH_EVENT.id, 8 + 4 + argfilename_len)) {
|
||||
return; /* Trace Buffer Full, Event Dropped ! */
|
||||
}
|
||||
trace_record_write_u64(&rec, (uintptr_t)(uint64_t *)context);
|
||||
trace_record_write_str(&rec, filename, argfilename_len);
|
||||
trace_record_finish(&rec);
|
||||
}
|
||||
|
||||
void _simple_trace_test_wibble(void *context, int value)
|
||||
{
|
||||
TraceBufferRecord rec;
|
||||
|
||||
if (trace_record_start(&rec, _TRACE_TEST_WIBBLE_EVENT.id, 8 + 8)) {
|
||||
return; /* Trace Buffer Full, Event Dropped ! */
|
||||
}
|
||||
trace_record_write_u64(&rec, (uintptr_t)(uint64_t *)context);
|
||||
trace_record_write_u64(&rec, (uint64_t)value);
|
||||
trace_record_finish(&rec);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/* 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 uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
#define TRACE_TEST_BLAH_ENABLED 1
|
||||
#define TRACE_TEST_WIBBLE_ENABLED 1
|
||||
void _simple_trace_test_blah(void *context, const char *filename);
|
||||
void _simple_trace_test_wibble(void *context, int value);
|
||||
|
||||
|
||||
#define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
|
||||
trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
if (trace_event_get_state(TRACE_TEST_BLAH)) {
|
||||
_simple_trace_test_blah(context, filename);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_blah(context, filename);
|
||||
}
|
||||
}
|
||||
|
||||
#define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
|
||||
trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_wibble(void *context, int value)
|
||||
{
|
||||
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
|
||||
_simple_trace_test_wibble(context, value);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void trace_test_wibble(void *context, int value)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_wibble(context, value);
|
||||
}
|
||||
}
|
||||
#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
|
||||
@@ -0,0 +1,32 @@
|
||||
/* 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"
|
||||
|
||||
uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
TraceEvent _TRACE_TEST_BLAH_EVENT = {
|
||||
.id = 0,
|
||||
.name = "test_blah",
|
||||
.sstate = TRACE_TEST_BLAH_ENABLED,
|
||||
.dstate = &_TRACE_TEST_BLAH_DSTATE
|
||||
};
|
||||
TraceEvent _TRACE_TEST_WIBBLE_EVENT = {
|
||||
.id = 0,
|
||||
.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)
|
||||
@@ -0,0 +1,57 @@
|
||||
/* 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 uint16_t _TRACE_TEST_BLAH_DSTATE;
|
||||
extern uint16_t _TRACE_TEST_WIBBLE_DSTATE;
|
||||
#define TRACE_TEST_BLAH_ENABLED 1
|
||||
#define TRACE_TEST_WIBBLE_ENABLED 1
|
||||
#include <syslog.h>
|
||||
|
||||
|
||||
#define TRACE_TEST_BLAH_BACKEND_DSTATE() ( \
|
||||
trace_event_get_state_dynamic_by_id(TRACE_TEST_BLAH) || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
if (trace_event_get_state(TRACE_TEST_BLAH)) {
|
||||
#line 4 "trace-events"
|
||||
syslog(LOG_INFO, "test_blah " "Blah context=%p filename=%s" , context, filename);
|
||||
#line 28 "syslog.h"
|
||||
}
|
||||
}
|
||||
|
||||
static inline void trace_test_blah(void *context, const char *filename)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_blah(context, filename);
|
||||
}
|
||||
}
|
||||
|
||||
#define TRACE_TEST_WIBBLE_BACKEND_DSTATE() ( \
|
||||
trace_event_get_state_dynamic_by_id(TRACE_TEST_WIBBLE) || \
|
||||
false)
|
||||
|
||||
static inline void _nocheck__trace_test_wibble(void *context, int value)
|
||||
{
|
||||
if (trace_event_get_state(TRACE_TEST_WIBBLE)) {
|
||||
#line 5 "trace-events"
|
||||
syslog(LOG_INFO, "test_wibble " "Wibble context=%p value=%d" , context, value);
|
||||
#line 48 "syslog.h"
|
||||
}
|
||||
}
|
||||
|
||||
static inline void trace_test_wibble(void *context, int value)
|
||||
{
|
||||
if (true) {
|
||||
_nocheck__trace_test_wibble(context, value);
|
||||
}
|
||||
}
|
||||
#endif /* TRACE_TESTSUITE_GENERATED_TRACERS_H */
|
||||
@@ -0,0 +1,5 @@
|
||||
# See docs/devel/tracing.rst for syntax documentation.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
test_blah(void *context, const char *filename) "Blah context=%p filename=%s"
|
||||
test_wibble(void *context, int value) "Wibble context=%p value=%d"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user