fortran-lang / fpm

Fortran Package Manager (fpm)
https://fpm.fortran-lang.org
MIT License
844 stars 95 forks source link

`fpm test` runs test/main.F90 twice on a case-preserving macOS file system #1006

Closed rouson closed 3 months ago

rouson commented 3 months ago

Description

When the test/ subdirectory contains a program named main.F90, fpm test runs that program twice on a case-preserving macOS file system.

Expected Behaviour

The program test/main.F90 should run only once.

Version of fpm

0.9.0, 0.10.0

Platform and Architecture

macOS

Additional Information

The following transcript reproduces this bug on macOS:

fpm new hello
cd hello/test
mv check.f90 main.F90
fpm test
 + mkdir -p hello
 + cd hello
 + mkdir -p hello/src
 + mkdir -p hello/app
 + mkdir -p hello/test
 + git config --get user.name > /var/tmp/tmp.sRX1aS
 + git config --get user.email > /var/tmp/tmp.j2GwrT
 + git config --get user.name > /var/tmp/tmp.HmgTGi
 + git init hello
Initialized empty Git repository in /Users/rouson/Repositories/reproducer/hello/.git/
fpm: Entering directory '/Users/rouson/Repositories/reproducer/hello'
 + mkdir -p build/dependencies
hello.f90                              done.
main.F90                               done.
main.f90                               done.
libhello.a                             done.
main.f90                               done.
hello                                  done.
main                                   done.
hello-test                             done.
[100%] Project compiled successfully.
 Put some tests in here!
 Put some tests in here!
fpm: Leaving directory '/Users/rouson/Repositories/reproducer/hello'

For now, I'll work around this by using a name other than main.F90 for my test programs, but I'm hoping that if this issue reaches the right eyeballs, then the laser-like specificity of this reproducer will spark an idea for a really simple fix. 😄

I do not observe this behavior on Linux so I suspect this is related to the fact that my macOS file system is case-preserving but not case-sensitive. For someone new to macOS, choosing a case-sensitive file system is presumably the way to go and I'd love to switch, but I've read that making the switch from case-preserving to case-sensitive is not a great idea so I'm stuck with case-preserving for the rest of this lifetime. Maybe this is a good reason to hope for reincarnation!

perazz commented 3 months ago

Nice catch @rouson! on macOS, both following statements return .true. in your example:

 exists main.f90 =  T
 exists main.F90 =  T