[PATCH] ld: Skip p33265-2 and pr33265-2 tests on Windows

Jan Dubiec <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
These tests are expected to fail on Windows because by default maximum path length
is only 260 characters:
https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry

Theoretically the issue could be fixed in two ways, as pointed in the linked article:
   1. using the "\\?\" prefix, but this probably requires a lot of work
   and should be done "binutils-wide", i.e. all tools should be reviewed
   from this point of view,
   2. using manifest file, but this still would require an action from
   the user – they would have to turn on long paths support in the
   Windows registry.

Excerpt from the log:
[...]
PASS: ld-scripts/pr33265-1
/d/Works/xcomp/build-binutils-h8300-mingw/ld/../gas/as-new     -o tmpdir/start.o /d/Works/binutils/ld/testsuite/ld-scripts/start.s
Executing on host: sh -c {/d/Works/xcomp/build-binutils-h8300-mingw/ld/../gas/as-new     -o tmpdir/start.o /d/Works/binutils/ld/testsuite/ld-scripts/start.s 2>&1}  /dev/null dump.tmp (timeout = 300)
spawn [open ...]
./ld-new   -L/d/Works/binutils/ld/testsuite/ld-scripts  -r --whole-archive -lpr33265-2 -o tmpdir/dump tmpdir/start.o 
Executing on host: sh -c {./ld-new   -L/d/Works/binutils/ld/testsuite/ld-scripts  -r --whole-archive -lpr33265-2 -o tmpdir/dump tmpdir/start.o  2>&1}  /dev/null dump.tmp (timeout = 300)
spawn [open ...]
D:\Works\xcomp\build-binutils-h8300-mingw\ld\ld-new.exe: cannot open linker script file D:/Works/binutils/ld/testsuite/ld-scripts\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\./././././/libpr33265-2.a: No such file or directory
failed with: <\Works\xcomp\build-binutils-h8300-mingw\ld\ld-new.exe: cannot open linker script file D:/Works/binutils/ld/testsuite/ld-scripts\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\./././././/libpr33265-2.a: No such file or directory>, expected: <.*group nested too deeply.*>
FAIL: ld-scripts/pr33265-2
/d/Works/xcomp/build-binutils-h8300-mingw/ld/../gas/as-new     -o tmpdir/start.o /d/Works/binutils/ld/testsuite/ld-scripts/start.s
Executing on host: sh -c {/d/Works/xcomp/build-binutils-h8300-mingw/ld/../gas/as-new     -o tmpdir/start.o /d/Works/binutils/ld/testsuite/ld-scripts/start.s 2>&1}  /dev/null dump.tmp (timeout = 300)
spawn [open ...]
./ld-new   -L/d/Works/binutils/ld/testsuite/ld-scripts  -r --whole-archive -lpr33265-3a -o tmpdir/dump tmpdir/start.o 
Executing on host: sh -c {./ld-new   -L/d/Works/binutils/ld/testsuite/ld-scripts  -r --whole-archive -lpr33265-3a -o tmpdir/dump tmpdir/start.o  2>&1}  /dev/null dump.tmp (timeout = 300)
spawn [open ...]
D:\Works\xcomp\build-binutils-h8300-mingw\ld\ld-new.exe: cannot open linker script file D:/Works/binutils/ld/testsuite/ld-scripts\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\./././././/libpr33265-3b.a: No such file or directory
failed with: <\Works\xcomp\build-binutils-h8300-mingw\ld\ld-new.exe: cannot open linker script file D:/Works/binutils/ld/testsuite/ld-scripts\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\./././././/libpr33265-3b.a: No such file or directory>, expected: <.*group nested too deeply.*>
FAIL: ld-scripts/pr33265-3
testcase /d/Works/binutils/ld/testsuite/ld-scripts/script.exp completed in 6 seconds
[...]

ld/
	* testsuite/ld-scripts/script.exp: Skip p33265-2 and pr33265-2
	tests on Windows because default path length is too short.
---
 ld/testsuite/ld-scripts/script.exp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp
index ff65e397b6b..4ac338589e1 100644
--- a/ld/testsuite/ld-scripts/script.exp
+++ b/ld/testsuite/ld-scripts/script.exp
@@ -246,7 +246,11 @@ run_dump_test "segment-start" {{name (overridden)} \
 			       {ld -Ttext-segment=0x10000000}}
 
 run_dump_test "pr33265-1"
-run_dump_test "pr33265-2"
-run_dump_test "pr33265-3"
+# On Windows hosts the following two cases are expected to fail because
+# by default maximum path length is only 260 characters.
+if { ![ishost *-mingw*] } {
+    run_dump_test "pr33265-2"
+    run_dump_test "pr33265-3"
+}
 
 set LDFLAGS $old_LDFLAGS
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.