[DTrace-devel] [PATCH 1/2] Fix compilation problems in C tests
eugene.loh at oracle.com
eugene.loh at oracle.com
Tue Oct 5 14:20:18 PDT 2021
From: Eugene Loh <eugene.loh at oracle.com>
The tests that are C source files are not compiling. Fix those
errors, including:
- augmenting test_incflags in runtest.sh
(and improving readability while we are at it)
- remove xfail for some tests
- update names of dtrace_syminfo_t members
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
runtest.sh | 11 +++++---
test/unittest/consumer/addr2str-null.c | 3 +--
.../consumer/tst.merge_ranges_bug25767469.c | 3 +--
test/unittest/consumer/tst.symbols.c | 26 +++++++++----------
4 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/runtest.sh b/runtest.sh
index a4dd21cf..1d62f838 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -8,7 +8,7 @@
# and generated intermediate representation.
#
# Oracle Linux DTrace.
-# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.
@@ -522,7 +522,7 @@ if [[ -z $USE_INSTALLED ]]; then
dtrace="$(pwd)/build*/dtrace"
test_libdir="$(pwd)/build/dlibs"
test_ldflags="-L$(pwd)/build"
- test_incflags="-Iuts/common -DARCH_$arch"
+ test_incflags="-Iinclude -Iuts/common -Ibuild -Ilibdtrace -DARCH_$arch"
if [[ -z $(eval echo $dtrace) ]]; then
echo "No dtraces available." >&2
@@ -1139,8 +1139,11 @@ for dt in $dtrace; do
fi
CC="${CC:-gcc}"
- log "Compiling $CC -std=gnu99 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $test_incflags $CFLAGS $test_ldflags $LDFLAGS -o $tmpdir/$base $_test $link\n"
- if ! $CC $CFLAGS -std=gnu99 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $test_incflags $test_ldflags $LDFLAGS -o $tmpdir/$(basename $base) $_test $link >/dev/null 2>$tmpdir/cc.err; then
+ CCline="$CC $CFLAGS -std=gnu99 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
+ CCline="$CCline $test_incflags $test_ldflags $LDFLAGS"
+ CCline="$CCline -o $tmpdir/$(basename $base) $_test $link"
+ log "Compiling $CCline\n"
+ if ! $CCline >/dev/null 2>$tmpdir/cc.err; then
fail=t
failmsg="compilation failure"
fail "$xfail" "$xfailmsg" "compilation failure"
diff --git a/test/unittest/consumer/addr2str-null.c b/test/unittest/consumer/addr2str-null.c
index c88d261e..62a30da2 100644
--- a/test/unittest/consumer/addr2str-null.c
+++ b/test/unittest/consumer/addr2str-null.c
@@ -1,10 +1,9 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
-/* @@xfail: dtv2 */
/*
* Verify that a dtrace_addr2str() of the null pointer does not
diff --git a/test/unittest/consumer/tst.merge_ranges_bug25767469.c b/test/unittest/consumer/tst.merge_ranges_bug25767469.c
index 6773a697..2d73e15a 100644
--- a/test/unittest/consumer/tst.merge_ranges_bug25767469.c
+++ b/test/unittest/consumer/tst.merge_ranges_bug25767469.c
@@ -1,10 +1,9 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
-/* @@xfail: dtv2 */
/*
* 25767469 dtrace_update() does not merge address ranges properly
diff --git a/test/unittest/consumer/tst.symbols.c b/test/unittest/consumer/tst.symbols.c
index b8991e01..d1ece5c7 100644
--- a/test/unittest/consumer/tst.symbols.c
+++ b/test/unittest/consumer/tst.symbols.c
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -195,8 +195,8 @@ void match_at_addr(int i, GElf_Sym *symp, dtrace_syminfo_t *sip) {
printf(" actual: %16.16llx %8.8llx %32s %20s\n",
(long long)symp->st_value,
(long long)symp->st_size,
- sip->dts_name,
- sip->dts_object);
+ sip->name,
+ sip->object);
}
/*
@@ -205,19 +205,19 @@ void match_at_addr(int i, GElf_Sym *symp, dtrace_syminfo_t *sip) {
* some known symbol at this address.
*/
- if (strcmp(symbols[i].symname, sip->dts_name) == 0)
+ if (strcmp(symbols[i].symname, sip->name) == 0)
match = i;
j = i - 1;
while (match < 0 && j >= 0 && symbols[j].addr == symbols[i].addr) {
- if (strcmp(symbols[j].symname, sip->dts_name) == 0)
+ if (strcmp(symbols[j].symname, sip->name) == 0)
match = j;
j--;
}
j = i + 1;
while (match < 0 && j < nsymbols && symbols[j].addr == symbols[i].addr) {
- if (strcmp(symbols[j].symname, sip->dts_name) == 0)
+ if (strcmp(symbols[j].symname, sip->name) == 0)
match = j;
j++;
}
@@ -229,7 +229,7 @@ void match_at_addr(int i, GElf_Sym *symp, dtrace_syminfo_t *sip) {
if (match < 0 ||
symbols[match].size != symp->st_size ||
- strcmp(symbols[match].modname, sip->dts_object)) {
+ strcmp(symbols[match].modname, sip->object)) {
nerrors++;
printf("ERROR: no such reported symbol\n");
printf(" expect:");
@@ -237,8 +237,8 @@ void match_at_addr(int i, GElf_Sym *symp, dtrace_syminfo_t *sip) {
printf(" actual: %16.16llx %8.8llx %32s %20s\n",
(long long)symp->st_value,
(long long)symp->st_size,
- sip->dts_name,
- sip->dts_object);
+ sip->name,
+ sip->object);
}
}
@@ -305,8 +305,8 @@ int check_lookup_by_name(dtrace_hdl_t *h, int specify_module) {
if (symbols[i].addr != sym.st_value ||
symbols[i].size != sym.st_size ||
- strcmp(symbols[i].symname, si.dts_name) ||
- strcmp(symbols[i].modname, si.dts_object)) {
+ strcmp(symbols[i].symname, si.name) ||
+ strcmp(symbols[i].modname, si.object)) {
printf("ERROR: mismatch\n");
printf(" expect:");
@@ -314,8 +314,8 @@ int check_lookup_by_name(dtrace_hdl_t *h, int specify_module) {
printf(" actual: %16.16llx %8.8llx %32s %20s\n",
(long long)sym.st_value,
(long long)sym.st_size,
- si.dts_name,
- si.dts_object);
+ si.name,
+ si.object);
nerrors++;
}
}
--
2.18.4
More information about the DTrace-devel
mailing list