Skip to content

Commit 8e7bb08

Browse files
Add boilerplate code for vulkan unit tests
Vulkan unit tests require a basic vulkan application to run. This adds the boilerplate code for a simple vulkan application. Bug: 388189326 Flag: EXEMPT test Test: atest libvulkan_test Change-Id: I59e2240b4c34b39af9b7f5927cb23f0926e4cf8a
1 parent 9a3ad9b commit 8e7bb08

3 files changed

Lines changed: 440 additions & 0 deletions

File tree

vulkan/tests/Android.bp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package {
2+
// See: http://go/android-license-faq
3+
// A large-scale-change added 'default_applicable_licenses' to import
4+
// all of the 'license_kinds' from "frameworks_native_license"
5+
// to get the below license kinds:
6+
// SPDX-license-identifier-Apache-2.0
7+
default_applicable_licenses: ["frameworks_native_license"],
8+
}
9+
10+
cc_test {
11+
name: "libvulkan_test",
12+
test_suites: ["general-tests"],
13+
14+
srcs: [
15+
"libvulkan_test.cpp",
16+
],
17+
18+
strip: {
19+
none: true,
20+
},
21+
22+
cflags: [
23+
"-DVK_USE_PLATFORM_ANDROID_KHR",
24+
"-Wall",
25+
"-Werror",
26+
],
27+
28+
header_libs: [
29+
"hwvulkan_headers",
30+
"vulkan_headers",
31+
],
32+
33+
cppflags: [
34+
"-Wno-c++98-compat-pedantic",
35+
"-Wno-c99-extensions",
36+
"-Wno-exit-time-destructors",
37+
"-Wno-float-equal",
38+
"-Wno-global-constructors",
39+
"-Wno-zero-length-array",
40+
],
41+
42+
shared_libs: [
43+
"libbase",
44+
"libgraphicsenv",
45+
"liblog",
46+
"libmediandk",
47+
"libvulkan",
48+
],
49+
50+
static_libs: [
51+
"libgmock",
52+
"libgtest",
53+
"liblog",
54+
],
55+
56+
}

vulkan/tests/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#libvulkan_test
2+
3+
This binary contains the unit tests for testing libvulkan (The Vulkan Loader).
4+
5+
These tests rely on the underlying GPU driver to be able to successfully create a valid
6+
swapchain. These tests are design to run on an Android emulator to give us a consistent GPU
7+
driver to test against. YMMV when running this on a physical device with an arbitrary GPU
8+
driver.
9+
10+
To run these tests run:
11+
```
12+
atest libvulkan_test
13+
```
14+
15+
If using an acloud device the full command list for the root of a freshly cloned repo would be:
16+
```
17+
source build/envsetup.sh
18+
lunch aosp_cf_x86_64_phone-trunk_staging-eng
19+
m
20+
acloud create --local-image
21+
atest libvulkan_test
22+
```
23+
24+

0 commit comments

Comments
 (0)