[LTP] [PATCH v1] ld01.sh: Relax grep pattern for linker error message

Wei Gao wegao@suse.com
Mon Apr 27 02:56:56 CEST 2026


The test was failing on systems (like openSUSE-Tumbleweed) where the
linker identifies itself as '/usr/bin/ld.bfd:' instead of the expected
'ld:'.

ld01 5 TPASS: ld -Bdynamic -shared main.o f1.o rf1.o -o test.so -L/usr/lib/ passed as expected
ld01 5 TPASS: ld -Bstatic -r main.o f1.o rf1.o test.so -L/usr/lib/ 2> ld.out failed as expected
/usr/bin/ld.bfd: attempted static link of dynamic object `test.so'
ld01 5 TFAIL: Unexpected error message

Relax the grep pattern to search for the core error message
'attempted static link of dynamic object' without requiring the
binary name prefix.

Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/commands/ld/ld01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/commands/ld/ld01.sh b/testcases/commands/ld/ld01.sh
index c8ba4fc1c..a0fbf9631 100755
--- a/testcases/commands/ld/ld01.sh
+++ b/testcases/commands/ld/ld01.sh
@@ -69,7 +69,7 @@ test5()
 	EXPECT_FAIL $LD -Bstatic -r main.o f1.o rf1.o test.so -L/usr/lib/ 2\> ld.out
 	cat ld.out
 
-	if grep -q "$LD: attempted static link of dynamic object" ld.out; then
+	if grep -q "attempted static link of dynamic object" ld.out; then
 		tst_res TPASS "Got expected error message"
 	else
 		tst_res TFAIL "Unexpected error message"
-- 
2.52.0



More information about the ltp mailing list