From 5979451d7f3e27095f8eb48ab508f7c3e6266f83 Mon Sep 17 00:00:00 2001 From: Philippe Gil Date: Tue, 2 Jan 2024 15:00:05 +0100 Subject: [PATCH] let long path file test support long test root directory See gpr-issues#213 --- .../test1.gpr | 4 -- .../tests/long-windows-path-support/prj.gpr | 4 -- .../tests/long-windows-path-support/test.out | 3 -- .../tests/long-windows-path-support/test.py | 10 ----- .../tests/long-windows-path-support/test.yaml | 2 - .../main.adb | 0 .../src_files}/src1/test1.ads | 0 .../src_files}/src2/test2.ads | 0 .../src_files}/test2.gpr | 0 testsuite/tests/long-windows-path/test.out | 6 +++ testsuite/tests/long-windows-path/test.py | 38 +++++++++++++++++++ testsuite/tests/long-windows-path/test.yaml | 4 ++ 12 files changed, 48 insertions(+), 23 deletions(-) delete mode 100644 testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/test1.gpr delete mode 100644 testsuite/tests/long-windows-path-support/prj.gpr delete mode 100644 testsuite/tests/long-windows-path-support/test.out delete mode 100644 testsuite/tests/long-windows-path-support/test.py delete mode 100644 testsuite/tests/long-windows-path-support/test.yaml rename testsuite/tests/{long-windows-path-support => long-windows-path}/main.adb (100%) rename testsuite/tests/{long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789 => long-windows-path/src_files}/src1/test1.ads (100%) rename testsuite/tests/{long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789 => long-windows-path/src_files}/src2/test2.ads (100%) rename testsuite/tests/{long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789 => long-windows-path/src_files}/test2.gpr (100%) create mode 100644 testsuite/tests/long-windows-path/test.out create mode 100644 testsuite/tests/long-windows-path/test.py create mode 100644 testsuite/tests/long-windows-path/test.yaml diff --git a/testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/test1.gpr b/testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/test1.gpr deleted file mode 100644 index 6e9439b1e..000000000 --- a/testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/test1.gpr +++ /dev/null @@ -1,4 +0,0 @@ -with "123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/test2"; -project Test1 is - for Source_Dirs use ("src1"); -end Test1; \ No newline at end of file diff --git a/testsuite/tests/long-windows-path-support/prj.gpr b/testsuite/tests/long-windows-path-support/prj.gpr deleted file mode 100644 index c6c9226b6..000000000 --- a/testsuite/tests/long-windows-path-support/prj.gpr +++ /dev/null @@ -1,4 +0,0 @@ -with "123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/test1"; -project Prj is - for Main use ("main.adb"); -end Prj; diff --git a/testsuite/tests/long-windows-path-support/test.out b/testsuite/tests/long-windows-path-support/test.out deleted file mode 100644 index e6e1c7d6a..000000000 --- a/testsuite/tests/long-windows-path-support/test.out +++ /dev/null @@ -1,3 +0,0 @@ -Can't find ALI file for /main.adb -Can't find ALI file for /files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/src1/test1.ads -Can't find ALI file for /files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/src2/test2.ads diff --git a/testsuite/tests/long-windows-path-support/test.py b/testsuite/tests/long-windows-path-support/test.py deleted file mode 100644 index 8ab4efb7d..000000000 --- a/testsuite/tests/long-windows-path-support/test.py +++ /dev/null @@ -1,10 +0,0 @@ -import os -from testsuite_support.builder_and_runner import BuilderAndRunner, GPRLS - - -p = BuilderAndRunner().run( - [GPRLS, "-U", "-P", "prj.gpr"], - env={"GPR_PROJECT_PATH": os.getcwd() + "/files"}, -) -print(p.out, end="") - diff --git a/testsuite/tests/long-windows-path-support/test.yaml b/testsuite/tests/long-windows-path-support/test.yaml deleted file mode 100644 index 794976bea..000000000 --- a/testsuite/tests/long-windows-path-support/test.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: let a 130 chars defined path be imported from a 130 chars path -driver: python_script diff --git a/testsuite/tests/long-windows-path-support/main.adb b/testsuite/tests/long-windows-path/main.adb similarity index 100% rename from testsuite/tests/long-windows-path-support/main.adb rename to testsuite/tests/long-windows-path/main.adb diff --git a/testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/src1/test1.ads b/testsuite/tests/long-windows-path/src_files/src1/test1.ads similarity index 100% rename from testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/src1/test1.ads rename to testsuite/tests/long-windows-path/src_files/src1/test1.ads diff --git a/testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/src2/test2.ads b/testsuite/tests/long-windows-path/src_files/src2/test2.ads similarity index 100% rename from testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/src2/test2.ads rename to testsuite/tests/long-windows-path/src_files/src2/test2.ads diff --git a/testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/test2.gpr b/testsuite/tests/long-windows-path/src_files/test2.gpr similarity index 100% rename from testsuite/tests/long-windows-path-support/files/123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789/test2.gpr rename to testsuite/tests/long-windows-path/src_files/test2.gpr diff --git a/testsuite/tests/long-windows-path/test.out b/testsuite/tests/long-windows-path/test.out new file mode 100644 index 000000000..4fea86edb --- /dev/null +++ b/testsuite/tests/long-windows-path/test.out @@ -0,0 +1,6 @@ +Can't find ALI file for /main.adb + +Can't find ALI file for /dst/dir_name/src1/test1.ads + +Can't find ALI file for /dst/dir_name/src2/test2.ads + diff --git a/testsuite/tests/long-windows-path/test.py b/testsuite/tests/long-windows-path/test.py new file mode 100644 index 000000000..d38930643 --- /dev/null +++ b/testsuite/tests/long-windows-path/test.py @@ -0,0 +1,38 @@ +import os +from e3.fs import mkdir, sync_tree +from testsuite_support.builder_and_runner import BuilderAndRunner, GPRLS + +dest = 'dst' + +# return longest source file path if 'name' used as intermediate path +def longest_path_length (name): + return len(os.getcwd() + '/' + dest + '/' + name + '/src1/test1.ads') + +dir_name = 'a' + +while longest_path_length (dir_name) < 255 : + dir_name = dir_name + 'a' + +src_path = os.path.join ('src_files') +dest_path = os.path.join (dest, dir_name) + +mkdir(dest_path) +sync_tree (src_path, dest_path) + +prj_gpr = open('prj.gpr', 'w') +prj_gpr.write('with"' + dir_name + '/test1";project Prj is for Main use("main.adb");end Prj;') +prj_gpr.close() + +test1_gpr = open(os.path.join (dest, dir_name, 'test1.gpr'), 'w') +test1_gpr.write('with"' + dir_name + '/test2";project Test1 is for Source_Dirs use("src1");end Test1;') +test1_gpr.close() + +p = BuilderAndRunner().run( + [GPRLS, "-U", "-P", "prj.gpr"], + env={"GPR_PROJECT_PATH": os.getcwd() + '/' + dest}, + output='gprls.out', +) + +for line in open('gprls.out'): + print(line.replace(dir_name,'dir_name')) + diff --git a/testsuite/tests/long-windows-path/test.yaml b/testsuite/tests/long-windows-path/test.yaml new file mode 100644 index 000000000..ce1bb8cce --- /dev/null +++ b/testsuite/tests/long-windows-path/test.yaml @@ -0,0 +1,4 @@ +description: let a long relative path be imported from a 255 chars absolute path +driver: python_script +control: +- [SKIP, "True", "uses gprls that is not built from gpr2-next"]