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

Shellcheck some test scripts #10797

Merged
merged 2 commits into from
May 29, 2024
Merged

Conversation

Ericson2314
Copy link
Member

Motivation

See the issue.

Context

Progress on #10795

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Ericson2314 Ericson2314 requested review from roberth and removed request for edolstra May 28, 2024 14:26
@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label May 28, 2024
@Ericson2314 Ericson2314 force-pushed the shellcheck-tests branch 2 times, most recently from af6c6d0 to 7043fad Compare May 28, 2024 15:02
mk/common-test.sh Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

These files aren't executable, and the presence of a shebang would suggest that that's by mistake.
I'd prefer the shellcheck hint, # shellcheck shell=bash.

Copy link
Member

Choose a reason for hiding this comment

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

Actually we could come up with a proper shebang, but if the interpreter is a script, it doesn't work on mac, so we might need a helper in the dev shell.
Also shellcheck wouldn't recognize the helper as bash, so we're going to need the hint anyway.

Copy link
Member Author

@Ericson2314 Ericson2314 May 28, 2024

Choose a reason for hiding this comment

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

@roberth I think we could just make them executable. They are self-contained unlike the fragments.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it's quite right.
We should then also apply the bash options from common-test.sh, and always go through the shebang instead of a non-standard invocation with $BASH.
Even then, I'm not sure running tests without TESTS_ENVIRONMENT is a sufficiently non-bad idea that we should seduce contributors into running them this way.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I would rather just get rid of TESTS_ENVIRONMENT! :)

tests/functional/build-remote-trustless-after.sh Outdated Show resolved Hide resolved
tests/functional/build-remote.sh Outdated Show resolved Hide resolved
This is good for shebang, and also good for future build system
simplifications
@roberth roberth merged commit 5df4222 into NixOS:master May 29, 2024
9 checks passed
@Ericson2314 Ericson2314 deleted the shellcheck-tests branch May 29, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants