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

Analysis tests generate scripts without a shebang #18940

Open
keddad opened this issue Jul 14, 2023 · 2 comments
Open

Analysis tests generate scripts without a shebang #18940

keddad opened this issue Jul 14, 2023 · 2 comments
Assignees
Labels

Comments

@keddad
Copy link
Contributor

keddad commented Jul 14, 2023

Description of the bug:

Analysis tests automatically create a script with the test result, consisting of test messages and exit (0/1). It generally works nice. However, I've noticed that generated bash scripts don't contain a shebang. This means that if the test is built with Bazel, but runs with some outside tool, it might not be able to run such script without certain hacks which shouldn't be necessary.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Just build any analysis test on Linux and look at the generated script. No shebang.

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

6.1.0-12

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

I'm quite sure it can be fixed with a small fix to AnalysisTestActionBuilder, something along the lines of

if (isExecutedOnWindows) {
    sb.append("@echo off\n");
} else {
    sb.append("#/bin/sh")
}
@iancha1992
Copy link
Member

iancha1992 commented Jul 14, 2023

Hi @keddad. Thanks for letting us know about this. Can we have a snapshot of your output or logs (with no shebangs)? That'd be very helpful. Thanks.

@fmeum
Copy link
Collaborator

fmeum commented Jul 15, 2023

@iancha1992 The missing shebang line is pretty clear from the piece of code @keddad linked, so I don't think we need to see logs.

Ownership for this very particular action is probably hard to determine, but @rickeylev seems to be a good fit.

@iancha1992 iancha1992 added the team-Rules-Python Native rules for Python label Jul 17, 2023
copybara-service bot pushed a commit that referenced this issue Oct 11, 2023
See #18940 for more details. I've also wanted to update the tests, but it seems that this code doesn't have any test coverage (or I couldn't find it). To be fair, it is probably simple enough to not need it.

Closes #19780.

PiperOrigin-RevId: 572627238
Change-Id: I3685e782833712199a2696ac67477b9f2bb2f7ae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants