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

symlinks #38

Open
jeapostrophe opened this issue Aug 27, 2022 · 8 comments
Open

symlinks #38

jeapostrophe opened this issue Aug 27, 2022 · 8 comments

Comments

@jeapostrophe
Copy link

Is it a known issue that it doesn't work with tests found inside symlink'd directories? Stack builds them, but tasty-discover doesn't seem to find them

@newhoggy
Copy link
Member

I wasn't aware of this. Can you send a small reproducer?

@jeapostrophe
Copy link
Author

Here you go: https://github.com/jeapostrophe/tasty-discover-38

It is very contrived, but trust me this is actually useful to me :)

@jeapostrophe
Copy link
Author

If you run the Makefile, it will make the links and run the commands to show what works and what doesn't

@newhoggy
Copy link
Member

newhoggy commented Aug 30, 2022

The reason this happens is because the Glob package doesn't follow symlinks.

$ cabal repl tasty-discover
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - tasty-discover-5.0.0 (lib) (first run)
Preprocessing library for tasty-discover-5.0.0..
GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
[1 of 7] Compiling Paths_tasty_discover ( /Users/jky/wrk/haskell-works/tasty-discover/dist-newstyle/build/aarch64-osx/ghc-8.10.7/tasty-discover-5.0.0/build/autogen/Paths_tasty_discover.hs, interpreted )
[2 of 7] Compiling Test.Tasty.Discover.Internal.Config ( src/Test/Tasty/Discover/Internal/Config.hs, interpreted )
[3 of 7] Compiling Test.Tasty.Discover.Internal.Generator ( src/Test/Tasty/Discover/Internal/Generator.hs, interpreted )
[4 of 7] Compiling Test.Tasty.Discover.Internal.Driver ( src/Test/Tasty/Discover/Internal/Driver.hs, interpreted )
[5 of 7] Compiling Test.Tasty.Discover.TastyInfo ( src/Test/Tasty/Discover/TastyInfo.hs, interpreted )
[6 of 7] Compiling Test.Tasty.Discover ( src/Test/Tasty/Discover.hs, interpreted )
[7 of 7] Compiling Test.Tasty.Discover.Version ( src/Test/Tasty/Discover/Version.hs, interpreted )
Ok, 7 modules loaded.
*Test.Tasty.Discover> import System.FilePath.Glob
*Test.Tasty.Discover System.FilePath.Glob> globDir1 (compile "**/*.hs") "/Users/jky/wrk/haskell-works/tasty-discover-38/hs1/test"
["/Users/jky/wrk/haskell-works/tasty-discover-38/hs1/test/XYZ/Good.hs","/Users/jky/wrk/haskell-works/tasty-discover-38/hs1/test/Main.hs"]

That package would need to add symlink support. Please file an issue with that library and let me know when that support is added.

@newhoggy
Copy link
Member

@newhoggy
Copy link
Member

BTW you can test tasty-discover by running it directly:

cabal exec tasty-discover /Users/jky/wrk/haskell-works/tasty-discover-38/hs1/test/Main.hs _ out.hs

@jeapostrophe
Copy link
Author

I made an issue over there. Is it possible for tasty-discover to learn about the files that are being built with Cabal rather than by searching the file system? I had never really looked at it, but when I made the example I noticed that the symlink'd file shows up in the Cabal file: https://github.com/jeapostrophe/tasty-discover-38/blob/master/hs1/xyz.cabal#L48

@newhoggy
Copy link
Member

newhoggy commented Sep 3, 2022

It shows up in the cabal file because hpack puts it there.

hpack probably does a straightforward recursive listing of files under the directory rather than globbing.

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