From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
Clark Williams <williams@redhat.com>,
dwarves@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 16/16] tests: Source test_lib.sh via dirname so tests run from any directory
Date: Mon, 22 Jun 2026 17:24:39 -0300 [thread overview]
Message-ID: <20260622202441.14799-17-acme@kernel.org> (raw)
In-Reply-To: <20260622202441.14799-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The test scripts sourced test_lib.sh using a bare filename (source
test_lib.sh or . ./test_lib.sh), which only works when the current
working directory is tests/. Running a test from the repository root
(e.g. tests/inter_cu_refs.sh) would fail with "test_lib.sh: No such
file or directory".
Use $(dirname "$0")/test_lib.sh so each script locates the library
relative to its own path, regardless of the caller's working directory.
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tests/btf_functions.sh | 2 +-
tests/btf_type_tag_order.sh | 2 +-
tests/default_vmlinux_btf.sh | 2 +-
tests/flexible_arrays.sh | 2 +-
tests/gcc_true_signatures.sh | 2 +-
tests/inter_cu_refs.sh | 2 +-
tests/pfunct-btf-decl-tags.sh | 2 +-
tests/prettify_perf.data.sh | 2 +-
tests/reproducible_build.sh | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/btf_functions.sh b/tests/btf_functions.sh
index 127640e158b70805..351412a4c6a8ccb9 100755
--- a/tests/btf_functions.sh
+++ b/tests/btf_functions.sh
@@ -8,7 +8,7 @@
# also should have been.
#
-source test_lib.sh
+source "$(dirname "$0")/test_lib.sh"
vmlinux=$(get_vmlinux $1)
if [ $? -ne 0 ] ; then
diff --git a/tests/btf_type_tag_order.sh b/tests/btf_type_tag_order.sh
index 09d1ac346000bb6b..0e671ae538603d2b 100755
--- a/tests/btf_type_tag_order.sh
+++ b/tests/btf_type_tag_order.sh
@@ -3,7 +3,7 @@
# Check that pahole preserves btf_type_tag order when emitting BTF from DWARF.
-source test_lib.sh
+source "$(dirname "$0")/test_lib.sh"
outdir=$(make_tmpdir)
diff --git a/tests/default_vmlinux_btf.sh b/tests/default_vmlinux_btf.sh
index 496e840bfbec8f3a..b3d6e9cff8719e5f 100755
--- a/tests/default_vmlinux_btf.sh
+++ b/tests/default_vmlinux_btf.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-source test_lib.sh
+source "$(dirname "$0")/test_lib.sh"
title_log "Default BTF on a system without BTF."
diff --git a/tests/flexible_arrays.sh b/tests/flexible_arrays.sh
index 4e9e995271ce816f..6443449b50e6c9c2 100755
--- a/tests/flexible_arrays.sh
+++ b/tests/flexible_arrays.sh
@@ -5,7 +5,7 @@
#
# Arnaldo Carvalho de Melo <acme@redhat.com> (C) 2024-
-source test_lib.sh
+source "$(dirname "$0")/test_lib.sh"
vmlinux=$(get_vmlinux $1)
if [ $? -ne 0 ] ; then
diff --git a/tests/gcc_true_signatures.sh b/tests/gcc_true_signatures.sh
index 9ebe1fa6c32f7bf7..96b282be5dba721a 100755
--- a/tests/gcc_true_signatures.sh
+++ b/tests/gcc_true_signatures.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only
-source test_lib.sh
+source "$(dirname "$0")/test_lib.sh"
outdir=$(make_tmpdir)
diff --git a/tests/inter_cu_refs.sh b/tests/inter_cu_refs.sh
index 6827bf83931eb3ed..0df0ce13cd948f1f 100755
--- a/tests/inter_cu_refs.sh
+++ b/tests/inter_cu_refs.sh
@@ -10,7 +10,7 @@
# that the automatic detection produces the same output as explicitly
# forcing CU merging.
-. ./test_lib.sh
+. "$(dirname "$0")/test_lib.sh"
outdir=$(make_tmpdir)
trap cleanup EXIT
diff --git a/tests/pfunct-btf-decl-tags.sh b/tests/pfunct-btf-decl-tags.sh
index 520148b2ccef15b2..25d9cd6d4ad8551f 100755
--- a/tests/pfunct-btf-decl-tags.sh
+++ b/tests/pfunct-btf-decl-tags.sh
@@ -3,7 +3,7 @@
# Check that pfunct can print btf_decl_tags read from BTF
-source test_lib.sh
+source "$(dirname "$0")/test_lib.sh"
outdir=$(make_tmpdir)
diff --git a/tests/prettify_perf.data.sh b/tests/prettify_perf.data.sh
index 384c250ff4e01a4c..ae0a7d995da6cad2 100755
--- a/tests/prettify_perf.data.sh
+++ b/tests/prettify_perf.data.sh
@@ -7,7 +7,7 @@
# Check if the perf binary is available, if it is from a distro, normally it
# will get the needed DWARF info using libddebuginfod, we'll check if the
# needed types are available, skipping the test and informing the reason.
-. ./test_lib.sh
+. "$(dirname "$0")/test_lib.sh"
outdir=$(make_tmpdir)
diff --git a/tests/reproducible_build.sh b/tests/reproducible_build.sh
index d8c6507526bdfbbc..7b7a5afd1fe4e50d 100755
--- a/tests/reproducible_build.sh
+++ b/tests/reproducible_build.sh
@@ -4,7 +4,7 @@
# Test if BTF generated serially matches reproducible parallel DWARF loading + serial BTF encoding
# Arnaldo Carvalho de Melo <acme@redhat.com> (C) 2024-
-source test_lib.sh
+source "$(dirname "$0")/test_lib.sh"
vmlinux=$(get_vmlinux $1)
if [ $? -ne 0 ]; then
--
2.54.0
prev parent reply other threads:[~2026-06-22 20:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 20:24 [PATCHES v3 0/7] Initial support for some Rust tags, DW_TAG_imported_unit Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 01/16] dwarf_loader: Initial support for DW_TAG_variant_part Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 02/16] dwarf_loader: Allow forcing the merge of CUs for solving inter CU tag references Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 03/16] dwarf_loader: Initial support for DW_TAG_subprogram in DW_TAG_enumeration Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 04/16] encoders: Fix diagnostic messages for unexpected tags in enumerations Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 05/16] dwarves_fprintf: Accumulate function__fprintf return value in enumeration printing Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 06/16] dwarves: Use tag__delete for enumeration children Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 07/16] btf_encoder: Fix types__match parameter comparison in BTF_KIND_FUNC_PROTO Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 08/16] encoders: Handle DW_TAG_subprogram in enumerations during BTF/CTF encoding Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 09/16] dwarf_loader: Populate DW_TAG_variant children in DW_TAG_variant_part Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 10/16] btf_encoder: Encode variant parts as union members in BTF Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 11/16] dwarf_loader: Handle DW_FORM_block in attr_numeric for Rust discriminant values Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 12/16] dwarf_loader: Support DW_TAG_imported_unit for same-file partial units Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 13/16] dwarf_loader: Fix cus__merging_cu failing to detect DW_FORM_ref_addr Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 14/16] tests: Add inter-CU type reference comparison test Arnaldo Carvalho de Melo
2026-06-22 20:24 ` [PATCH 15/16] tests: Guard cleanup() against empty outdir to prevent rm /* Arnaldo Carvalho de Melo
2026-06-22 20:24 ` Arnaldo Carvalho de Melo [this message]
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=20260622202441.14799-17-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=alan.maguire@oracle.com \
--cc=dwarves@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=williams@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.