| #!/bin/bash |
| # |
| # dEQP |
| # |
| # Use the dEQP tests to validate the API file. |
| # |
| |
| # Minimum number of GLES2 tests which must pass. |
| gles2_must_pass=189 |
| |
| if [ "${#}" -gt 1 ]; then |
| echo "Usage: `basename $0` [ <auto|apt-get|install|patch|build|test> ]" >&2 |
| echo " auto - (default) run the test, do prerequisites, if needed" >&2 |
| echo " apt-get - (root required) install missing build tools" >&2 |
| echo " install - get dEQP source code" >&2 |
| echo " patch - patch dEQP source code" >&2 |
| echo " build - build patched dEQP source code" >&2 |
| echo " test - run dEQP null driver test for GAPI" >&2 |
| exit 1 |
| fi |
| |
| if [ "${#}" -eq 1 ]; then |
| action="$1" |
| else |
| # default action |
| action="auto" |
| fi |
| |
| # Deal with apt-get first as it has no pre-requisites |
| if [ "${action}" == "apt-get" ]; then |
| # |
| # Check/install any tools which are need to make dEQP. |
| # |
| if [ "$(id -u)" != "0" ]; then |
| echo "`basename $0`:E: root is required to do apt-get" >&2 |
| echo "`basename $0`:I: try: sudo $0 ${action}" >&2 |
| exit 1 |
| fi |
| if ! apt-get install ninja-build; then |
| echo "`basename $0`:E: failed to apt-get ninja-build" >&2 |
| exit 1 |
| fi |
| if ! apt-get install cmake; then |
| echo "`basename $0`:E: failed to apt-get cmake" >&2 |
| exit 1 |
| fi |
| exit 0 |
| fi |
| |
| if [ ! -n "${GPUPATH}" ]; then |
| echo "`basename $0`:E: please set GPUPATH" >&2 |
| exit 1 |
| fi |
| |
| if [ ! -d "${GPUPATH}" ]; then |
| echo "`basename $0`:E: GPUPATH directory $GPUPATH does not exist" >&2 |
| exit 1 |
| fi |
| |
| if [ ! -n "${GOPATH}" ]; then |
| echo "`basename $0`:E: please set GOPATH" >&2 |
| exit 1 |
| fi |
| |
| if [ ! -n "${MY_REPO}" ]; then |
| MY_REPO=$(cd "${GPUPATH}/../../../../../../.."; pwd) |
| fi |
| |
| deqp_source="${MY_REPO}/external/deqp" |
| gpu_build_root="${MY_REPO}/tools/gpu/pkg" |
| arch="$(uname -s | tr '[:upper:]' '[:lower:]')-$(arch)" |
| deqp_build_root="${gpu_build_root}/${arch}-release/external/deqp" |
| # This version fixes fetch_sources.py |
| deqp_hash="dcedc3c4309ce36d0a696b2fe8ca1da8406c7871" |
| deqp_null_dir="${deqp_source}/framework/platform/null" |
| |
| prebuilts="${MY_REPO}/prebuilts" |
| |
| mkdir -p "${deqp_build_root}" |
| |
| # |
| # Locate the cmake executable or error. |
| # |
| function find_cmake() { |
| if [ -d "${prebuilts}/cmake" ]; then |
| cmake="$(ls -1 ${prebuilts}/cmake/*/bin/cmake)" |
| if [ ! -x "${cmake}" ]; then |
| echo "`basename $0`:I: did not find executable cmake in ${prebuilts}/cmake" >&2 |
| exit 1 |
| fi |
| else |
| if ! type -t cmake > /dev/null ; then |
| echo "`basename $0`:I: cmake is missing try: sudo `basename $0` apt-get" >&2 |
| exit 1 |
| fi |
| cmake=$(type -p cmake) |
| fi |
| echo $cmake |
| } |
| |
| # |
| # Locate the ninja executable or error. |
| # |
| function find_ninja() { |
| if [ -d "${prebuilts}/ninja" ]; then |
| ninja="$(ls -1 ${prebuilts}/ninja/*/ninja)" |
| if [ ! -x "${ninja}" ]; then |
| echo "`basename $0`:I: did not find executable ninja in ${prebuilts}/ninja" >&2 |
| exit 1 |
| fi |
| else |
| if ! type -t ninja > /dev/null ; then |
| echo "`basename $0`:I: ninja is missing try: sudo `basename $0` apt-get" >&2 |
| exit 1 |
| fi |
| ninja=$(type -p ninja) |
| fi |
| echo $ninja |
| } |
| |
| # |
| # Setup the dEQP source in <repo>/external/deqp |
| # |
| function action_install() { |
| cmake=$(find_cmake) |
| if [ "$?" != 0 ]; then |
| echo "`basename $0`:I: did not find cmake" >&2 |
| exit 1 |
| fi |
| ninja=$(find_ninja) |
| if [ "$?" != 0 ]; then |
| echo "`basename $0`:I: did not find ninja" >&2 |
| exit 1 |
| fi |
| if [ -d "${deqp_source}" ]; then |
| echo "`basename $0`:E: ${deqp_source} already exists" >&2 |
| exit 1 |
| fi |
| if ! git credential-corpsso check > /dev/null; then |
| echo "`basename $0`:E: you need to run: git credential-corpsso login" >&2 |
| exit 1 |
| fi |
| cd "${MY_REPO}/external" |
| if ! git clone https://android.googlesource.com/platform/external/deqp; then |
| echo "`basename $0`:E: failed to clone dEQP" >&2 |
| exit 1 |
| fi |
| cd "${deqp_source}" |
| # Need to be on the dev branch, fetch_sources.py in master has bitrot. |
| if ! git checkout deqp-dev; then |
| echo "`basename $0`:E: git checkout deqp-dev failed" >&2 |
| exit 1 |
| fi |
| if ! git reset --hard "${deqp_hash}"; then |
| echo "`basename $0`:E: git reset --hard failed" >&2 |
| exit 1 |
| fi |
| cd "${deqp_source}/external" |
| if ! python fetch_sources.py; then |
| echo "`basename $0`:E: dEQP fetch_sources.py failed" >&2 |
| exit 1 |
| fi |
| if [ ! -d "${deqp_null_dir}" ]; then |
| echo "`basename $0`:E: ${deqp_null_dir} not found after installation" >&2 |
| exit 1 |
| fi |
| } |
| |
| deqp_gapi_dir="${deqp_source}/framework/platform/gapi" |
| deqp_target_dir="${deqp_source}/targets/gapi" |
| |
| # |
| # Make a small modification to the dEQP source to integeration GAPI |
| # |
| function action_patch() { |
| if [ ! -d "${deqp_source}" ]; then |
| echo "`basename $0`:E: ${deqp_source} is missing (need install)" >&2 |
| exit 1 |
| fi |
| if [ -d "${deqp_gapi_dir}" ]; then |
| echo "`basename $0`:E: ${deqp_gapi_dir} already exists" >&2 |
| exit 1 |
| fi |
| if [ -d "${deqp_target_dir}" ]; then |
| echo "`basename $0`:E: ${deqp_target_dir} already exists" >&2 |
| exit 1 |
| fi |
| if ! mkdir "${deqp_gapi_dir}"; then |
| echo "`basename $0`:E: failed to mkdir ${deqp_gapi_dir}" >&2 |
| exit 1 |
| fi |
| if ! cp "${deqp_null_dir}"/* "${deqp_gapi_dir}"; then |
| echo "`basename $0`:E: failed to copy null driver to ${deqp_gapi_dir}" >&2 |
| exit 1 |
| fi |
| cd "${deqp_source}" |
| patch -p0 <<'PATCHY_MCPATCHFACE' |
| --- framework/platform/gapi/tcuNullRenderContext.cpp 2016-05-11 12:15:39.305874056 +0100 |
| +++ framework/platform/gapi/tcuNullRenderContext.cpp 2016-05-11 12:48:41.879384043 +0100 |
| @@ -32,6 +32,8 @@ |
| #include <string> |
| #include <vector> |
| |
| +extern void InstallGapiiInterceptor(glw::Functions* gl); |
| + |
| namespace tcu |
| { |
| namespace null |
| @@ -608,6 +610,7 @@ |
| |
| initFunctions(&m_functions); |
| setCurrentContext(m_context); |
| + InstallGapiiInterceptor(&m_functions); |
| } |
| |
| RenderContext::~RenderContext (void) |
| PATCHY_MCPATCHFACE |
| if [ "$?" != 0 ]; then |
| echo "`basename $0`: failed to patch gapi/tcuNullRenderContext.cpp" >&2 |
| exit 1 |
| fi |
| if ! mkdir "${deqp_target_dir}"; then |
| echo "`basename $0`:E: failed to mkdir ${deqp_target_dir}" >&2 |
| exit 1 |
| fi |
| cd "${deqp_target_dir}" |
| cat > gapi.cmake <<'FILEY_MCFILEFACE' |
| message("*** Using gapi context target") |
| set(DEQP_TARGET_NAME "Gapi") |
| set(DEQP_SUPPORT_EGL ON) |
| set(DEQP_SUPPORT_GLES2 ON) |
| set(DEQP_SUPPORT_GLES3 ON) |
| set(DEQP_SUPPORT_OPENGL ON) |
| |
| set(TCUTIL_PLATFORM_SRCS |
| gapi/tcuNullPlatform.cpp |
| gapi/tcuNullPlatform.hpp |
| gapi/tcuNullRenderContext.cpp |
| gapi/tcuNullRenderContext.hpp |
| null/tcuNullContextFactory.cpp |
| null/tcuNullContextFactory.hpp |
| ) |
| |
| ## libgapii.so is located using the 1st component of the $GOPATH env variable |
| set(GOPATH $ENV{GOPATH}) |
| |
| string(REPLACE ":" ";" GOPATH_LIST ${GOPATH}) |
| list(GET GOPATH 0 GODIR) |
| |
| set(DEQP_PLATFORM_LIBRARIES ${DEQP_PLATFORM_LIBRARIES} ${GODIR}/bin/linux-x86_64/release/libgapii.so) |
| FILEY_MCFILEFACE |
| if [ "$?" != 0 ]; then |
| echo "`basename $0`: failed to create gapi.cmake" >&2 |
| exit 1 |
| fi |
| } |
| |
| deqp_ninja_build="${deqp_build_root}/build.ninja" |
| |
| # |
| # Build the modified version of the dEQP source. |
| # Executables are with the other build output under the GPU pkg directory. |
| # |
| function action_build() { |
| if [ ! -d "${deqp_source}" ]; then |
| echo "`basename $0`:E: ${deqp_source} does not exist (need install)" >&2 |
| exit 1 |
| fi |
| if [ ! -d "${deqp_gapi_dir}" ]; then |
| echo "`basename $0`:E: ${deqp_gapi_dir} not found (need patch)" >&2 |
| exit 1 |
| fi |
| if [ ! -d "${deqp_target_dir}" ]; then |
| echo "`basename $0`:E: ${deqp_target_dir} not found (need patch)" >&2 |
| exit 1 |
| fi |
| if [ ! -s "${deqp_ninja_build}" ]; then |
| cmake=$(find_cmake) |
| if [ "$?" != 0 ]; then |
| echo "`basename $0`:I: did not find cmake" >&2 |
| exit 1 |
| fi |
| cd "${deqp_build_root}" |
| if ! "${cmake}" -GNinja -DDEQP_TARGET=gapi "${deqp_source}"; then |
| echo "`basename $0`:E: cmake failed in ${deqp_build_root} for ${deqp_source}" >&2 |
| exit 1 |
| fi |
| if [ ! -s "${deqp_ninja_build}" ]; then |
| echo "`basename $0`:E: cmake did not make ${deqp_ninja_build}" >&2 |
| exit 1 |
| fi |
| fi |
| ninja=$(find_ninja) |
| if [ "$?" != 0 ]; then |
| echo "`basename $0`:I: did not find ninja" >&2 |
| exit 1 |
| fi |
| cd ${deqp_build_root} |
| if ! "${ninja}" ; then |
| echo "`basename $0`:E: ninja failed in ${deqp_build_root}" >&2 |
| exit 1 |
| fi |
| } |
| |
| deqp_modules="${deqp_build_root}/modules" |
| deqp_gles2_dir="${deqp_modules}/gles2" |
| deqp_gles2_exe="deqp-gles2" |
| result_file="TestResults.qpa" |
| short_dir=$(echo "${deqp_gles2_dir}" | |
| sed 's:'"${GOPATH}"':${GOPATH}:' | |
| sed 's:'"${MY_REPO}"':${MY_REPO}:' |
| ) |
| |
| # |
| # Run the dEQP test for negative_api and check that there are enough passes |
| # |
| function action_test() { |
| if [ ! -d "${deqp_gles2_dir}" ]; then |
| echo "`basename $0`:E: ${deqp_gles2_dir} does not exist (need build)" >&2 |
| exit 1 |
| fi |
| if [ ! -x "${deqp_gles2_dir}/${deqp_gles2_exe}" ]; then |
| echo "`basename $0`:E: ${short_dir}/${deqp_gles2_exe} does not exist (need build)" >&2 |
| exit 1 |
| fi |
| cd "${deqp_gles2_dir}" |
| rm -f "${result_file}" < /dev/null |
| if ! time "./${deqp_gles2_exe}" --deqp-case='dEQP-GLES*.functional.negative_api.*' > deqp.out; then |
| echo "`basename $0`:E: ${deqp_gles2_exe} failed in ${short_dir}" >&2 |
| if [ -s "deqp.out" ]; then |
| echo "`basename $0`:I: there is some output in ${short_dir}/deqp.out" >&2 |
| fi |
| exit 1 |
| fi |
| if [ ! -f "${result_file}" ]; then |
| echo "`basename $0`:E: ${short_dir}/${result_file} is missing" >&2 |
| exit 1 |
| fi |
| fail=$(grep -c '<Result StatusCode="Fail">' "${result_file}") |
| pass=$(grep -c '<Result StatusCode="Pass">' "${result_file}") |
| echo "`basename $0`:I: passes ${pass} failed ${fail}" |
| echo "`basename $0`:I: detailed results: ${short_dir}/${result_file}" |
| echo "`basename $0`:I: output log: ${short_dir}/deqp.out" |
| if [ "${pass}" -lt "${gles2_must_pass}" ]; then |
| echo "`basename $0`:E: regression too few passes ${pass} need ${gles2_must_pass}" >&2 |
| exit 1 |
| fi |
| } |
| |
| # |
| # auto - (default) run the test, do prerequisites, if needed |
| # |
| function action_auto() { |
| need_build=0 |
| need_patch=0 |
| need_install=0 |
| if [ ! -x "${deqp_gles2_dir}/${deqp_gles2_exe}" ]; then |
| need_build=1 |
| if [ ! -d "${deqp_gapi_dir}" ]; then |
| need_patch=1 |
| if [ ! -d "${deqp_source}" ]; then |
| need_install=1 |
| fi |
| fi |
| fi |
| if [ "${need_install}" == 1 ]; then |
| action_install |
| fi |
| if [ "${need_patch}" == 1 ]; then |
| action_patch |
| fi |
| if [ "${need_build}" == 1 ]; then |
| action_build |
| fi |
| action_test |
| } |
| |
| case "${action}" in |
| apt-get) |
| action_aptget |
| ;; |
| install) |
| action_install |
| ;; |
| patch) |
| action_patch |
| ;; |
| build) |
| action_build |
| ;; |
| test) |
| action_test |
| ;; |
| auto) |
| action_auto |
| ;; |
| esac |
| |
| exit 0 |