Skip to content

chore(ci): optimize kokoro system tests with concurrency#17444

Open
ohmayr wants to merge 2 commits into
mainfrom
parallel-execute-system-tests
Open

chore(ci): optimize kokoro system tests with concurrency#17444
ohmayr wants to merge 2 commits into
mainfrom
parallel-execute-system-tests

Conversation

@ohmayr

@ohmayr ohmayr commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Replaced the sequential run_package_test loop with a fan-out execution using xargs -P 8.

Results in: #17446

@ohmayr ohmayr marked this pull request as ready for review June 12, 2026 08:24
@ohmayr ohmayr requested a review from a team as a code owner June 12, 2026 08:24

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

Copy link
Copy Markdown
Contributor

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 parallelizes package testing in '.kokoro/system.sh' using 'xargs' to run up to 8 tests concurrently. However, a critical issue was identified where 'xargs -I {}' treats the entire space-separated string of packages as a single argument, which will cause the tests to fail. A suggestion was provided to output each package on a new line using 'printf' before passing them to 'xargs'.

Comment thread .kokoro/system.sh Outdated
export -f run_package_test
export system_test_script PROJECT_ROOT KOKORO_GFILE_DIR

echo "$PACKAGES_TO_TEST" | xargs -n 1 -P 8 -I {} bash -c 'run_package_test "{}" > ".logs/{}.log" 2>&1 || touch ".logs/{}.failed"'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Using xargs -I {} changes the delimiter to newline only, meaning it ignores spaces and treats the entire line as a single item. Since echo "$PACKAGES_TO_TEST" outputs all packages on a single space-separated line, xargs will execute the command only once, passing the entire string of packages as a single argument (e.g., run_package_test "pkg1 pkg2 pkg3"). This will cause the tests to fail.

To fix this, output each package on a new line using printf "%s\n" $PACKAGES_TO_TEST (unquoted so that it splits on whitespace) and remove the redundant -n 1 flag.

Suggested change
echo "$PACKAGES_TO_TEST" | xargs -n 1 -P 8 -I {} bash -c 'run_package_test "{}" > ".logs/{}.log" 2>&1 || touch ".logs/{}.failed"'
printf "%s\n" $PACKAGES_TO_TEST | xargs -P 8 -I {} bash -c 'run_package_test "{}" > ".logs/{}.log" 2>&1 || touch ".logs/{}.failed"'

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.

1 participant