intellij icon indicating copy to clipboard operation
intellij copied to clipboard

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

Open bdleitner opened this issue 3 years ago • 25 comments

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 avatar May 01 '22 19:05 bdleitner

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 avatar May 01 '22 23:05 bdleitner

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.

bdleitner avatar May 02 '22 03:05 bdleitner

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!

sgowroji avatar Oct 17 '22 08:10 sgowroji

Sorry for the delayed response. Yes, I'm still looking for support if it's still happening. I didn't have a chance to test it out this weekend. I will try and repro this evening or next after seeing if there are any updates and I'll post a repo to github with a minimal reproducible example.

But when last I checked it was happening for all tests I tried to debug. Literally a dummy setup of "here's a method that returns 1" and "here's a test that verifies it returns 1" (to pass) or "here's a method that verifies it returns 2" (to fail) had the problem.

On Mon, Oct 17, 2022 at 1:00 AM Gowroji Sunil @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/bazelbuild/intellij/issues/3555#issuecomment-1280445192, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZKXDTQB2PXIY46RCIEAH3WDUBR7ANCNFSM5U2I6J7Q . You are receiving this because you were mentioned.Message ID: @.***>

bdleitner avatar Oct 26 '22 15:10 bdleitner

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

bdleitner avatar Oct 27 '22 01:10 bdleitner

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[bot] avatar Sep 17 '23 01:09 github-actions[bot]

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

bdleitner avatar Sep 17 '23 03:09 bdleitner

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

blorente avatar Sep 19 '23 08:09 blorente

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

bdleitner avatar Sep 15 '24 06:09 bdleitner

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

tpasternak avatar Sep 16 '24 06:09 tpasternak

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

tpasternak avatar Sep 25 '24 12:09 tpasternak

On Wed, Sep 25, 2024 at 5:03 AM Tomasz Pasternak @.***> wrote:

@bdleitner https://github.com/bdleitner sorry, I was OOO last week, do you use testify, by any chance?

I do not (not familiar with it).

— Reply to this email directly, view it on GitHub https://github.com/bazelbuild/intellij/issues/3555#issuecomment-2373890373, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZKXDRY6RTAMS6NU2FK3M3ZYKRB5AVCNFSM6AAAAABOHQGXBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZTHA4TAMZXGM . You are receiving this because you were mentioned.Message ID: @.***>

bdleitner avatar Sep 27 '24 16:09 bdleitner

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)

bdleitner avatar Oct 05 '24 23:10 bdleitner

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

tpasternak avatar Oct 08 '24 15:10 tpasternak

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

tpasternak avatar Oct 08 '24 15:10 tpasternak

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

bdleitner avatar Oct 08 '24 15:10 bdleitner

can I close the ticket then?

tpasternak avatar Oct 08 '24 16:10 tpasternak

The thing about coverage not working was an aside that I thought at first might be related. It seems not to be, but the last time I tried anything the illegal character issue on trying to debug tests was still active.

I should have kept the coverage thing separate; sorry for the confusion.

On Tue, Oct 8, 2024, 09:08 Tomasz Pasternak @.***> wrote:

can I close the ticket then?

— Reply to this email directly, view it on GitHub https://github.com/bazelbuild/intellij/issues/3555#issuecomment-2400258014, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZKXDQX6X4P3RTJDCPFSS3Z2P7OZAVCNFSM6AAAAABOHQGXBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBQGI2TQMBRGQ . You are receiving this because you were mentioned.Message ID: @.***>

bdleitner avatar Oct 08 '24 16:10 bdleitner

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

tpasternak avatar Oct 08 '24 17:10 tpasternak

Wait... Is the illegal character issue fixed? Do you know when the fix will go out?

I mentioned another problem I ran into on this bug, thinking at first it might be connected. As it turns out, it's not. I can file a separate issue for that with more information for a repro, bit that has nothing to do with the illegal character bug, so unless that issue is fixed, this should stay open.

On Tue, Oct 8, 2024, 10:30 Tomasz Pasternak @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/bazelbuild/intellij/issues/3555#issuecomment-2400441073, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZKXDRZ5C3C6VOEPTQRH5TZ2QJD7AVCNFSM6AAAAABOHQGXBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBQGQ2DCMBXGM . You are receiving this because you were mentioned.Message ID: @.***>

bdleitner avatar Oct 08 '24 17:10 bdleitner

oh, misunderstood you

tpasternak avatar Oct 08 '24 18:10 tpasternak

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

tpasternak avatar Oct 08 '24 18:10 tpasternak

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.

bdleitner avatar Oct 09 '24 03:10 bdleitner

Issue reproduces in Goland 2024.2.1.1 on Windows but not on macOS.

iliakondratev avatar Oct 14 '24 14:10 iliakondratev

image

Debugging the given example as go_binary on Windows isn't functioning too, showing a different error message

iliakondratev avatar Oct 16 '24 16:10 iliakondratev

Fixed in #6938

tpasternak avatar Oct 30 '24 13:10 tpasternak