Skip to content

Commit

Permalink
Include runtime deps in test archive (#4569)
Browse files Browse the repository at this point in the history
A collection of small updates that fixes failing unit tests:
* Include runtime_deps files in test archive
* Disable annotations for junit parser (increases parsing speed)
* Continue running tests after suite fails, print failing suites at the
end

b/372303096
b/371590965
  • Loading branch information
oxve authored Dec 21, 2024
1 parent 9ae46a4 commit f7a9b09
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
17 changes: 12 additions & 5 deletions .github/actions/on_host_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ runs:
env
# Explicitly point to libraries in extracted dir.
LD_LIBRARY_PATH="${test_dir}/out/${{ matrix.platform }}_${{ matrix.config }}/starboard"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${test_dir}/out/${{ matrix.platform }}_${{ matrix.config }}"
LD_LIBRARY_PATH="${test_dir}/starboard"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${test_dir}"
export LD_LIBRARY_PATH
# Make results dir available to the archiving step below.
results_dir="${GITHUB_WORKSPACE}/results"
echo "results_dir=${results_dir}" >> $GITHUB_ENV
failed_suites=""
cd ${test_dir}
for test_binary_path in $(ls -d out/**/*tests out/**/nplb); do
test_binary=$(basename "${test_binary_path}")
for test_binary in $(ls {*tests,nplb}); do
echo "Running tests for suite: ${test_binary}"
test_filter="*"
Expand All @@ -57,9 +57,16 @@ runs:
echo "Test filter evaluated to: ${test_filter}"
xml_path="${results_dir}/${test_binary}_testoutput.xml"
/usr/bin/xvfb-run -a --server-args="${XVFB_SERVER_ARGS}" ./$test_binary_path --gtest_filter="${test_filter}" --gtest_output="xml:${xml_path}"
/usr/bin/xvfb-run -a --server-args="${XVFB_SERVER_ARGS}" "./${test_binary}" --gtest_filter="${test_filter}" --gtest_output="xml:${xml_path}" || {
# Set exit code on failure.
failed_suites="${failed_suites} ${test_binary}"
}
done
echo "Finished running all unit tests..."
if [ -n "${failed_suites}" ]; then
echo "Test suites failed:${failed_suites}"
exit 1
fi
- name: Archive Test Results
if: success() || failure()
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/process_test_results/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inputs:
runs:
using: "composite"
steps:
- name: Download Artifacts
- name: Download Test Results
uses: actions/download-artifact@v4
with:
name: ${{ inputs.test_results_key }}
Expand All @@ -21,7 +21,7 @@ runs:
uses: mikepenz/action-junit-report@992d97d6eb2e5f3de985fbf9df6a04386874114d
with:
report_paths: results/*.xml
annotate_only: true
skip_annotations: true

- name: Get Datadog CLI
id: download-dd-cli
Expand Down
13 changes: 10 additions & 3 deletions .github/actions/upload_test_artifacts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ runs:
if: inputs.on_host == 'true'
run: |
set -x
cd src
tar cvf - out/${{ matrix.platform }}_${{ matrix.config }}/*tests out/${{ matrix.platform }}_${{ matrix.config }}/nplb out/${{ matrix.platform }}_${{ matrix.config }}/*.so out/${{ matrix.platform }}_${{ matrix.config }}/*.so.* out/${{ matrix.platform }}_${{ matrix.config }}/starboard/*.so.* out/${{ matrix.platform }}_${{ matrix.config }}/content/test | xz -T0 -1 -z - > test_artifacts.tar.xz
cd src/out/${{ matrix.platform }}_${{ matrix.config }}
test_deps_file="test.deps"
for test_binary in $(ls {nplb,*tests}); do
echo $test_binary
if [ -f "${test_binary}.runtime_deps" ]; then
cat "${test_binary}.runtime_deps" >> "${test_deps_file}"
fi
done
tar cvf - -T "${test_deps_file}" | xz -T0 -1 -z - > "${GITHUB_WORKSPACE}/test_artifacts.tar.xz"
shell: bash
- name: Upload On-Host Test Artifacts Archive
if: inputs.on_host == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.test_artifacts_key }}
path: src/test_artifacts.tar.xz
path: test_artifacts.tar.xz
retention-days: 3

0 comments on commit f7a9b09

Please sign in to comment.