ada_api/source_files test fails on Windows due to casing issues
Opened this issue · 1 comments
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:
- GNATPro 24.1
- libadalang 3c104cf
- langkit AdaCore/langkit@6aba249
- gpr2 AdaCore/gpr@880f16d (HEAD of 24.1 branch)
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.