Skip to content

Validate hidden modules #1796

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 7 commits into from
Aug 30, 2022
Merged

Conversation

martyall
Copy link
Contributor

fixes #1687

I tested this by just manually tweaking test files and monitoring for errors, because I was unsure of how to write a test expecting a failure. If one is required, can you please point me to an example?

Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this!

You can find tests for haskell_module here and tests for hidden modules here.

One possible way to test this would be to use failure testing.

Comment on lines +534 to +536
hidden_minus_declared_modules = set.difference(set.from_list(ctx.attr.hidden_modules), set.from_list(declared_modules))
if not hidden_minus_declared_modules == set.empty():
fail("""Hidden modules must be a subset of all modules, found additional hidden modules {}""".format(set.to_list(hidden_minus_declared_modules)))
Copy link
Member

Choose a reason for hiding this comment

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

Orthogonal to this PR, but we should really get rid of private/set.bzl and replace it by Skylib. I've opened #1799 to track this.

@martyall
Copy link
Contributor Author

Here is the result of running bazel test :test-missing-module in the tests/hidden-modules directory.

Screenshot from 2022-08-24 12-23-56

How do I make sure this gets run with the rest of the tests?

@aherrmann
Copy link
Member

How do I make sure this gets run with the rest of the tests?

CI invokes bazel test //..., so, the tests will be run without further steps required.

Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

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

Thank you, that looks good!

Side note, you can push your branch to the tweag-org's rules_haskell repo to get CI to run on it.

@aherrmann aherrmann added the merge-queue merge on green CI label Aug 25, 2022
@martyall
Copy link
Contributor Author

martyall commented Aug 25, 2022

some of these tests failures that don't seem to have anything to do with this work... Do you see anything related to this PR in the output?

@aherrmann
Copy link
Member

       //:buildifier_test                                                       FAILED in 0.2s

It's the formatting test that fails. You can reformat your code by invoking buildifier on it (bazel run //:buildifier-fix).

@martyall
Copy link
Contributor Author

Side note, you can push your branch to the tweag-org's rules_haskell repo to get CI to run on it.

Yeah it seems like it doesn't always run automatically for external PRs, but when I pushed the branch of the same name to this repo, it triggered... weird

@aherrmann
Copy link
Member

Yeah it seems like it doesn't always run automatically for external PRs, but when I pushed the branch of the same name to this repo, it triggered... weird

Yes, that's unfortunately how it is at the moment. It's the same issue as described here: tweag/rules_nixpkgs#243.

@martyall
Copy link
Contributor Author

CI is failing pretty spectacularly on windows

@aherrmann
Copy link
Member

@martyall that looks like an issue with the remote cache. I've raised it here. I've triggered a rerun to see if it was transient.

@mergify mergify bot merged commit 984750c into tweag:master Aug 30, 2022
@mergify mergify bot removed the merge-queue merge on green CI label Aug 30, 2022
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.

Clarify the meaning of hidden_modules and fix the code
2 participants