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

Run tests requiring hackage-repo-tool on Windows #5219

Merged
merged 6 commits into from
May 9, 2018

Conversation

grayjay
Copy link
Collaborator

@grayjay grayjay commented Mar 18, 2018

Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!


This PR installs hackage-repo-tool in the AppVeyor build and works around several issues to allow the tests to run. The commits are:

Run tar with --force-local on Windows in cabal-tests, to handle colons in paths.

Add CABAL_DIR environment variable for specifying the cabal directory.

CABAL_DIR can be used to run integration tests independently on Windows,
since setting HOME doesn't affect the location of the APPDATA directory.

Set CABAL_DIR in cabal-tests (fixes #5187).

This change gives each test a new cabal directory on Windows and prevents the
tests from accessing the user's cabal directory.

This commit also re-enables
PackageTests/Regression/T4154/install-time-with-constraint.test.hs on Windows.

Work around issue #4515 in several new-build integration tests.

This commit uses a temporary directory for the nix store in several of the
new-build tests in cabal-testsuite. The directory is given a very short path on
Windows in order to avoid issues with long store paths.

Work around issue #5218 in cabal-testsuite.

This commit uses a relative path to specify the test remote repository on
Windows, to avoid the path conversion issue described in #5218.

Use hackage-repo-tool when running cabal-testsuite on AppVeyor (closes #5204).

appveyor.yml currently downloads hackage-security from Github, since the changes
that allow building on Windows haven't been released yet.

I disabled one test that still fails on Windows:
PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs


The only non-test change is the CABAL_DIR environment variable for overriding the cabal directory. I'm not completely sure that is the right solution for preventing the tests from accessing the user's cabal directory, since it could cause an incompatibility between cabal-install and older custom setup executables that don't recognize the variable. (I only tested it by building cabal-install, so far.) Does it make sense to add the variable only for testing?

/cc @23Skidoo @ezyang

@23Skidoo
Copy link
Member

Thanks, this is very nice. Re: CABAL_DIR - I may be mistaken, but didn't we already have something like that in the test suite to make it use a non-default .cabal dir?

@grayjay
Copy link
Collaborator Author

grayjay commented Mar 24, 2018

Thanks. I wasn't able to find an existing way to override the cabal directory. I thought that cabal-testsuite only set HOME, which doesn't work on Windows. The closest feature I could find was CABAL_CONFIG, which only overrides the config file location.

@hvr
Copy link
Member

hvr commented Mar 25, 2018

@23Skidoo @grayjay fyi, I just published http://hackage.haskell.org/package/hackage-repo-tool-0.1.1.1

@grayjay grayjay force-pushed the appveyor-hackage-repo-tool branch from 39bed2f to dbd5676 Compare March 25, 2018 20:10
@grayjay
Copy link
Collaborator Author

grayjay commented Mar 25, 2018

Awesome! I updated the PR to use the version from Hackage.

@grayjay grayjay force-pushed the appveyor-hackage-repo-tool branch 3 times, most recently from 1a8c711 to 1911c73 Compare March 31, 2018 03:49
@grayjay grayjay force-pushed the appveyor-hackage-repo-tool branch from 1911c73 to a629cc0 Compare April 29, 2018 06:08
@grayjay
Copy link
Collaborator Author

grayjay commented Apr 29, 2018

@23Skidoo Do you think this PR is ready to be merged?

grayjay added 6 commits May 2, 2018 22:00
CABAL_DIR can be used to run integration tests independently on Windows,
since setting HOME doesn't affect the location of the APPDATA directory.
This change gives each test a new cabal directory on Windows and prevents the
tests from accessing the user's cabal directory.

This commit also re-enables
PackageTests/Regression/T4154/install-time-with-constraint.test.hs on Windows.
This commit uses a temporary directory for the nix store in several of the
new-build tests in cabal-testsuite.  The directory is given a very short path on
Windows in order to avoid issues with long store paths.
This commit uses a relative path to specify the test remote repository on
Windows, to avoid the path conversion issue described in haskell#5218.
…haskell#5204).

I disabled one test that still fails on Windows:
PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs
@grayjay grayjay force-pushed the appveyor-hackage-repo-tool branch from a629cc0 to 1826980 Compare May 3, 2018 05:02
@23Skidoo
Copy link
Member

23Skidoo commented May 9, 2018

OK, let's merge this now, I'll try to find time to look into CABAL_DIR stuff more closely later.

@23Skidoo 23Skidoo merged commit 3c339d2 into haskell:master May 9, 2018
@23Skidoo
Copy link
Member

23Skidoo commented May 9, 2018

Merged, thanks!

@grayjay grayjay deleted the appveyor-hackage-repo-tool branch May 13, 2018 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants