Skip to content

Commit c1c26df

Browse files
committed
Add a presubmit workflow for running tests with ASAN enabled
Bug: b/475867040 Test: Github CI
1 parent b7c1777 commit c1c26df

File tree

2 files changed

+97
-75
lines changed

2 files changed

+97
-75
lines changed

.github/workflows/presubmit.yaml

Lines changed: 22 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -13,81 +13,26 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16-
run-gfxstream-bazel-end2end-tests:
17-
runs-on: ubuntu-22.04
18-
steps:
19-
- name: Free disk space
20-
uses: jlumbroso/free-disk-space@v1.3.1
21-
with:
22-
tool-cache: true
23-
- name: Checkout repository
24-
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
25-
- name: Install bazel
26-
run: sudo bash toolchain/bazel/install_bazel.sh
27-
- name: Install toolchain dependencies
28-
run: sudo bash toolchain/bazel/install_toolchain_dependencies.sh
29-
- name: Install runtime dependencies
30-
run: sudo apt-get install -y libvulkan1
31-
- name: Load cache config
32-
run: cat .config/cache-config.env >> $GITHUB_ENV
33-
- name: Mount Bazel cache
34-
uses: actions/cache/restore@v4
35-
with:
36-
path: "~/bazel-disk-cache"
37-
key: ${{ format('{0}-{1}-bazel-disk-cache-{2}-{3}-{4}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name, github.sha) }}
38-
restore-keys: |
39-
${{ format('{0}-{1}-bazel-disk-cache-{2}-{3}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name) || '' }}
40-
${{ format('{0}-{1}-bazel-disk-cache-{2}-main-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
41-
${{ format('{0}-{1}-bazel-disk-cache-{2}-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
42-
- name: Build
43-
run: |
44-
bazel build ... \
45-
--disk_cache=$HOME/bazel-disk-cache \
46-
--graphics_drivers=gles_angle_vulkan_swiftshader \
47-
--verbose_failures
48-
- name: Run unit tests
49-
run: |
50-
bazel test \
51-
--disk_cache=$HOME/bazel-disk-cache \
52-
--graphics_drivers=gles_angle_vulkan_swiftshader \
53-
--test_output=streamed \
54-
--verbose_failures \
55-
host:gfxstream_framebuffer_tests \
56-
host/vulkan:gfxstream_compositorvk_tests \
57-
host/vulkan:gfxstream_emulatedphysicalmemory_tests \
58-
tests/end2end:gfxstream_end2end_tests
59-
run-gfxstream-bazel-end2end-tests-arm:
60-
runs-on: ubuntu-22.04-arm
61-
steps:
62-
- name: Free disk space
63-
uses: jlumbroso/free-disk-space@v1.3.1
64-
with:
65-
tool-cache: true
66-
- name: Checkout repository
67-
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
68-
- name: Install bazel
69-
run: sudo bash toolchain/bazel/install_bazel.sh
70-
- name: Install toolchain dependencies
71-
run: sudo bash toolchain/bazel/install_toolchain_dependencies.sh
72-
- name: Install runtime dependencies
73-
run: sudo apt-get install -y libvulkan1
74-
- name: Load cache config
75-
run: cat .config/cache-config.env >> $GITHUB_ENV
76-
- name: Mount Bazel cache
77-
uses: actions/cache/restore@v4
78-
with:
79-
path: "~/bazel-disk-cache"
80-
key: ${{ format('{0}-{1}-bazel-disk-cache-{2}-{3}-{4}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name, github.sha) }}
81-
restore-keys: |
82-
${{ format('{0}-{1}-bazel-disk-cache-{2}-{3}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name) || '' }}
83-
${{ format('{0}-{1}-bazel-disk-cache-{2}-main-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
84-
${{ format('{0}-{1}-bazel-disk-cache-{2}-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
85-
- name: Build
86-
run: |
87-
bazel build ... \
88-
--disk_cache=$HOME/bazel-disk-cache \
89-
--graphics_drivers=gles_angle_vulkan_swiftshader \
90-
--verbose_failures
16+
run-gfxstream-bazel-tests:
17+
uses: ./.github/workflows/presubmit_bazel.yml
18+
with:
19+
runner: ubuntu-22.04
20+
21+
run-gfxstream-bazel-tests-asan:
22+
uses: ./.github/workflows/presubmit_bazel.yml
23+
with:
24+
# TODO(b/475886246): fix and remove `detect_leaks=0`
25+
# TODO(b/475885975): fix and remove `detect_odr_violation=0`
26+
additional-bazel-args: --config=asan --test_env="ASAN_OPTIONS=detect_leaks=0:detect_odr_violation=0"
27+
runner: ubuntu-22.04
28+
29+
run-gfxstream-bazel-tests-arm:
30+
uses: ./.github/workflows/presubmit_bazel.yml
31+
with:
32+
runner: ubuntu-22.04-arm
33+
# The arm runner is too slow:
34+
run-tests: false
35+
9136
run-gfxstream-cmake-build:
9237
runs-on: ubuntu-22.04
9338
steps:
@@ -108,6 +53,7 @@ jobs:
10853
run: |
10954
cd build && \
11055
ninja
56+
11157
run-gfxstream-meson-build:
11258
runs-on: ubuntu-22.04
11359
steps:
@@ -128,6 +74,7 @@ jobs:
12874
- name: Build
12975
run: |
13076
meson compile -C build
77+
13178
run-gfxstream-meson-build-windows:
13279
runs-on: windows-latest
13380
defaults:
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build and run Gfxstream tests via Bazel
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
# Which github runner to use:
7+
runner:
8+
type: string
9+
required: true
10+
11+
# Additional args used in `bazel build <args>` and `bazel test <args>`:
12+
additional-bazel-args:
13+
type: string
14+
default: ''
15+
16+
# Whether or not to run the `bazel test` step:
17+
run-tests:
18+
type: boolean
19+
default: true
20+
21+
jobs:
22+
presubmit_bazel_workflow:
23+
runs-on: ${{ inputs.runner }}
24+
steps:
25+
- name: Free disk space
26+
uses: jlumbroso/free-disk-space@v1.3.1
27+
with:
28+
tool-cache: true
29+
30+
- name: Checkout repository
31+
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
32+
33+
- name: Install bazel
34+
run: sudo bash toolchain/bazel/install_bazel.sh
35+
36+
- name: Install toolchain dependencies
37+
run: sudo bash toolchain/bazel/install_toolchain_dependencies.sh
38+
39+
- name: Install runtime dependencies
40+
run: sudo apt-get install -y libvulkan1
41+
42+
- name: Load cache config
43+
run: cat .config/cache-config.env >> $GITHUB_ENV
44+
45+
- name: Mount Bazel cache
46+
uses: actions/cache/restore@v4
47+
with:
48+
path: "~/bazel-disk-cache"
49+
key: ${{ format('{0}-{1}-bazel-disk-cache-{2}-{3}-{4}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name, github.sha) }}
50+
restore-keys: |
51+
${{ format('{0}-{1}-bazel-disk-cache-{2}-{3}-', runner.os, runner.arch, env.CACHE_VERSION, github.ref_name) || '' }}
52+
${{ format('{0}-{1}-bazel-disk-cache-{2}-main-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
53+
${{ format('{0}-{1}-bazel-disk-cache-{2}-', runner.os, runner.arch, env.CACHE_VERSION) || '' }}
54+
55+
- name: Build
56+
run: |
57+
bazel build ... \
58+
--disk_cache=$HOME/bazel-disk-cache \
59+
--graphics_drivers=gles_angle_vulkan_swiftshader \
60+
--verbose_failures \
61+
${{ inputs.additional-bazel-args }}
62+
63+
- name: Test
64+
if: ${{ inputs.run-tests }}
65+
run: |
66+
bazel test \
67+
--disk_cache=$HOME/bazel-disk-cache \
68+
--graphics_drivers=gles_angle_vulkan_swiftshader \
69+
--test_output=streamed \
70+
--verbose_failures \
71+
host:gfxstream_framebuffer_tests \
72+
host/vulkan:gfxstream_compositorvk_tests \
73+
host/vulkan:gfxstream_emulatedphysicalmemory_tests \
74+
tests/end2end:gfxstream_end2end_tests \
75+
${{ inputs.additional-bazel-args }}

0 commit comments

Comments
 (0)