1#!/bin/bash 2 3# Copyright 2020 The Amber Authors. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17set -e # fail on error 18 19. /bin/using.sh # Declare the bash `using` function for configuring toolchains. 20 21set -x # show commands 22 23BUILD_TYPE="Debug" 24 25using cmake-3.17.2 26using ninja-1.10.0 27 28if [ ! -z "$COMPILER" ]; then 29 using "$COMPILER" 30fi 31 32# Possible configurations are: 33# DEBUG, RELEASE 34 35if [ $CONFIG = "RELEASE" ] 36then 37 BUILD_TYPE="RelWithDebInfo" 38fi 39 40DEPS_ARGS="" 41if [[ "$EXTRA_CONFIG" =~ "USE_CLSPV=TRUE" ]]; then 42 DEPS_ARGS+=" --with-clspv" 43fi 44if [[ "$EXTRA_CONFIG" =~ "USE_DXC=TRUE" ]]; then 45 DEPS_ARGS+=" --with-dxc" 46fi 47if [[ "$EXTRA_CONFIG" =~ "ENABLE_SWIFTSHADER=TRUE" ]]; then 48 DEPS_ARGS+=" --with-swiftshader" 49fi 50 51cd $ROOT_DIR 52./tools/git-sync-deps $DEPS_ARGS 53 54mkdir -p build 55cd $ROOT_DIR/build 56 57# Invoke the build. 58BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} 59echo $(date): Starting build... 60cmake -GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 61 -DAMBER_USE_LOCAL_VULKAN=1 \ 62 $EXTRA_CONFIG .. 63 64echo $(date): Build everything... 65ninja 66echo $(date): Build completed. 67 68echo $(date): Starting amber_unittests... 69./amber_unittests 70echo $(date): amber_unittests completed. 71 72# Swiftshader is only built with gcc, so only run the integration tests with gcc 73if [[ "$EXTRA_CONFIG" =~ "ENABLE_SWIFTSHADER=TRUE" ]]; then 74 OPTS= 75 if [[ $EXTRA_CONFIG =~ "USE_CLSPV=ON" ]]; then 76 OPTS="--use-opencl" 77 fi 78 if [[ "$EXTRA_CONFIG" =~ "USE_DXC=TRUE" ]]; then 79 OPTS+=" --use-dxc" 80 fi 81 if [[ "$EXTRA_CONFIG" =~ "ENABLE_VK_DEBUGGING=TRUE" ]]; then 82 OPTS+=" --test-debugger" 83 fi 84 85 echo $(date): Starting integration tests.. 86 export LD_LIBRARY_PATH=$ROOT_DIR/build/third_party/vulkan-loader/loader 87 export VK_LAYER_PATH=$ROOT_DIR/build/third_party/vulkan-validationlayers/layers 88 export VK_ICD_FILENAMES=$ROOT_DIR/build/Linux/vk_swiftshader_icd.json 89 cd $ROOT_DIR 90 python3 ./tests/run_tests.py --build-dir $ROOT_DIR/build --use-swiftshader $OPTS 91 echo $(date): integration tests completed. 92fi 93