Hi,
I'm basically trying to help with snap, but the project size is huge and it's easy to get overwhelmed.
I've fixed a little bug (see issue #30 on github) and I would like to test the code I wrote, but I'm struggling with the test setup:
a) I use hsenv to manage my sandboxed environment: by default, it build every cabal package in dist_$HSENV_NAME instead of simply "dist".
This creates problem with scripts like runTestsAndCoverage.sh which search inside "dist". The problem can be easily solved using a symlink,
but it becomes annoying pretty soon, because in order to make the cabal-dev tests compile, you have to symlink every other directory snap is
bound to, for example heist, snap-core, snap-server, xmlhtml, etc, etc. I hope the issue is clear.
b) Don't know if it's only my impression, or the sandboxed, cabal-dev based tests are very heavy to compile, I also guess due to the "-O2" option.
Is there any way to make the testing process faster?
c) Don't know why, but once every cabal-dev env is ready, builded and deployed, the script (runTestsAndCoverage.sh) simply fails to locate the executable:
This is what I've got on my machine:
Linking dist_snap/build/tutorialTest/tutorialTest ...
Installing executable(s) in
/root/programming/haskell/snap/snap/test/test-cabal-dev//bin
Running "./dist/build/tutorialTest/tutorialTest -p 9992"
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) <----- this is probably related to a deficiency of my pc :D
/bin/sh: ./dist/build/tutorialTest/tutorialTest: No such file or directory
snap/tutorial: [Failed]
ERROR: connect: does not exist (Connection refused)
But the executable exists, but is in <my_path_to_snap>/test/test-cabal-dev/bin! Is this also due to the fact I'm using Hsenv?
If you think It can be useful to solve those issues, and therefore make the project hsenv compliant in a non-invasive way, I'm willing to help.
I could simply modify slightly some scripts or maybe add some post build hook to automatically symlink the output build dir with dist.
In case you don't want to have this kind of dependency from a particular sandboxed env, suggestion about how to fix my problems are
welcome. What I would like to achieve is a solution that will allow me to simply enter the test directory of snap, typing cabal configure && cabal install && ./runTestsAndCoverage.sh
and simply have green all around :)
On Mon, Sep 17, 2012 at 3:10 PM, Alfredo Di Napoli <alfredo....@gmail.com> wrote:Hi,
I'm basically trying to help with snap, but the project size is huge and it's easy to get overwhelmed.
I've fixed a little bug (see issue #30 on github) and I would like to test the code I wrote, but I'm struggling with the test setup:
a) I use hsenv to manage my sandboxed environment: by default, it build every cabal package in dist_$HSENV_NAME instead of simply "dist".
This creates problem with scripts like runTestsAndCoverage.sh which search inside "dist". The problem can be easily solved using a symlink,
but it becomes annoying pretty soon, because in order to make the cabal-dev tests compile, you have to symlink every other directory snap is
bound to, for example heist, snap-core, snap-server, xmlhtml, etc, etc. I hope the issue is clear.
The best way to go here is to modify your local copy of the test shell script. There's not any magic in there. If you can modify the scripts to read the distdir location from an environment variable (defaulting to "dist" of course), that would be acceptable.
b) Don't know if it's only my impression, or the sandboxed, cabal-dev based tests are very heavy to compile, I also guess due to the "-O2" option.
Is there any way to make the testing process faster?The snap project generates complete projects, and the only way to test that those are generated correctly, using the latest development versions of the libraries, is to build them from scratch. So no.
If you do this, just make sure you either don't commit your changes or you do it in a portable way such that it will still work for people building with cabal.
I actually don't use cabal-dev for my development. I typically just use cabal/cabal-install and if I have a complex project with a number of local dependencies that aren't on hackage, then I use cabal-meta.We use cabal-dev in the test suite because it has sandboxes, but I haven't seen a huge need for sandboxes in my day-to-day development.
I found that cabal-dev doesn't work as well with ghci. I don't actually encounter dep hell all that often, and when I do a simple "rm -fr ~/.ghc" usually fixes the problem. When that isn't sufficient, I've found cabal-meta to be the perfect answer to the other issues I've encountered. See my comments here.