Skip to contentSkip to conversation

tests: add test for buggy deduplicator

PATCH In review Nick Alcock 3 participants 5 messages Jan 9, 2025 – Mar 18, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: add test for buggy deduplicator

Some early prototype deduplicators dedupped types in one dict (more or less) rather than putting conflicting types and module types into sub-dictionaries. Fail if the running kernel is such a kernel.

---
 dtrace.spec                  |  2 +-
 test/smoke/tst.ctf-intact.sh | 58 ++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100755 test/smoke/tst.ctf-intact.sh
dtrace.spec +1 -1
index 902ad7d8bb980..cf960f14b55c7 100644
@@ -151,7 +151,7 @@ Requires:     %{name}-devel = %{version}-%{release} perl gcc java
 Requires:     java-1.8.0-openjdk-devel perl-IO-Socket-IP xfsprogs
 Requires:     exportfs vim-minimal %{name}%{?_isa} = %{version}-%{release}
 Requires:     coreutils wireshark %{glibc32}
-Requires:     perf time bc nfs-utils
+Requires:     perf time bc nfs-utils binutils
 Autoreq:      0
 Group:	      Development/System
 
test/smoke/tst.ctf-intact.sh new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.47.1.279.g84c5f4e78e
#1 lore raw
Quoted 31 lines · Nick Alcock via DTrace-devel

Some early prototype deduplicators dedupped types in one dict (more or less) rather than putting conflicting types and module types into sub-dictionaries. Fail if the running kernel is such a kernel.

---
 dtrace.spec                  |  2 +-
 test/smoke/tst.ctf-intact.sh | 58 ++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100755 test/smoke/tst.ctf-intact.sh
dtrace.spec +1 -1
index 902ad7d8bb980..cf960f14b55c7 100644
@@ -151,7 +151,7 @@ Requires:     %{name}-devel = %{version}-%{release} perl gcc java
 Requires:     java-1.8.0-openjdk-devel perl-IO-Socket-IP xfsprogs
 Requires:     exportfs vim-minimal %{name}%{?_isa} = %{version}-%{release}
 Requires:     coreutils wireshark %{glibc32}
-Requires:     perf time bc nfs-utils
+Requires:     perf time bc nfs-utils binutils
 Autoreq:      0
 Group:	      Development/System
 
test/smoke/tst.ctf-intact.sh new file +1 -0
new file mode 100755
index 0000000000000..d737a2b162fcb
@@ -0,0 +1,58 @@
+#!/bin/bash

test/smoke/tst.ctf-intact.sh line 11

Quoted 10 lines
test/smoke/tst.ctf-intact.sh new file +10 -0
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2024, 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.
+#
+
+#
+# This script verifies that the CTF, if present, is non-corrupt: in
+# particular, that it has at least one child with 

... rest of the sentence is missing?

Quoted 55 lines
test/smoke/tst.ctf-intact.sh new file +47 -0
+#
+
+ctf="/lib/modules/$(uname -r)/kernel/vmlinux.ctfa"
+
+if [[ ! -f "$ctf" ]]; then
+    echo "CTF not found in expected location of $ctf" >&2
+    exit 67
+fi
+
+# If this is not an ELF file, turn it into one so objdump works.
+if ! [[ "$(file "$ctf")" =~ ELF ]]; then
+    objcopy --add-section=.ctf="$ctf" /bin/true $tmpdir/ctf
+    ctf=$tmpdir/ctf
+fi
+
+# Dump the CTF
+objdump --ctf --ctf-parent=shared_ctf "$ctf" 2>/dev/null | \
+    awk '
+BEGIN {
+    intypes=0;
+}
+
+/^  Strings:|^CTF archive member:/ {
+    intypes = 0;
+}
+# Scan for each member, capture its name.
+/^CTF archive member: / {
+    member=gensub (/CTF archive member: (.*):/,"\\1", "g");
+    next;
+}
+# See if any non-shared dicts have any types in.
+/^  Types:/ {
+    if (member != "shared_ctf") {
+        intypes=1;
+    }
+}
+/^    0x/ {
+    if (intypes) {
+        exit (0);
+    }
+}
+END {
+    if (!intypes) {
+        printf ("No non-shared-dict types found: probably buggy deduplicator.\n");
+        exit (1);
+    }
+}'
Signature · 7 lines
2.47.1.279.g84c5f4e78e


_______________________________________________
DTrace-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/dtrace-devel
#2 lore raw
In reply to Nick Alcock

This seems like a test that would belong in the kernel tree rather than in DTrace? It seems like a weird tst to have included in DTrace because if it fails, we cannot do anything about it in DTrace anyway.

I'd rather leave out tests that exercise things that are not DTrace itself.

Quoted 30 lines · Nick Alcock

Some early prototype deduplicators dedupped types in one dict (more or less) rather than putting conflicting types and module types into sub-dictionaries. Fail if the running kernel is such a kernel.

---
 dtrace.spec                  |  2 +-
 test/smoke/tst.ctf-intact.sh | 58 ++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100755 test/smoke/tst.ctf-intact.sh
dtrace.spec +1 -1
index 902ad7d8bb980..cf960f14b55c7 100644
@@ -151,7 +151,7 @@ Requires:     %{name}-devel = %{version}-%{release} perl gcc java
 Requires:     java-1.8.0-openjdk-devel perl-IO-Socket-IP xfsprogs
 Requires:     exportfs vim-minimal %{name}%{?_isa} = %{version}-%{release}
 Requires:     coreutils wireshark %{glibc32}
-Requires:     perf time bc nfs-utils
+Requires:     perf time bc nfs-utils binutils
 Autoreq:      0
 Group:	      Development/System
 
test/smoke/tst.ctf-intact.sh new file +0 -0
new file mode 100755
index 0000000000000..d737a2b162fcb

test/smoke/tst.ctf-intact.sh line 4

Quoted 4 lines
test/smoke/tst.ctf-intact.sh new file +4 -0
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.

2024 -> 2025

test/smoke/tst.ctf-intact.sh line 11

Quoted 7 lines
test/smoke/tst.ctf-intact.sh new file +7 -0
+# Licensed under the Universal Permissive License v 1.0 as shown at
+# http://oss.oracle.com/licenses/upl.
+#
+
+#
+# This script verifies that the CTF, if present, is non-corrupt: in
+# particular, that it has at least one child with 

The rest of the comment is missing?

Quoted 50 lines
test/smoke/tst.ctf-intact.sh new file +47 -0
+#
+
+ctf="/lib/modules/$(uname -r)/kernel/vmlinux.ctfa"
+
+if [[ ! -f "$ctf" ]]; then
+    echo "CTF not found in expected location of $ctf" >&2
+    exit 67
+fi
+
+# If this is not an ELF file, turn it into one so objdump works.
+if ! [[ "$(file "$ctf")" =~ ELF ]]; then
+    objcopy --add-section=.ctf="$ctf" /bin/true $tmpdir/ctf
+    ctf=$tmpdir/ctf
+fi
+
+# Dump the CTF
+objdump --ctf --ctf-parent=shared_ctf "$ctf" 2>/dev/null | \
+    awk '
+BEGIN {
+    intypes=0;
+}
+
+/^  Strings:|^CTF archive member:/ {
+    intypes = 0;
+}
+# Scan for each member, capture its name.
+/^CTF archive member: / {
+    member=gensub (/CTF archive member: (.*):/,"\\1", "g");
+    next;
+}
+# See if any non-shared dicts have any types in.
+/^  Types:/ {
+    if (member != "shared_ctf") {
+        intypes=1;
+    }
+}
+/^    0x/ {
+    if (intypes) {
+        exit (0);
+    }
+}
+END {
+    if (!intypes) {
+        printf ("No non-shared-dict types found: probably buggy deduplicator.\n");
+        exit (1);
+    }
+}'
Signature · 1 line
2.47.1.279.g84c5f4e78e
#3 lore raw

But if it is a dependency, it would be nice to know there is a problem.

Quoted 102 lines · Kris Van Hees

This seems like a test that would belong in the kernel tree rather than in DTrace? It seems like a weird tst to have included in DTrace because if it fails, we cannot do anything about it in DTrace anyway.

I'd rather leave out tests that exercise things that are not DTrace itself.

Quoted 30 lines · Nick Alcock

Some early prototype deduplicators dedupped types in one dict (more or less) rather than putting conflicting types and module types into sub-dictionaries. Fail if the running kernel is such a kernel.

---
  dtrace.spec                  |  2 +-
  test/smoke/tst.ctf-intact.sh | 58 ++++++++++++++++++++++++++++++++++++
  2 files changed, 59 insertions(+), 1 deletion(-)

create mode 100755 test/smoke/tst.ctf-intact.sh

dtrace.spec +1 -1
index 902ad7d8bb980..cf960f14b55c7 100644
@@ -151,7 +151,7 @@ Requires:     %{name}-devel = %{version}-%{release} perl gcc java
  Requires:     java-1.8.0-openjdk-devel perl-IO-Socket-IP xfsprogs
  Requires:     exportfs vim-minimal %{name}%{?_isa} = %{version}-%{release}
  Requires:     coreutils wireshark %{glibc32}
-Requires:     perf time bc nfs-utils
+Requires:     perf time bc nfs-utils binutils
  Autoreq:      0
  Group:	      Development/System
 
test/smoke/tst.ctf-intact.sh new file +0 -0
new file mode 100755
index 0000000000000..d737a2b162fcb

test/smoke/tst.ctf-intact.sh line 4

Quoted 4 lines
test/smoke/tst.ctf-intact.sh new file +4 -0
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.

2024 -> 2025

test/smoke/tst.ctf-intact.sh line 11

Quoted 7 lines
test/smoke/tst.ctf-intact.sh new file +7 -0
+# Licensed under the Universal Permissive License v 1.0 as shown at
+# http://oss.oracle.com/licenses/upl.
+#
+
+#
+# This script verifies that the CTF, if present, is non-corrupt: in
+# particular, that it has at least one child with

The rest of the comment is missing?

Quoted 50 lines
test/smoke/tst.ctf-intact.sh new file +47 -0
+#
+
+ctf="/lib/modules/$(uname -r)/kernel/vmlinux.ctfa"
+
+if [[ ! -f "$ctf" ]]; then
+    echo "CTF not found in expected location of $ctf" >&2
+    exit 67
+fi
+
+# If this is not an ELF file, turn it into one so objdump works.
+if ! [[ "$(file "$ctf")" =~ ELF ]]; then
+    objcopy --add-section=.ctf="$ctf" /bin/true $tmpdir/ctf
+    ctf=$tmpdir/ctf
+fi
+
+# Dump the CTF
+objdump --ctf --ctf-parent=shared_ctf "$ctf" 2>/dev/null | \
+    awk '
+BEGIN {
+    intypes=0;
+}
+
+/^  Strings:|^CTF archive member:/ {
+    intypes = 0;
+}
+# Scan for each member, capture its name.
+/^CTF archive member: / {
+    member=gensub (/CTF archive member: (.*):/,"\\1", "g");
+    next;
+}
+# See if any non-shared dicts have any types in.
+/^  Types:/ {
+    if (member != "shared_ctf") {
+        intypes=1;
+    }
+}
+/^    0x/ {
+    if (intypes) {
+        exit (0);
+    }
+}
+END {
+    if (!intypes) {
+        printf ("No non-shared-dict types found: probably buggy deduplicator.\n");
+        exit (1);
+    }
+}'
Signature · 1 line
2.47.1.279.g84c5f4e78e
#4 lore raw
Quoted 1 line · Eugene Loh

But if it is a dependency, it would be nice to know there is a problem.

I believe we would already know there is a problem because of other tests failing.

Quoted 102 lines · Kris Van Hees
Quoted 101 lines

This seems like a test that would belong in the kernel tree rather than in DTrace? It seems like a weird tst to have included in DTrace because if it fails, we cannot do anything about it in DTrace anyway.

I'd rather leave out tests that exercise things that are not DTrace itself.

Quoted 29 lines · Nick Alcock

Some early prototype deduplicators dedupped types in one dict (more or less) rather than putting conflicting types and module types into sub-dictionaries. Fail if the running kernel is such a kernel.

---
  dtrace.spec                  |  2 +-
  test/smoke/tst.ctf-intact.sh | 58 ++++++++++++++++++++++++++++++++++++
  2 files changed, 59 insertions(+), 1 deletion(-)

create mode 100755 test/smoke/tst.ctf-intact.sh

dtrace.spec +1 -1
index 902ad7d8bb980..cf960f14b55c7 100644
@@ -151,7 +151,7 @@ Requires:     %{name}-devel = %{version}-%{release} perl gcc java
  Requires:     java-1.8.0-openjdk-devel perl-IO-Socket-IP xfsprogs
  Requires:     exportfs vim-minimal %{name}%{?_isa} = %{version}-%{release}
  Requires:     coreutils wireshark %{glibc32}
-Requires:     perf time bc nfs-utils
+Requires:     perf time bc nfs-utils binutils
  Autoreq:      0
  Group:	      Development/System
test/smoke/tst.ctf-intact.sh new file +0 -0
new file mode 100755
index 0000000000000..d737a2b162fcb

test/smoke/tst.ctf-intact.sh line 4

Quoted 4 lines
test/smoke/tst.ctf-intact.sh new file +4 -0
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.

2024 -> 2025

test/smoke/tst.ctf-intact.sh line 11

Quoted 7 lines
test/smoke/tst.ctf-intact.sh new file +7 -0
+# Licensed under the Universal Permissive License v 1.0 as shown at
+# http://oss.oracle.com/licenses/upl.
+#
+
+#
+# This script verifies that the CTF, if present, is non-corrupt: in
+# particular, that it has at least one child with

The rest of the comment is missing?

Quoted 50 lines
test/smoke/tst.ctf-intact.sh new file +47 -0
+#
+
+ctf="/lib/modules/$(uname -r)/kernel/vmlinux.ctfa"
+
+if [[ ! -f "$ctf" ]]; then
+    echo "CTF not found in expected location of $ctf" >&2
+    exit 67
+fi
+
+# If this is not an ELF file, turn it into one so objdump works.
+if ! [[ "$(file "$ctf")" =~ ELF ]]; then
+    objcopy --add-section=.ctf="$ctf" /bin/true $tmpdir/ctf
+    ctf=$tmpdir/ctf
+fi
+
+# Dump the CTF
+objdump --ctf --ctf-parent=shared_ctf "$ctf" 2>/dev/null | \
+    awk '
+BEGIN {
+    intypes=0;
+}
+
+/^  Strings:|^CTF archive member:/ {
+    intypes = 0;
+}
+# Scan for each member, capture its name.
+/^CTF archive member: / {
+    member=gensub (/CTF archive member: (.*):/,"\\1", "g");
+    next;
+}
+# See if any non-shared dicts have any types in.
+/^  Types:/ {
+    if (member != "shared_ctf") {
+        intypes=1;
+    }
+}
+/^    0x/ {
+    if (intypes) {
+        exit (0);
+    }
+}
+END {
+    if (!intypes) {
+        printf ("No non-shared-dict types found: probably buggy deduplicator.\n");
+        exit (1);
+    }
+}'
Signature · 1 line
2.47.1.279.g84c5f4e78e