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

"Illegal Character" trying to debug go_test, and passing tests don't show up when run. #3555

Open
bdleitner opened this issue May 1, 2022 · 23 comments
Assignees
Labels
lang: go Go rules integration P3 We're not considering working on this, but happy to review a PR. (No assignee) product: GoLand GoLand plugin topic: testing type: bug

Comments

@bdleitner
Copy link

The problem occurs when run a test in Goland from the "Run/Debug configurations" using bazel test.

If I just run, then the tests run and I can see the results on the console, but the test navigator says "No tests were found" (if they all pass)
No Tests Found - Goland
Note that I have "show passing tests" selected, so the passing tests are expected to show up.

Interestingly, if I change one of the tests to fail, I get...
Failing Test Shows Up
so the failing test shows up and the passing ones do not.

But the original issue I had is that I'm not able to debug. If I click the debug button I get:
Illegal Character

I tried upgrading the bazel plugin (and Goland) since I saw that fixing debugging with go_test was on the list of recent fixes, but the issue persists after all of that, plus doing bazel clean and even nuking my output-user-root directory to force everything to rebuild.

Also note that the illegal character remains at index 116 even if I change the test to have everything commented out, leaving only one empty test method.

Throughout all of this, bazel build and bazel test continue to work from the terminal as expected.

Versions:
Goland: 2022.1
Bazelisk: 1.11.0
Bazel: 5.1.1
Bazel Plugin: 2022.04.28.0.0-api-version-221

@bdleitner
Copy link
Author

For a comparison, I also checked with IntelliJ for my java tests (same bazel plugin version) and it worked fine there, so it does seem to be golang specific.

@bdleitner
Copy link
Author

bdleitner commented May 2, 2022

Further note: I tried adding a .bazelversion file to use version 5.0.0, as that version is noted in the bazel plugin. This did not help, I got the same error.

@sgowroji sgowroji added lang: go Go rules integration type: user support User support more-data-needed Awaiting response from issue author product: GoLand GoLand plugin topic: testing labels Oct 17, 2022
@sgowroji
Copy link
Member

sgowroji commented Oct 17, 2022

Hello @bdleitner, Could you please respond if you are looking support for the above issue and also provide a sample code to verify the same. Thanks!

@bdleitner
Copy link
Author

bdleitner commented Oct 26, 2022 via email

@bdleitner
Copy link
Author

Rechecked with updated Bazel plugin and confirmed the issue still occurs.
Created https://github.com/bdleitner/illegal_char_demo to demo, with code+screenshots.

@sgowroji sgowroji added type: bug awaiting-maintainer Awaiting review from Bazel team on issues and removed type: user support User support more-data-needed Awaiting response from issue author labels Nov 1, 2022
@blorente blorente added the P3 We're not considering working on this, but happy to review a PR. (No assignee) label Nov 4, 2022
@keertk keertk removed the awaiting-maintainer Awaiting review from Bazel team on issues label Mar 17, 2023
@github-actions
Copy link

Thank you for contributing to the IntelliJ repository! This issue has been marked as stale since it has not had any activity in the last 6 months. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-maintainer". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Sep 17, 2023
@bdleitner
Copy link
Author

When I updated he plugin to the 08.29- version, I could no longer reproduce this. It appears this has been fixed.

@github-actions github-actions bot removed the stale Issues or PRs that are stale (no activity for 30 days) label Sep 18, 2023
@blorente
Copy link
Collaborator

Yes, this was fixed a while ago. Sorry for not communicating!

@bdleitner
Copy link
Author

I just ran into this again in Goland 2024.2.1.1 with bazel plugin version 2024.08.27.0.1-api-version-242

@tpasternak
Copy link
Collaborator

Thank you for reporting! @agluszak @jastice can you PTAL? It seems to be a regression

@tpasternak
Copy link
Collaborator

@bdleitner sorry, I was OOO last week, do you use testify, by any chance?

@bdleitner
Copy link
Author

bdleitner commented Sep 27, 2024 via email

@bdleitner
Copy link
Author

Note sure if it's related, I tried doing "run test with coverage" and got:

FAIL: //go/expr/scope:scope_test (see D:/_bazel_out/wr4qdbwt/execroot/_main/bazel-out/x64_windows-fastbuild/testlogs/go/expr/scope/scope_test/test.log)
INFO: From Testing //go/expr/scope:scope_test:
==================== Test output for //go/expr/scope:scope_test:
ERROR(tools/test/windows/tw.cc:1302) ERROR: src/main/native/windows/process.cc(202): CreateProcessW("D:\_bazel_out\wr4qdbwt\execroot\_main\bazel-out\x64_windows-fastbuild\bin\go\expr\scope\scope_test_\scope_test.exe.runfiles\_main\external\bazel_tools\tools\test\collect_coverage.sh"  go/expr/scope/scope_test_/scope_test.exe): The system cannot find the file specified.
 (error: 2)
ERROR(tools/test/windows/tw.cc:1479) Failed to start test process (arg: D:\_bazel_out\wr4qdbwt\execroot\_main\bazel-out\x64_windows-fastbuild\bin\go\expr\scope\scope_test_\scope_test.exe.runfiles\_main\external\bazel_tools\tools\test\collect_coverage.sh)
================================================================================
ERROR: C:/projects/go/monolith/go/expr/scope/BUILD:10:8: output 'go/expr/scope/scope_test/coverage.dat' was not created
ERROR: C:/projects/go/monolith/go/expr/scope/BUILD:10:8: Testing //go/expr/scope:scope_test failed: not all outputs were created or valid
Target //go/expr/scope:scope_test up-to-date:
  bazel-bin/go/expr/scope/scope_test_/scope_test.exe
INFO: Elapsed time: 0.652s, Critical Path: 0.07s
INFO: 2 processes: 2 local.
ERROR: Build did NOT complete successfully
FAILED: 
//go/expr/scope:scope_test                                               FAILED in 0.0s
  D:/_bazel_out/wr4qdbwt/execroot/_main/bazel-out/x64_windows-fastbuild/testlogs/go/expr/scope/scope_test/test.log

Executed 1 out of 1 test: 1 fails locally.
INFO: Build Event Protocol files produced successfully.

exited with error code 1
Executing tests from //go/expr/scope:scope_test
-----------------------------------------------------------------------------
ERROR(tools/test/windows/tw.cc:1302) ERROR: src/main/native/windows/process.cc(202): CreateProcessW("D:\_bazel_out\wr4qdbwt\execroot\_main\bazel-out\x64_windows-fastbuild\bin\go\expr\scope\scope_test_\scope_test.exe.runfiles\_main\external\bazel_tools\tools\test\collect_coverage.sh"  go/expr/scope/scope_test_/scope_test.exe): The system cannot find the file specified.
 (error: 2)
ERROR(tools/test/windows/tw.cc:1479) Failed to start test process (arg: D:\_bazel_out\wr4qdbwt\execroot\_main\bazel-out\x64_windows-fastbuild\bin\go\expr\scope\scope_test_\scope_test.exe.runfiles\_main\external\bazel_tools\tools\test\collect_coverage.sh)

@tpasternak
Copy link
Collaborator

Honestly I think there is an error in the rules you use, and therefore no tests are actually run

@tpasternak
Copy link
Collaborator

Seems that one of the actions declares an output, but fails to create it

@bdleitner
Copy link
Author

Yeah, run with coverage doesn't seem to work because the coverage isn't generated. Seems unrelated to the illegal char issue.

@tpasternak
Copy link
Collaborator

can I close the ticket then?

@bdleitner
Copy link
Author

bdleitner commented Oct 8, 2024 via email

@tpasternak
Copy link
Collaborator

So may I ask you to open a new issue with a repro?

@bdleitner
Copy link
Author

bdleitner commented Oct 8, 2024 via email

@tpasternak
Copy link
Collaborator

oh, misunderstood you

@tpasternak tpasternak reopened this Oct 8, 2024
@tpasternak
Copy link
Collaborator

may I ask you to provide a minimal repro, then?

@bdleitner
Copy link
Author

I've updated my repro at https://github.com/bdleitner/illegal_char_demo to use bzlmod like my other big repo where I'm having the issue, and updated the screenshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: go Go rules integration P3 We're not considering working on this, but happy to review a PR. (No assignee) product: GoLand GoLand plugin topic: testing type: bug
Projects
Status: Untriaged
Development

No branches or pull requests

5 participants