Skip to content

Remove CPP from test suite, take 2 #880

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

Merged
merged 35 commits into from
Apr 10, 2019
Merged

Remove CPP from test suite, take 2 #880

merged 35 commits into from
Apr 10, 2019

Conversation

parsonsmatt
Copy link
Collaborator

@parsonsmatt parsonsmatt commented Apr 5, 2019

This PR removes all the CPP from the test suite.

I've pinged a few of you on a request; it's a big PR though and I won't be mad if you don't look at all of it. Self-review icoming.

- env: ARGS="--resolver lts-10 --stack-yaml stack_lts-10.yaml"
- env: ARGS="--resolver lts-11"
- env: ARGS="--resolver lts-12"
- env: ARGS="--resolver lts-13"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooray for simpler CI!

Copy link
Contributor

@Vlix Vlix Apr 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for leaving in 6 and 9, but not the other ones between 6 and 11?

(EDIT: n/m I must have looked at a specific commit or something)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're all resolvers for distinct GHC versions. 7.10.3, 8.0.2, 8.2, 8.4, and 8.6 are represented here. More resolvers seemed redundant to me.

, mtl
, containers
, blaze-html
, time
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deps are somewhat sloppy. They could be weedered now that we don't have so much CPP.

{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module EmbedTestMongo (specs) where
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these tests were just really hard to unentangle, and this was one of them. Instead of detangling it I just copied it.

PersistentTest.cleanDB

hspec $ do
RenameTest.specsWith db
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the test suites are now parameterized by a database runner function: type DbRunner backend m = ReaderT bakend m () -> IO (). This,combined with mpsGeneric = True, allows us to have most of these tests be generic over the backend.

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}

module ArrayAggTest where
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests that were enabled for a single backend were factored into the specific test suite.

@@ -0,0 +1,153 @@
{-# LANGUAGE QuasiQuotes, GADTs, OverloadedStrings #-}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test suite is annoying. We can't have a circular dependency, so in order to depend on persistent-sqlite to have a driver to run these tests against, we have to not depend on persistent-test

@@ -1,53 +0,0 @@
{-# LANGUAGE EmptyDataDecls #-}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was incorproated into the other test suite.

@parsonsmatt
Copy link
Collaborator Author

I'm gonna merge this on Wednesday if no one has any objections

@Vlix
Copy link
Contributor

Vlix commented Apr 9, 2019

Will try to take a look at it tonight.

@Vlix
Copy link
Contributor

Vlix commented Apr 9, 2019

Couldn't look in too much detail, and you've moved mountains, so from a somewhat intensive skimming, I'd say: "If it compiles, and tests, should probably be ok?"

@parsonsmatt
Copy link
Collaborator Author

Yeah, the only thing that's really changed is that the MongoDB tests have totally different behavior on upsert. I'm tempted to call that a bug in the MongoDB library, but it may just be that they need to have totally different specifications factored out.

Copy link
Contributor

@Vlix Vlix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions that popped up after taking a last glance at the entire diff.

{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE EmptyDataDecls #-}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the feeling most of these pragmas in lots of files are completely superfluous, no?
I'll make a PR and go through pragmas and dependencies after this is merged to clean up, I think.

- env: ARGS="--resolver lts-10 --stack-yaml stack_lts-10.yaml"
- env: ARGS="--resolver lts-11"
- env: ARGS="--resolver lts-12"
- env: ARGS="--resolver lts-13"
Copy link
Contributor

@Vlix Vlix Apr 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for leaving in 6 and 9, but not the other ones between 6 and 11?

(EDIT: n/m I must have looked at a specific commit or something)

@parsonsmatt parsonsmatt merged commit c0ff204 into master Apr 10, 2019
@parsonsmatt parsonsmatt deleted the matt/factor-cpp-out branch February 14, 2020 16:53
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

Successfully merging this pull request may close these issues.

2 participants