-
Notifications
You must be signed in to change notification settings - Fork 46
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
clean-up: move all shell script code to a function and use a "main" #740
Labels
good first issue
Good for newcomers
P3
Low-impact bugs or features
type:discussion
Open ended discussion topic
type:enhancement
New framework feature or request
Comments
marc-hb
added
P3
Low-impact bugs or features
good first issue
Good for newcomers
type:discussion
Open ended discussion topic
type:enhancement
New framework feature or request
labels
Jul 14, 2021
marc-hb
added a commit
to marc-hb/sof
that referenced
this issue
Jul 25, 2021
Adds --error-exitcode=1 to valgrind options (otherwise what's the point of using valgrind?) Skip alloc test that does not pass on HOST (passes with xt-run) Add help message. Runnable from anywhere. Use shell functions thesofproject/sof-test#740 Fix all quoting issues and other shellcheck warnings. Add comments. Signed-off-by: Marc Herbert <[email protected]>
marc-hb
added a commit
to marc-hb/sof
that referenced
this issue
Jul 25, 2021
Adds --error-exitcode=1 to valgrind options (otherwise what's the point of using valgrind?) Skip alloc test that does not pass on HOST (passes with xt-run) Add help message. Runnable from anywhere. Use shell functions thesofproject/sof-test#740 Fix all quoting issues and other shellcheck warnings. Add comments. Signed-off-by: Marc Herbert <[email protected]>
lgirdwood
pushed a commit
to thesofproject/sof
that referenced
this issue
Jul 26, 2021
Adds --error-exitcode=1 to valgrind options (otherwise what's the point of using valgrind?) Skip alloc test that does not pass on HOST (passes with xt-run) Add help message. Runnable from anywhere. Use shell functions thesofproject/sof-test#740 Fix all quoting issues and other shellcheck warnings. Add comments. Signed-off-by: Marc Herbert <[email protected]>
marc-hb
added a commit
to marc-hb/sof-test
that referenced
this issue
Oct 15, 2021
Rationale in thesofproject#740 Signed-off-by: Marc Herbert <[email protected]>
marc-hb
added a commit
that referenced
this issue
Oct 18, 2021
Rationale in #740 Signed-off-by: Marc Herbert <[email protected]>
marc-hb
changed the title
clean-up: move all shell scripts code to a function
clean-up: move all shell script code to a function
Jan 11, 2022
marc-hb
added a commit
to marc-hb/sof-test
that referenced
this issue
Jun 10, 2022
Per rationale detailed in thesofproject#740. Also add new $TOPDIR constant. Absolutely zero functional change. Signed-off-by: Marc Herbert <[email protected]>
marc-hb
added a commit
that referenced
this issue
Jun 17, 2022
Per rationale detailed in #740. Also add new $TOPDIR constant. Absolutely zero functional change. Signed-off-by: Marc Herbert <[email protected]>
This was referenced Sep 28, 2023
marc-hb
changed the title
clean-up: move all shell script code to a function
clean-up: move all shell script code to a function and use a "main"
Apr 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
good first issue
Good for newcomers
P3
Low-impact bugs or features
type:discussion
Open ended discussion topic
type:enhancement
New framework feature or request
This a very generic, clean-up task. Its main purpose is to document this good practice: almost all the code in a shell script should be in a function. In other words, the smallest script should look like this:
Rationales:
local
. This reduces the risk of accidentally overwriting some user environment variables (side effects)main "$@"
line andsource
the entire file without running it to test individual functions interactively (almost like the usual Python's__main__
trick)if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then run_main; fi
And last but not least, stating the obvious:
cc:
The text was updated successfully, but these errors were encountered: