Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .buildkite/scripts/hardware_ci/run-amd-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ is_multi_node() {
return 1
}

handle_pytest_exit() {
local exit_code=$1
if [ "$exit_code" -eq 5 ]; then
echo "Pytest exit code 5 (no tests collected) - treating as success."
exit 0
fi
exit "$exit_code"
}

###############################################################################
# Pytest marker/keyword re-quoting
#
Expand Down Expand Up @@ -135,8 +144,9 @@ re_quote_pytest_markers() {
local collecting=false
local marker_buf=""

# Flatten newlines for consistent tokenization
local flat="${input//$'\n'/ }"
# Strip backslash-newline continuations, then flatten remaining newlines
local flat="${input//$'\\\n'/ }"
flat="${flat//$'\n'/ }"

# Disable globbing to prevent *.py etc. from expanding during read -ra
local restore_glob
Expand Down Expand Up @@ -164,6 +174,9 @@ re_quote_pytest_markers() {

local is_boundary=false
case "$word" in
# Line-continuation artifact
"\\")
is_boundary=true ;;
# Command separators
"&&"|"||"|";"|"|")
is_boundary=true ;;
Expand Down Expand Up @@ -204,6 +217,9 @@ re_quote_pytest_markers() {
if [[ "$word" == "-m" || "$word" == "-k" ]]; then
output+="${word} "
collecting=true
# Drop stray backslash tokens silently
elif [[ "$word" == "\\" ]]; then
:
else
output+="${word} "
fi
Expand Down Expand Up @@ -453,7 +469,9 @@ if is_multi_node "$commands"; then
done

/bin/bash -c "${composite_command}"
exit_code=$?
cleanup_network
handle_pytest_exit "$exit_code"
else
echo "Multi-node job detected but failed to parse bracket command syntax."
echo "Expected format: prefix ; [node0_cmd1, node0_cmd2] && [node1_cmd1, node1_cmd2]"
Expand All @@ -480,4 +498,7 @@ else
--name "${container_name}" \
"${image_name}" \
/bin/bash -c "${commands}"

exit_code=$?
handle_pytest_exit "$exit_code"
fi