Skip to content

ci: refactor test_helper.sh#4209

Merged
vvbandeira merged 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:ext-plat
May 5, 2026
Merged

ci: refactor test_helper.sh#4209
vvbandeira merged 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:ext-plat

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors test_helper.sh to introduce named command-line arguments, a usage menu, and more robust make command execution using Bash arrays. Review feedback highlights a potential crash in the new argument parsing logic if an option is provided without a value and suggests using here-strings instead of process substitution for better Bash idiomaticity.

Comment thread flow/test/test_helper.sh
Comment on lines +58 to +65
--design) DESIGN_NAME=$2; shift 2 ;;
--platform) PLATFORM=$2; shift 2 ;;
--config) CONFIG_MK=$2; shift 2 ;;
--design-path) DESIGN_PATH=$2; shift 2 ;;
--variant) FLOW_VARIANT=$2; shift 2 ;;
--target) TARGET=$2; shift 2 ;;
--work-home) WORK_HOME=$2; shift 2 ;;
--private-dir) PRIVATE_DIR=$2; shift 2 ;;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The current flag parsing logic uses shift 2 for options that require an argument (e.g., --design, --platform). If an option is provided as the last argument without a value, shift 2 will fail because the shift count exceeds the number of remaining arguments. Since set -e is active, this will cause the script to crash with a shift count out of range error. Additionally, if another flag follows an option that expects a value (e.g., --design --platform), the second flag will be incorrectly assigned as the value for the first option. Consider adding a check to ensure an argument is present before shifting.

Comment thread flow/test/test_helper.sh
TARGETS=$($__make -np | grep -e '^[^ ]*:')
if [ $ret -eq 0 ] && grep -q 'simulate:' <(echo $TARGETS); then
TARGETS=$("${__make[@]}" -np | grep -e '^[^ ]*:')
if [ $ret -eq 0 ] && grep -q 'simulate:' <(echo "$TARGETS"); then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency with the use of here-strings elsewhere in the script (e.g., line 92), you can use <<< "$TARGETS" instead of <(echo "$TARGETS"). This is more idiomatic in Bash and avoids spawning a subshell for echo.

Suggested change
if [ $ret -eq 0 ] && grep -q 'simulate:' <(echo "$TARGETS"); then
if [ $ret -eq 0 ] && grep -q 'simulate:' <<< "$TARGETS"; then

@vvbandeira vvbandeira merged commit b062a54 into The-OpenROAD-Project:master May 5, 2026
6 of 8 checks passed
@vvbandeira vvbandeira deleted the ext-plat branch May 5, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants