-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathaction.yaml
More file actions
127 lines (115 loc) · 4.71 KB
/
Copy pathaction.yaml
File metadata and controls
127 lines (115 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: On Host Tests
description: Runs on-host tests.
inputs:
nightly:
description: "Indicates if this is a nightly job."
required: true
test_artifacts_key:
description: "Artifact key used to store test artifacts."
required: true
test_results_key:
description: "Artifact key used to store test results."
required: true
num_gtest_shards:
description: "Total number of shards used to run the steps in this file."
required: true
run_id:
description: "The run ID to download artifacts from."
default: ""
github_token:
description: "GitHub token for downloading artifacts from another run."
default: ""
runs:
using: "composite"
steps:
- name: Download Artifacts (Current Run)
if: ${{ inputs.run_id == '' }}
uses: actions/download-artifact@v5
with:
name: ${{ inputs.test_artifacts_key }}
- name: Download Artifacts (Previous Run)
if: ${{ inputs.run_id != '' }}
uses: actions/download-artifact@v5
with:
name: ${{ inputs.test_artifacts_key }}
run-id: ${{ inputs.run_id }}
github-token: ${{ inputs.github_token }}
- name: Extract Artifacts
shell: bash
run: |
set -x
mkdir -p unit_test/
cd unit_test/
tar -I 'zstd -T0' -xf ../test_artifacts.tar.zstd
- name: Run Tests
id: run-tests
shell: bash
env:
XVFB_SERVER_ARGS: "-screen 0 1920x1080x24i +render +extension GLX -noreset"
GTEST_SHARD_INDEX: ${{ matrix.shard }}
GTEST_TOTAL_SHARDS: ${{ inputs.num_gtest_shards }}
run: |
set -x
env
out_dir="${GITHUB_WORKSPACE}/unit_test/out/${{ matrix.platform}}_${{ matrix.config }}"
# TODO: LD_LIBRARY_PATH should not include the starboard subdirectory.
LD_LIBRARY_PATH="${out_dir}/starboard"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${out_dir}"
export LD_LIBRARY_PATH
# TODO: b/467135717 - Remove this once tests don't have asan leaks.
# Don't fail if only asan fails.
export ASAN_OPTIONS=exitcode=0
# Make results dir available to the archiving step below.
results_dir="${GITHUB_WORKSPACE}/results"
echo "results_dir=${results_dir}" >> $GITHUB_ENV
# Test results (xml and logs) must be in a subfolder in results_dir
# to be picked up by the test result processor.
# This also prevents accidental overwriting when collecting results.
test_output="${results_dir}/shard_${{ matrix.shard }}"
mkdir -p ${test_output}
failed_suites=""
cd unit_test/
for test_binary_path in $(cat out/${{ matrix.platform }}_${{ matrix.config }}/test_targets.json | jq -cr '.executables | join(" ")'); do
filename=$(basename "${test_binary_path}")
test_binary="${filename%%.*}"
echo "Running tests for suite: ${test_binary}"
test_filter="*"
test_filter_json_dir="${GITHUB_WORKSPACE}/cobalt/testing/filters/${{ matrix.platform }}/${test_binary}_filter.json"
if [ -f ${test_filter_json_dir} ]; then
test_filter=`jq -r '"-" + (.failing_tests | join(":"))' ${test_filter_json_dir}`
fi
echo "Test filter evaluated to: ${test_filter}"
xml_path="${test_output}/${test_binary}_result.xml"
log_path="${test_output}/${test_binary}_log.txt"
# TODO: Investigate test_runner.py
ENTRYPOINT=./"${test_binary_path}"
if [ "${test_filter}" == "-*" ]; then
echo "Skipped due to test filter." > ${log_path}
else
/usr/bin/xvfb-run -a --server-args="${XVFB_SERVER_ARGS}" \
stdbuf -i0 -o0 -e0 $ENTRYPOINT \
--single-process-tests \
--gtest_shard_index="${GTEST_SHARD_INDEX}" \
--gtest_total_shards="${GTEST_TOTAL_SHARDS}" \
--gtest_output="xml:${xml_path}" \
--gtest_filter="${test_filter}" 2>&1 | tee ${log_path} || {
failed_suites="${failed_suites} ${test_binary}"
}
if [[ ! -f ${xml_path} ]]; then
# Test binary crashed. Generate a fake JUnit XML report with the last run test.
python3 ${GITHUB_WORKSPACE}/.github/scripts/generate_crash_report.py "${log_path}" "${xml_path}"
fi
fi
done
echo "Finished running tests..."
if [[ -n "${failed_suites}" ]]; then
echo "Test suites failed:${failed_suites}"
# Fail the job so it's easy to retrigger.
exit 1
fi
- name: Archive Test Results
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.test_results_key }}
path: ${{ env.results_dir }}/*