xref: /linux/drivers/gpu/drm/ci/build-igt.sh (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1#!/bin/bash
2# SPDX-License-Identifier: MIT
3
4set -ex
5
6function generate_testlist {
7    set +x
8    while read -r line; do
9        if [ "$line" = "TESTLIST" ] || [ "$line" = "END TESTLIST" ]; then
10            continue
11        fi
12
13        tests=$(echo "$line" | tr ' ' '\n')
14
15        for test in $tests; do
16            output=$(/igt/libexec/igt-gpu-tools/"$test" --list-subtests || true)
17
18            if [ -z "$output" ]; then
19                echo "$test"
20            else
21                echo "$output" | while read -r subtest; do
22                    echo "$test@$subtest"
23                done
24            fi
25        done
26    done < /igt/libexec/igt-gpu-tools/test-list.txt > /igt/libexec/igt-gpu-tools/ci-testlist.txt
27    set -x
28}
29
30git clone https://gitlab.freedesktop.org/drm/igt-gpu-tools.git --single-branch --no-checkout
31cd igt-gpu-tools
32git checkout $IGT_VERSION
33
34if [[ "$KERNEL_ARCH" = "arm" ]]; then
35    . ../.gitlab-ci/container/create-cross-file.sh armhf
36    EXTRA_MESON_ARGS="--cross-file /cross_file-armhf.txt"
37fi
38
39MESON_OPTIONS="-Doverlay=disabled                    \
40               -Dchamelium=disabled                  \
41               -Dvalgrind=disabled                   \
42               -Dman=enabled                         \
43               -Dtests=enabled                       \
44               -Drunner=enabled                      \
45               -Dlibunwind=enabled                   \
46               -Dprefix=/igt"
47
48if [[ "$KERNEL_ARCH" = "arm64" ]] || [[ "$KERNEL_ARCH" = "arm" ]]; then
49    MESON_OPTIONS="$MESON_OPTIONS -Dxe_driver=disabled"
50fi
51
52mkdir -p /igt
53meson build $MESON_OPTIONS $EXTRA_MESON_ARGS
54ninja -C build -j${FDO_CI_CONCURRENT:-4} || ninja -C build -j 1
55ninja -C build install
56
57if [[ "$KERNEL_ARCH" = "arm64" ]]; then
58    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/igt/lib/aarch64-linux-gnu
59elif [[ "$KERNEL_ARCH" = "arm" ]]; then
60    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/igt/lib
61else
62    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/igt/lib64
63fi
64
65echo "Generating ci-testlist.txt"
66generate_testlist
67
68mkdir -p artifacts/
69tar -cf artifacts/igt.tar /igt
70
71# Pass needed files to the test stage
72S3_ARTIFACT_NAME="igt.tar.gz"
73gzip -c artifacts/igt.tar > ${S3_ARTIFACT_NAME}
74ci-fairy s3cp --token-file "${S3_JWT_FILE}" ${S3_ARTIFACT_NAME} https://${PIPELINE_ARTIFACTS_BASE}/${KERNEL_ARCH}/${S3_ARTIFACT_NAME}
75