Skip to content

Commit

Permalink
let long path file test support long test root directory
Browse files Browse the repository at this point in the history
See gpr-issues#213
  • Loading branch information
Philippe Gil authored and lambourg committed Jan 4, 2024
1 parent 25ddcfc commit 5979451
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 23 deletions.

This file was deleted.

4 changes: 0 additions & 4 deletions testsuite/tests/long-windows-path-support/prj.gpr

This file was deleted.

3 changes: 0 additions & 3 deletions testsuite/tests/long-windows-path-support/test.out

This file was deleted.

10 changes: 0 additions & 10 deletions testsuite/tests/long-windows-path-support/test.py

This file was deleted.

2 changes: 0 additions & 2 deletions testsuite/tests/long-windows-path-support/test.yaml

This file was deleted.

File renamed without changes.
6 changes: 6 additions & 0 deletions testsuite/tests/long-windows-path/test.out
Original file line number Diff line number Diff line change
@@ -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

38 changes: 38 additions & 0 deletions testsuite/tests/long-windows-path/test.py
Original file line number Diff line number Diff line change
@@ -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'))

4 changes: 4 additions & 0 deletions testsuite/tests/long-windows-path/test.yaml
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 5979451

Please sign in to comment.