• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3set -e
4set -o xtrace
5
6CROSS_FILE=/cross_file-"$CROSS".txt
7
8# We need to control the version of llvm-config we're using, so we'll
9# tweak the cross file or generate a native file to do so.
10if test -n "$LLVM_VERSION"; then
11    LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
12    echo -e "[binaries]\nllvm-config = '`which $LLVM_CONFIG`'" > native.file
13    if [ -n "$CROSS" ]; then
14        sed -i -e '/\[binaries\]/a\' -e "llvm-config = '`which $LLVM_CONFIG`'" $CROSS_FILE
15    fi
16    $LLVM_CONFIG --version
17else
18    rm -f native.file
19    touch native.file
20fi
21
22# cross-xfail-$CROSS, if it exists, contains a list of tests that are expected
23# to fail for the $CROSS configuration, one per line. you can then mark those
24# tests in their meson.build with:
25#
26# test(...,
27#      should_fail: meson.get_cross_property('xfail', '').contains(t),
28#     )
29#
30# where t is the name of the test, and the '' is the string to search when
31# not cross-compiling (which is empty, because for amd64 everything is
32# expected to pass).
33if [ -n "$CROSS" ]; then
34    CROSS_XFAIL=.gitlab-ci/cross-xfail-"$CROSS"
35    if [ -s "$CROSS_XFAIL" ]; then
36        sed -i \
37            -e '/\[properties\]/a\' \
38            -e "xfail = '$(tr '\n' , < $CROSS_XFAIL)'" \
39            "$CROSS_FILE"
40    fi
41fi
42
43# Only use GNU time if available, not any shell built-in command
44case $CI_JOB_NAME in
45    # strace and wine don't seem to mix well
46    # ASAN leak detection is incompatible with strace
47    debian-mingw32-x86_64|*-asan*)
48        if test -f /usr/bin/time; then
49            MESON_TEST_ARGS+=--wrapper=$PWD/.gitlab-ci/meson/time.sh
50        fi
51        ;;
52    *)
53        if test -f /usr/bin/time -a -f /usr/bin/strace; then
54            MESON_TEST_ARGS+=--wrapper=$PWD/.gitlab-ci/meson/time-strace.sh
55        fi
56        ;;
57esac
58
59RET=0
60RESULTS_DIR=$(pwd)/results/${TEST_SUITE:-build}
61rm -rf _build
62
63meson _build --native-file=native.file \
64    --wrap-mode=nofallback \
65    ${CROSS+--cross "$CROSS_FILE"} \
66    -D prefix=$(pwd)/install \
67    -D libdir=lib \
68    -D buildtype=${BUILDTYPE:-debug} \
69    -D c_args="$(echo -n $C_ARGS)" \
70    -D cpp_args="$(echo -n $CPP_ARGS)" \
71    ${DRI_LOADERS} \
72    ${GALLIUM_ST} \
73    -D tests=true \
74    -D render-server=true \
75    -D render-server-worker=process \
76    -D venus-experimental=true \
77    --fatal-meson-warnings \
78    ${EXTRA_OPTION} && \
79pushd _build && \
80meson configure && \
81ninja -j ${FDO_CI_CONCURRENT:-4} install || {
82    RET=$?
83    mkdir -p ${RESULTS_DIR}
84    mv -f meson-logs/* ${RESULTS_DIR}/
85    popd
86    exit ${RET}
87}
88
89if [ -n "${TEST_SUITE}" ]; then
90    VRENDTEST_USE_EGL_SURFACELESS=1 ninja -j ${FDO_CI_CONCURRENT:-4} test || RET=$?
91    mkdir -p ${RESULTS_DIR}
92    mv -f meson-logs/testlog.txt ${RESULTS_DIR}/
93fi
94
95popd
96exit ${RET}
97