[DTrace-devel] [PATCH] test: Fix tst.symbols.c
eugene.loh at oracle.com
eugene.loh at oracle.com
Tue Jan 11 21:33:10 UTC 2022
From: Eugene Loh <eugene.loh at oracle.com>
Skip symbols (e.g., ftrace_trampoline) in module __builtin__ftrace
since we cannot load the module ELF.
Fix the check for duplicate symbols in the "lookup by name" test.
Specifically, we were checking for duplicates when dtrace_lookup_by_name()
failed. Check for duplicates when that function succeeds. This fix
is necessitated by commit 8151fb85 "htab reduction: symtab", which
makes it hard for us to know which duplicate will be chosen.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
test/unittest/consumer/tst.symbols.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/test/unittest/consumer/tst.symbols.c b/test/unittest/consumer/tst.symbols.c
index f6d8d5da..a451a941 100644
--- a/test/unittest/consumer/tst.symbols.c
+++ b/test/unittest/consumer/tst.symbols.c
@@ -110,6 +110,9 @@ int read_symbols() {
if (strcmp(modname, "bpf]") == 0)
continue;
+ if (strcmp(modname, "__builtin__ftrace]") == 0)
+ continue;
+
/*
* In libdtrace/dt_module.c function dt_modsym_update(),
* we skip a number of symbols. Do not test them. The
@@ -284,19 +287,10 @@ int check_lookup_by_name(dtrace_hdl_t *h, int specify_module) {
specify_module ? " and module" : "");
for (i = 0; i < nsymbols; i++) {
nchecks++;
+
if (dtrace_lookup_by_name(h,
specify_module ? symbols[i].modname : DTRACE_OBJ_KMODS,
symbols[i].symname, &sym, &si)) {
-
- /*
- * If the module has another symbol with this name,
- * it is okay that the lookup failed.
- */
- if (duplicate(i) >= 0) {
- n_dupl++;
- continue;
- }
-
printf("ERROR: dtrace_lookup_by_name failed\n");
printf(" expect:");
print_symbol(i);
@@ -308,6 +302,11 @@ int check_lookup_by_name(dtrace_hdl_t *h, int specify_module) {
strcmp(symbols[i].symname, si.name) ||
strcmp(symbols[i].modname, si.object)) {
+ if (duplicate(i) >= 0) {
+ n_dupl++;
+ continue;
+ }
+
printf("ERROR: mismatch\n");
printf(" expect:");
print_symbol(i);
--
2.18.4
More information about the DTrace-devel
mailing list