blob: 6cf57bf4562983e102856795314c7c076c02742e [file] [log] [blame]
#!/bin/bash
# Copyright 2016 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
root_out_dir=${1}
target_cpu=${2}
host_cpu=${3}
host_os=${4}
fuchsia_root=$root_out_dir/../..
tools_path=$fuchsia_root/prebuilt/third_party
cmake=$tools_path/cmake/$host_os-$host_cpu/bin/cmake
ninja_path=$tools_path/ninja/$host_os-$host_cpu/ninja
build_dir=$root_out_dir/build-vulkancts
caselist_build_dir=$root_out_dir/build-vulkancts/cases-build
caselist_out_dir=$root_out_dir/build-vulkancts/cases
if [[ $target_cpu == "arm64" ]]; then
# Disable ShadowCallStack, since there seem to be some issues with the call
# stack after exceptions are caught.
# TODO(fxb/41627): Re-enable.
extra_args="-DFUCHSIA_SYSTEM_PROCESSOR=aarch64 -DDE_CPU=DE_CPU_ARM_64 -DDE_PTR_SIZE=8 -DCMAKE_C_FLAGS=-fno-sanitize=shadow-call-stack -DCMAKE_CXX_FLAGS=-fno-sanitize=shadow-call-stack"
else
extra_args="-DFUCHSIA_SYSTEM_PROCESSOR=x86_64"
fi
fuchsia_lib_path=$root_out_dir/$target_cpu-shared
fuchsia_libfdio=$root_out_dir/gen/zircon/public/lib/fdio/libfdio.so
sysroot=$root_out_dir/sdk/exported/zircon_sysroot/arch/$target_cpu/sysroot
if [ ! -d "$sysroot" ]; then
echo "Can't find sysroot: $sysroot"
exit 1
fi
# Export buildtools' cmake to the scripts below.
export PATH="$PATH:$(dirname $cmake)"
pushd $fuchsia_root/third_party/vulkan-cts
python external/fetch_sources.py
popd
# builds the test executable for the host in order to write out test cases
pushd $fuchsia_root/third_party/vulkan-cts
mkdir -p $caselist_out_dir
mkdir -p $caselist_build_dir
python scripts/build_caselists.py -b $caselist_build_dir -m dEQP-VK $caselist_out_dir
popd
mkdir -p $build_dir
$fuchsia_root/third_party/vulkan-cts/fuchsia/gendepsfile.py $build_dir/vulkan-cts.d $fuchsia_root/third_party/vulkan-cts
pushd $build_dir
$cmake $fuchsia_root/third_party/vulkan-cts -GNinja -DCMAKE_BUILD_TYPE=RelWithAsserts -DCMAKE_MAKE_PROGRAM=$ninja_path -DFUCHSIA_SYSROOT=$sysroot -DCMAKE_TOOLCHAIN_FILE=$fuchsia_root/build/Fuchsia.cmake -DDE_OS=DE_OS_FUCHSIA -DDEQP_TARGET=fuchsia -DFUCHSIA_ROOT=$fuchsia_root -DFUCHSIA_LIB_DIR=$fuchsia_lib_path -DFUCHSIA_LIBFDIO=$fuchsia_libfdio $extra_args
$ninja_path deqp-vk executor execserver
popd