xref: /aosp_15_r20/external/swiftshader/tests/kokoro/macos/continuous.sh (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1#!/bin/bash
2
3# Fail on any error.
4set -e
5# Display commands being run.
6set -x
7
8cmake --version
9
10cd git/SwiftShader
11
12mkdir -p build && cd build
13
14if [[ -z "${REACTOR_BACKEND}" ]]; then
15  REACTOR_BACKEND="LLVM"
16fi
17
18# Lower the amount of debug info, to reduce Kokoro build times.
19SWIFTSHADER_LESS_DEBUG_INFO=1
20
21# Disable ASAN checks for debug builds, to reduce Kokoro build times.
22# ASAN builds are recommended to be optimized.
23ASAN="ON"
24if [[ "${BUILD_TYPE}" == "Debug" ]]; then
25  ASAN="OFF"
26fi
27
28cmake .. \
29    "-DSWIFTSHADER_ASAN=${ASAN}" \
30    "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" \
31    "-DREACTOR_BACKEND=${REACTOR_BACKEND}" \
32    "-DSWIFTSHADER_LLVM_VERSION=${LLVM_VERSION}" \
33    "-DREACTOR_VERIFY_LLVM_IR=1" \
34    "-DSWIFTSHADER_LESS_DEBUG_INFO=${SWIFTSHADER_LESS_DEBUG_INFO}" \
35    "-DSWIFTSHADER_BUILD_BENCHMARKS=1"
36cmake --build . -- -j$(sysctl -n hw.logicalcpu)
37
38# Run unit tests
39
40cd .. # Some tests must be run from project root
41
42build/ReactorUnitTests
43build/system-unittests
44build/vk-unittests
45
46# Incrementally build and run rr::Print unit tests
47cd build
48cmake .. "-DREACTOR_ENABLE_PRINT=1"
49cmake --build . --target ReactorUnitTests -- -j$(sysctl -n hw.logicalcpu)
50cd ..
51build/ReactorUnitTests --gtest_filter=ReactorUnitTests.Print*
52