Skip to content

Test: new test cases showing existing issues on windows#90

Open
peakschris wants to merge 1 commit intokeith:mainfrom
peakschris:unittest
Open

Test: new test cases showing existing issues on windows#90
peakschris wants to merge 1 commit intokeith:mainfrom
peakschris:unittest

Conversation

@peakschris
Copy link

This PR adds unit tests for buildifier that fail to demonstrate the current issues with Windows.

Because running fix modifies the source tree, I set them up as bazel shell tests so that they run in temporary workspaces.

You can add this command to CI:
bazel test //tests/buildifier/... --enable_runfiles

Although the tests must run with runfiles, the sub-workspaces that they validate run in both runfiles and non-runfiles mode.

@peakschris
Copy link
Author

peakschris commented Jun 28, 2024

It would be nice to re-enable the existing integration tests for windows on CI. However, rules_bazel_integration test is currently broken on windows - around half of the test cases are failing. Part of this might be its dependency on buildifier-prebuilt! I can have a look at that at some point, but for now I suggest we use these bazel shell tests to add coverage that works on all platforms, and I'll look at fixing rules_bazel_integration_test as a followup once my windows fixes here are released.

@@ -0,0 +1,856 @@
#!/usr/bin/env bash
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not for this PR. However, we should create a Bazel module that exposes this. We could host the repo under bazel-contrib.

@peakschris
Copy link
Author

@keith I've pushed a fix for ubuntu. For windows, could you add --enable_runfiles to the test command? That is required.

@peakschris
Copy link
Author

Actually, I've fixed the new test so it can be used in norunfiles mode.

@keith, could you rerun CI please?

@keith
Copy link
Owner

keith commented Jun 30, 2024

started

@peakschris
Copy link
Author

peakschris commented Jun 30, 2024

I've improved the test cases. I'd expect //tests:buildifier:buildifier_test to fail on both linux and windows. The linux failures are due to buildifier check/fix having some issue in norunfiles mode.

@keith could you rerun CI?

These are the messages reported from inside //tests:buildifier:buildifier_test
On windows:
** 2 / 6 tests passed. *********************************************************
** There were errors. **********************************************************

On linux:
** 4 / 6 tests passed. *********************************************************
** There were errors. **********************************************************

@cgrindel
Copy link
Collaborator

I just approved the CI run.

@peakschris
Copy link
Author

peakschris commented Jun 30, 2024

Thank you. That is failing as expected. I've merged the latest state of this PR into #89 so we can evaluate those results. Please do whatever you see fit in terms of closing these separately or just as #89.

@peakschris
Copy link
Author

@cgrindel thank you, windows 👍 , issue with bazel 5 on linux, I've submitted a fix, could you rerun?

@cgrindel
Copy link
Collaborator

cgrindel commented Jul 1, 2024

@peakschris I don't see an Approve button for CI. DId you push your changes?

@peakschris
Copy link
Author

@cgrindel it auto-ran. This CI is now good; passing linux, failing on windows. The windows failures are addressed by #89.

@brentleyjones
Copy link
Collaborator

@peakschris I don't see an Approve button for CI. DId you push your changes?

I pushed it.

@peakschris
Copy link
Author

@cgrindel @keith I have a little time and can take a brief look at getting this and the windows fix PR in if you will have availability to review & kick off CI jobs?

@keith
Copy link
Owner

keith commented Aug 25, 2025

started ci

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.

4 participants