util/rb_tree: Also test _safe iterators
[mesa.git] / .gitlab-ci / meson-build.sh
1 #!/bin/bash
2
3 set -e
4 set -o xtrace
5
6 # We need to control the version of llvm-config we're using, so we'll
7 # generate a native file to do so. This requires meson >=0.49
8 if test -n "$LLVM_VERSION"; then
9 LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
10 echo -e "[binaries]\nllvm-config = '`which $LLVM_CONFIG`'" > native.file
11 $LLVM_CONFIG --version
12 else
13 rm -f native.file
14 touch native.file
15 fi
16
17 CROSS_FILE=/cross_file-"$CROSS".txt
18
19 # cross-xfail-$CROSS, if it exists, contains a list of tests that are expected
20 # to fail for the $CROSS configuration, one per line. you can then mark those
21 # tests in their meson.build with:
22 #
23 # test(...,
24 # should_fail: meson.get_cross_property('xfail', '').contains(t),
25 # )
26 #
27 # where t is the name of the test, and the '' is the string to search when
28 # not cross-compiling (which is empty, because for amd64 everything is
29 # expected to pass).
30 if [ -n "$CROSS" ]; then
31 CROSS_XFAIL=.gitlab-ci/cross-xfail-"$CROSS"
32 if [ -s "$CROSS_XFAIL" ]; then
33 sed -i \
34 -e '/\[properties\]/a\' \
35 -e "xfail = '$(tr '\n' , < $CROSS_XFAIL)'" \
36 "$CROSS_FILE"
37 fi
38 fi
39
40 rm -rf _build
41 meson _build --native-file=native.file \
42 ${CROSS+--cross "$CROSS_FILE"} \
43 -D prefix=`pwd`/install \
44 -D libdir=lib \
45 -D buildtype=${BUILDTYPE:-debug} \
46 -D build-tests=true \
47 -D libunwind=${UNWIND} \
48 ${DRI_LOADERS} \
49 -D dri-drivers=${DRI_DRIVERS:-[]} \
50 ${GALLIUM_ST} \
51 -D gallium-drivers=${GALLIUM_DRIVERS:-[]} \
52 -D vulkan-drivers=${VULKAN_DRIVERS:-[]} \
53 -D I-love-half-baked-turnips=true \
54 ${EXTRA_OPTION}
55 cd _build
56 meson configure
57 ninja -j4
58 LC_ALL=C.UTF-8 ninja test
59 ninja install
60 cd ..
61
62 if test -n "$MESON_SHADERDB"; then
63 ./.gitlab-ci/run-shader-db.sh;
64 fi
65
66 # Delete 2MB of includes from artifacts.
67 rm -rf install/include
68
69 # Strip the drivers in the artifacts to cut 80% of the artifacts size.
70 if [ -n "$CROSS" ]; then
71 STRIP=`sed -n -E "s/strip\s*=\s*'(.*)'/\1/p" "$CROSS_FILE"`
72 if [ -z "$STRIP" ]; then
73 echo "Failed to find strip command in cross file"
74 exit 1
75 fi
76 else
77 STRIP="strip"
78 fi
79 find install -name \*.so -exec $STRIP {} \;
80
81 # Test runs don't pull down the git tree, so put the dEQP helper
82 # script and associated bits there.
83 mkdir -p artifacts/
84 cp -Rp .gitlab-ci/deqp* artifacts/
85 # cp -Rp src/freedreno/ci/expected* artifacts/