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

stack "errors" when building package with benchmark that depends on itself #2153

Closed
RyanGlScott opened this issue May 17, 2016 · 5 comments
Closed
Milestone

Comments

@RyanGlScott
Copy link
Contributor

Originally discovered here. Steps to reproduce:

$ stack unpack vector-binary-instances
Unpacked vector-binary-instances-0.2.3.2 to /home/ryanglscott/Documents/Hacking/Haskell/vector-binary-instances-0.2.3.2/
$ cd vector-binary-instances-0.2.3.2/
$ stack init --resolver lts-5.16
Using cabal packages:
- vector-binary-instances.cabal

Selected resolver: lts-5.16
Initialising configuration using resolver: lts-5.16
Total number of user packages considered: 1
Writing configuration to file: stack.yaml
All done.
$ stack bench --only-dependencies
...
$ stack bench                                                                             
vector-binary-instances-0.2.3.2: benchmarks                                               
vector-binary-instances-0.2.3.2: configure (bench)                                        
setup-Simple-Cabal-1.22.5.0-ghc-7.10.3: No benchmarks enabled. Did you                    
remember to configure with '--enable-benchmarks'?                                         
Configuring vector-binary-instances-0.2.3.2...                                            
vector-binary-instances-0.2.3.2: build (bench)
Preprocessing library vector-binary-instances-0.2.3.2...
[1 of 1] Compiling Data.Vector.Binary ( Data/Vector/Binary.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Data/Vector/Binary.o )
In-place registering vector-binary-instances-0.2.3.2...
Preprocessing benchmark 'benchmarks' for vector-binary-instances-0.2.3.2...
[1 of 1] Compiling Main             ( benchmarks/Benchmarks.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/benchmarks/benchmarks-tmp/Main.o )
Linking .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/benchmarks/benchmarks ...
Completed 2 action(s).

--  While building package vector-binary-instances-0.2.3.2 using:
      /home/ryanglscott/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 bench benchmarks
    Process exited with code: ExitFailure 1

stack seems to be confused about vector-binary-instances's benchmarks, for the reason that (I assume) its benchmarks transitively depends on vector-binary-instances itself. It still appears to build correctly, but it exits with an error code and doesn't actually run the benchmarks.

@mgsloan
Copy link
Contributor

mgsloan commented May 17, 2016

Oh, hmm, I think this is because cabal does not support cyclic benchmarks (though I think in theory it does on cabal master / perhaps the recent release). We just need to implement benchmark running rather than delegating to cabal.

@mgsloan mgsloan modified the milestones: P2: Should, P3: Optional May 17, 2016
@mgsloan
Copy link
Contributor

mgsloan commented May 17, 2016

As unpleasant as this is, setting the priority at P2 because there's a direct work-around: stack exec my-bench-name. You can build without having it exit with failure via stack build :my-bench-name --no-run-benchmarks or stack build --bench --no-run-benchmarks

@sjakobi
Copy link
Member

sjakobi commented Jul 16, 2016

@mgsloan:

As unpleasant as this is, setting the priority at P2 because there's a direct work-around: stack exec my-bench-name. You can build without having it exit with failure via stack build :my-bench-name --no-run-benchmarks or stack build --bench --no-run-benchmarks

That doesn't seem to work because my-bench-name isn't on the PATH. Is there a better workaround than digging into .stack-work to find the benchmark executable?

@mgsloan
Copy link
Contributor

mgsloan commented Jul 19, 2016

Yeah, I think it should be possible for us to do our own benchmark running rather than delegating to Cabal.

@mgsloan
Copy link
Contributor

mgsloan commented Mar 22, 2017

Finally figured this out! When there's a benchmark / test with cyclic deps, it wasn't waiting for the build to complete before attempting to run.

@mgsloan mgsloan closed this as completed Mar 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants