Doesn't seem to work
Apologies in advance if I'm missing something, but I can't seem to get this library to find my source files.
% ls src/**/*.hs
src/Data/Text/Escaped.hs
% stack exec doctest-discover "" "" /dev/stdout
module Main where
import Test.DocTest
main :: IO ()
main = doctest ["-i/src"]
I expected such an invocation to generate this:
module Main where
import Test.DocTest
main :: IO ()
main = doctest ["-isrc", "src/Data/Text/Escaped.hs"]
It's unclear to me why -i gets an absolute of /src rather than the relative src. I can get doctest to work with or without that option being correct (as long as I provide the .hs files), but that might explain why doctest-discover isn't finding source files (i.e. maybe it's looking for /src/**/*.hs).
Sorry, I haven't had the time to look into this.
On Sat, Aug 26, 2017 at 9:22 AM, patrick brisbin [email protected] wrote:
Apologies in advance if I'm missing something, but I can't seem to get this library to find my source files.
% ls src/**/*.hssrc/Data/Text/Escaped.hs % stack exec doctest-discover "" "" /dev/stdoutmodule Main whereimport Test.DocTestmain :: IO ()main = doctest ["-i/src"]
I expected such an invocation to generate this:
module Main whereimport Test.DocTestmain :: IO () main = doctest ["-isrc", "src/Data/Text/Escaped.hs"]
It's unclear to me why -i gets an absolute of /src rather than the relative src. I can get doctest to work with or without that option being correct (as long as I provide the .hs files), but that might explain why doctest-discover isn't finding source files (i.e. maybe it's looking for /src/**/*.hs).
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/karun012/doctest-discover/issues/9, or mute the thread https://github.com/notifications/unsubscribe-auth/ACEf74Ty5yp8GwfddtqXJaO9NCOrDlWNks5scEYxgaJpZM4PDimA .
So I'm thinking that -i/src is a separate bug (should I file it?). The actual bug I'm hitting seems to be that it just doesn't find files recursively.
% touch src/Lib/Example.hs
% ls src/**/*.hs
src/Config.hs src/Lib/Example.hs src/Main.hs src/Runner.hs
% stack exec doctest-discover "" "" /dev/stdout
module Main where
import Test.DocTest
main :: IO ()
main = doctest ["-i/src","/home/patrick/code/pbrisbin/doctest-discover/src/Main.hs","/home/patrick/code/pbrisbin/doctest-discover/src/Config.hs","/home/patrick/code/pbrisbin/doctest-discover/src/Runner.hs"]
Please do. I'll try to look into this.
On Wed, Aug 30, 2017 at 7:20 AM, patrick brisbin [email protected] wrote:
So I'm thinking that -i/src is a separate bug (should I file it?). The actual bug I'm hitting seems to be that it just doesn't find files recursively.
% touch src/Lib/Example.hs % ls src/**/*.hs src/Config.hs src/Lib/Example.hs src/Main.hs src/Runner.hs % stack exec doctest-discover "" "" /dev/stdout module Main where import Test.DocTest main :: IO () main = doctest ["-i/src","/home/patrick/code/pbrisbin/doctest-discover/src/Main.hs","/home/patrick/code/pbrisbin/doctest-discover/src/Config.hs","/home/patrick/code/pbrisbin/doctest-discover/src/Runner.hs"]
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/karun012/doctest-discover/issues/9#issuecomment-326005331, or mute the thread https://github.com/notifications/unsubscribe-auth/ACEf7zPWTLhygMaOMf1rxCY_r1mVzNTfks5sdW-QgaJpZM4PDimA .
@pbrisbin I have been trying to get this to build on travis, but something really weird is going on. It's almost like the example files are not being found. #22 kind of shows me that, but when I look at the build on Travis, it just seems to be exiting saying -
ghc: could not execute: doctest-discover
-- While building custom Setup.hs for package doctest-discover-0.1.0.8 using:
/home/travis/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0 build lib:doctest-discover exe:doctest-discover test:doctests --ghc-options " -ddump-hi -ddump-to-file"
Any thoughts?
It seems like executables of the package aren't available when compiling the tests. I'd wager this never worked in a clean environment. Locally, you're likely to have run stack install at some point, putting a binary on your local $PATH. I would try doing stack install in your CI steps:
% clone karun012/doctest-discover
Cloning into '/home/patrick/code/karun012/doctest-discover'...
remote: Counting objects: 237, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 237 (delta 1), reused 8 (delta 1), pack-reused 228
Receiving objects: 100% (237/237), 37.15 KiB | 2.18 MiB/s, done.
Resolving deltas: 100% (123/123), done.
% stack install
Building all executables for `doctest-discover' once. After a successful build of all of them, only specified executables will be rebuilt.
doctest-discover-0.1.0.8: configure (lib + exe)
Configuring doctest-discover-0.1.0.8...
doctest-discover-0.1.0.8: build (lib + exe)
Preprocessing library doctest-discover-0.1.0.8...
Preprocessing executable 'doctest-discover' for doctest-discover-0.1.0.8...
[1 of 3] Compiling Config ( src/Config.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctest-discover/doctest-discover-tmp/Config.o )
[2 of 3] Compiling Runner ( src/Runner.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctest-discover/doctest-discover-tmp/Runner.o )
[3 of 3] Compiling Main ( src/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctest-discover/doctest-discover-tmp/Main.o )
Linking .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctest-discover/doctest-discover ...
doctest-discover-0.1.0.8: copy/register
Installing library in
/home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/lib/x86_64-linux-ghc-8.0.2/doctest-discover-0.1.0.8-FXuoKInImBdJ052Ajo0GVU
Installing executable(s) in
/home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/bin
Registering doctest-discover-0.1.0.8...
Copying from /home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/bin/doctest-discover to /home/patrick/.local/bin/doctest-discover
Copied executables to /home/patrick/.local/bin:
- doctest-discover
% stack test
doctest-discover-0.1.0.8: unregistering (components added: test:doctests)
doctest-discover-0.1.0.8: build (lib + exe + test)
Preprocessing library doctest-discover-0.1.0.8...
Preprocessing executable 'doctest-discover' for doctest-discover-0.1.0.8...
Preprocessing test suite 'doctests' for doctest-discover-0.1.0.8...
[1 of 1] Compiling Main ( test/Doctest-Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctests/doctests-tmp/Main.o )
Linking .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctests/doctests ...
doctest-discover-0.1.0.8: copy/register
Installing library in
/home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/lib/x86_64-linux-ghc-8.0.2/doctest-discover-0.1.0.8-FXuoKInImBdJ052Ajo0GVU
Installing executable(s) in
/home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/bin
Registering doctest-discover-0.1.0.8...
doctest-discover-0.1.0.8: test (suite: doctests)
### Failure in /home/patrick/code/karun012/doctest-discover/src/Main.hs:28: expression `map (stripPrefix prefix) <$> getAbsDirectoryContents "test/example"'
expected: [Just "/test/example/Foo/Bar.hs",Just "/test/example/Foo.hs"]
but got: [Just "/test/example/Foo.hs",Just "/test/example/Foo/Bar.hs"]
Examples: 24 Tried: 24 Errors: 0 Failures: 1
doctest-discover-0.1.0.8: Test suite doctests failed
Completed 2 action(s).
Test suite failure for package doctest-discover-0.1.0.8
doctests: exited with: ExitFailure 1
Logs printed to console
stack test 5.51s user 1.09s system 90% cpu 7.305 total
I seem to have a fun sorting issue, so we probably need to fix that somehow.
I'll push that change out today. Thanks!
At some point this can actually be rewritten.
On Mar 6, 2018 9:12 AM, "patrick brisbin" [email protected] wrote:
It seems like executables of the package aren't available when compiling the test. I'd wager this never worked in a clean environment. Locally, you're likely to have run stack install at some point, putting a binary on your local $PATH. I would try doing stack install in your CI steps:
% clone karun012/doctest-discover ~ Cloning into '/home/patrick/code/karun012/doctest-discover'... remote: Counting objects: 237, done. remote: Compressing objects: 100% (8/8), done. remote: Total 237 (delta 1), reused 8 (delta 1), pack-reused 228 Receiving objects: 100% (237/237), 37.15 KiB | 2.18 MiB/s, done. Resolving deltas: 100% (123/123), done. % stack install ~/code/karun012/doctest-discover [doctest-discover:master] Building all executables for `doctest-discover' once. After a successful build of all of them, only specified executables will be rebuilt. doctest-discover-0.1.0.8: configure (lib + exe) Configuring doctest-discover-0.1.0.8... doctest-discover-0.1.0.8: build (lib + exe) Preprocessing library doctest-discover-0.1.0.8... Preprocessing executable 'doctest-discover' for doctest-discover-0.1.0.8... [1 of 3] Compiling Config ( src/Config.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctest-discover/doctest-discover-tmp/Config.o ) [2 of 3] Compiling Runner ( src/Runner.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctest-discover/doctest-discover-tmp/Runner.o ) [3 of 3] Compiling Main ( src/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctest-discover/doctest-discover-tmp/Main.o ) Linking .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctest-discover/doctest-discover ... doctest-discover-0.1.0.8: copy/register Installing library in /home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/lib/x86_64-linux-ghc-8.0.2/doctest-discover-0.1.0.8-FXuoKInImBdJ052Ajo0GVU Installing executable(s) in /home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/bin Registering doctest-discover-0.1.0.8... Copying from /home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/bin/doctest-discover to /home/patrick/.local/bin/doctest-discover
Copied executables to /home/patrick/.local/bin:
- doctest-discover % stack test ~/code/karun012/doctest-discover [doctest-discover:master] doctest-discover-0.1.0.8: unregistering (components added: test:doctests) doctest-discover-0.1.0.8: build (lib + exe + test) Preprocessing library doctest-discover-0.1.0.8... Preprocessing executable 'doctest-discover' for doctest-discover-0.1.0.8... Preprocessing test suite 'doctests' for doctest-discover-0.1.0.8... [1 of 1] Compiling Main ( test/Doctest-Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctests/doctests-tmp/Main.o ) Linking .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/doctests/doctests ... doctest-discover-0.1.0.8: copy/register Installing library in /home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/lib/x86_64-linux-ghc-8.0.2/doctest-discover-0.1.0.8-FXuoKInImBdJ052Ajo0GVU Installing executable(s) in /home/patrick/code/karun012/doctest-discover/.stack-work/install/x86_64-linux/lts-9.18/8.0.2/bin Registering doctest-discover-0.1.0.8... doctest-discover-0.1.0.8: test (suite: doctests)
Failure in /home/patrick/code/karun012/doctest-discover/src/Main.hs:28: expression `map (stripPrefix prefix) <$> getAbsDirectoryContents "test/example"'
expected: [Just "/test/example/Foo/Bar.hs",Just "/test/example/Foo.hs"] but got: [Just "/test/example/Foo.hs",Just "/test/example/Foo/Bar.hs"] Examples: 24 Tried: 24 Errors: 0 Failures: 1 doctest-discover-0.1.0.8: Test suite doctests failed Completed 2 action(s). Test suite failure for package doctest-discover-0.1.0.8 doctests: exited with: ExitFailure 1 Logs printed to console
stack test 5.51s user 1.09s system 90% cpu 7.305 total
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/karun012/doctest-discover/issues/9#issuecomment-370855854, or mute the thread https://github.com/notifications/unsubscribe-auth/ACEf72ykCQ7UzDFiX8x4mP63GkAD5U00ks5tbsOTgaJpZM4PDimA .
I fixed the sorting issue. I'm just sorting all the paths before it returns. If the next build passes, I'll bump the version so that it gets uploaded to hackage. I'm guessing this issue can be closed now?