Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ada_api/source_files test fails on Windows due to casing issues #965

Open
LordAro opened this issue Feb 7, 2024 · 1 comment
Open

ada_api/source_files test fails on Windows due to casing issues #965

LordAro opened this issue Feb 7, 2024 · 1 comment

Comments

@LordAro
Copy link
Contributor

LordAro commented Feb 7, 2024

cpigott@cpigott-PC2 UCRT64 ~/dev/libadalang
$ ./manage.py test --disable-java --disable-ocaml --failure-exit-code=1 --build-mode=prod ada_api/source_files
INFO     Found 1 tests
INFO     FAIL            ada_api__source_files: C:/Users/cpigott/dev/libadalang/tmp/ada_api__source_files/main.exe returned status code 1 (0 expected)
_Running: gprbuild -Pgen -XLIBRARY_TYPE=relocatable -XXMLADA_BUILD=relocatable -XBUILD_MODE=prod -XLIBADALANG_EXTERNALLY_BUILT=true (cwd=C:/Users/cpigott/dev/libadalang/tmp/ada_api__source_files)
_Status code: 0
_Output:
_Compile
_   [Ada]          main.adb
_Bind
_   [gprbind]      main.bexch
_   [Ada]          main.ali
_Link
_   [link]         main.adb
_Running: C:/Users/cpigott/dev/libadalang/tmp/ada_api__source_files/main.exe (cwd=C:/Users/cpigott/dev/libadalang/tmp/ada_api__source_files)
_Status code: 1
_Output:
_## []
_
_For DEFAULT
_  common.adb
_  root.adb
_  sub1.adb
_  sub2.adb
_
_For ROOT_PROJECT
_  root.adb
_
_For WHOLE_PROJECT
_  common.adb
_  installed.adb
_  installed_dep.adb
_  root.adb
_  sub1.adb
_  sub2.adb
_
_For WHOLE_PROJECT_WITH_RUNTIME
_  common.adb
_  installed.adb
_  installed_dep.adb
_  root.adb
_  sub1.adb
_  sub2.adb
_  ... plus runtime sources
_
_raised PROGRAM_ERROR : got different sources with GPR2
_
INFO     Summary:
_  FAIL         1
Testsuite failed: error while running C:/Users/cpigott/dev/libadalang/venv/bin/python.exe C:/Users/cpigott/dev/libadalang/testsuite/testsuite.py -Edtmp --build-mode=prod --gnatcov-instr-dir=build/obj/libadalang/instr --failure-exit-code=1 ada_api/source_files:
    Command '['C:/Users/cpigott/dev/libadalang/venv/bin/python.exe', 'C:/Users/cpigott/dev/libadalang/testsuite/testsuite.py', '-Edtmp', '--build-mode=prod', '--gnatcov-instr-dir=build/obj/libadalang/instr', '--failure-exit-code=1', 'ada_api/source_files']' returned non-zero exit status 1.

Some inspection of the actual containers being compared suggests that it's something to do with the casing of the filenames - everything in the gpr2 vector (from the compiler dir) has been lowercased, which isn't the case for the gpr1 vector. This has, naturally, messed with the sorting.

(C:\GNAT\24.1-x64 is the "true" path of the compiler)

The following is printing each element of the vectors in turn

_For WHOLE_PROJECT_WITH_RUNTIME
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-assert.adb GPR2: C:\Users\cpigott\dev\libadalang\tmp\ada_api__source_files\common.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-assert.ads GPR2: C:\Users\cpigott\dev\libadalang\tmp\ada_api__source_files\installed.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-astaco.adb GPR2: C:\Users\cpigott\dev\libadalang\tmp\ada_api__source_files\installed_dep.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-astaco.ads GPR2: C:\Users\cpigott\dev\libadalang\tmp\ada_api__source_files\root.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-btgbso.adb GPR2: C:\Users\cpigott\dev\libadalang\tmp\ada_api__source_files\sub1.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-btgbso.ads GPR2: C:\Users\cpigott\dev\libadalang\tmp\ada_api__source_files\sub2.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calari.adb GPR2: C:\gnat\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-assert.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calari.ads GPR2: C:\gnat\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-assert.ads
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calcon.adb GPR2: C:\gnat\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-astaco.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calcon.ads GPR2: C:\gnat\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-astaco.ads
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-caldel.adb GPR2: C:\gnat\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-btgbso.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-caldel.ads GPR2: C:\gnat\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-btgbso.ads
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calend.adb GPR2: C:\gnat\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calari.adb
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calend.ads GPR2: C:\gnat\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calari.ads
_GPR1: C:\GNAT\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calfor.adb GPR2: C:\gnat\24.1-x64\lib\gcc\x86_64-w64-mingw32\12.3.1\adainclude\a-calcon.adb
...

I'm using:

@simonjwright
Copy link

On case-insensitive (but case-preserving) filesystems, e.g. Windows and standard macOS, GNAT treats the filesystems as case-insensitive, and when gprbuild sees this it smashes all file names to lower-case (improperly, but that’s another matter). You’d have thought it would do case-insensitive comparisons, but ...

You could try setting the environment variable GNAT_FILE_NAME_CASE_SENSITIVE to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants