• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright 2018 The Amber Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16set -e  # fail on error
17set -x  # show commands
18
19BUILD_ROOT=$PWD
20SRC=$PWD/github/amber
21BUILD_TYPE=$1
22shift
23EXTRA_CONFIG=$@
24
25# Get ninja
26wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
27unzip -q ninja-mac.zip
28chmod +x ninja
29export PATH="$PWD:$PATH"
30
31echo $(date): $(cmake --version)
32
33DEPS_ARGS=""
34if [[ "$EXTRA_CONFIG" =~ "ENABLE_SWIFTSHADER=TRUE" ]]; then
35  DEPS_ARGS+=" --with-swiftshader"
36fi
37
38cd $SRC
39./tools/git-sync-deps $DEPS_ARGS
40
41mkdir build && cd $SRC/build
42
43CMAKE_C_CXX_COMPILER="-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
44
45# Invoke the build.
46BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT}
47echo $(date): Starting build...
48cmake -GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_C_CXX_COMPILER \
49  -DAMBER_USE_LOCAL_VULKAN=1 \
50  -DAMBER_ENABLE_SWIFTSHADER=1 \
51  ..
52
53echo $(date): Build everything...
54ninja
55echo $(date): Build completed.
56
57echo $(date): Starting amber_unittests...
58./amber_unittests
59echo $(date): amber_unittests completed.
60
61# Tests currently fail on Debug build on the bots
62if [[ "$EXTRA_CONFIG" =~ "ENABLE_SWIFTSHADER=TRUE" ]]; then
63  echo $(date): Starting integration tests..
64  export LD_LIBRARY_PATH=build/third_party/vulkan-loader/loader
65  export VK_LAYER_PATH=build/third_party/vulkan-validationlayers/layers
66  export VK_ICD_FILENAMES=build/Darwin/vk_swiftshader_icd.json
67  cd $SRC
68  ./tests/run_tests.py --build-dir $SRC/build --use-swiftshader
69  echo $(date): integration tests completed.
70fi
71