1bf215546Sopenharmony_ci#!/bin/sh
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ciset -ex
4bf215546Sopenharmony_ci
5bf215546Sopenharmony_ciif [ -z "$GPU_VERSION" ]; then
6bf215546Sopenharmony_ci   echo 'GPU_VERSION must be set to something like "llvmpipe" or "freedreno-a630" (the name used in your ci/gpu-version-*.txt)'
7bf215546Sopenharmony_ci   exit 1
8bf215546Sopenharmony_cifi
9bf215546Sopenharmony_ci
10bf215546Sopenharmony_ciINSTALL=`pwd`/install
11bf215546Sopenharmony_ci
12bf215546Sopenharmony_ci# Set up the driver environment.
13bf215546Sopenharmony_ciexport LD_LIBRARY_PATH=`pwd`/install/lib/
14bf215546Sopenharmony_ciexport EGL_PLATFORM=surfaceless
15bf215546Sopenharmony_ciexport VK_ICD_FILENAMES=`pwd`/install/share/vulkan/icd.d/"$VK_DRIVER"_icd.${VK_CPU:-`uname -m`}.json
16bf215546Sopenharmony_ci
17bf215546Sopenharmony_ciRESULTS=`pwd`/${PIGLIT_RESULTS_DIR:-results}
18bf215546Sopenharmony_cimkdir -p $RESULTS
19bf215546Sopenharmony_ci
20bf215546Sopenharmony_ci# Ensure Mesa Shader Cache resides on tmpfs.
21bf215546Sopenharmony_ciSHADER_CACHE_HOME=${XDG_CACHE_HOME:-${HOME}/.cache}
22bf215546Sopenharmony_ciSHADER_CACHE_DIR=${MESA_SHADER_CACHE_DIR:-${SHADER_CACHE_HOME}/mesa_shader_cache}
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_cifindmnt -n tmpfs ${SHADER_CACHE_HOME} || findmnt -n tmpfs ${SHADER_CACHE_DIR} || {
25bf215546Sopenharmony_ci    mkdir -p ${SHADER_CACHE_DIR}
26bf215546Sopenharmony_ci    mount -t tmpfs -o nosuid,nodev,size=2G,mode=1755 tmpfs ${SHADER_CACHE_DIR}
27bf215546Sopenharmony_ci}
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ciif [ "$GALLIUM_DRIVER" = "virpipe" ]; then
30bf215546Sopenharmony_ci    # deqp is to use virpipe, and virgl_test_server llvmpipe
31bf215546Sopenharmony_ci    export GALLIUM_DRIVER="$GALLIUM_DRIVER"
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci    VTEST_ARGS="--use-egl-surfaceless"
34bf215546Sopenharmony_ci    if [ "$VIRGL_HOST_API" = "GLES" ]; then
35bf215546Sopenharmony_ci        VTEST_ARGS="$VTEST_ARGS --use-gles"
36bf215546Sopenharmony_ci    fi
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_ci    GALLIUM_DRIVER=llvmpipe \
39bf215546Sopenharmony_ci    GALLIVM_PERF="nopt" \
40bf215546Sopenharmony_ci    virgl_test_server $VTEST_ARGS >$RESULTS/vtest-log.txt 2>&1 &
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_ci    sleep 1
43bf215546Sopenharmony_cifi
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_ciif [ -n "$PIGLIT_FRACTION" -o -n "$CI_NODE_INDEX" ]; then
46bf215546Sopenharmony_ci   FRACTION=`expr ${PIGLIT_FRACTION:-1} \* ${CI_NODE_TOTAL:-1}`
47bf215546Sopenharmony_ciPIGLIT_RUNNER_OPTIONS="$PIGLIT_RUNNER_OPTIONS --fraction $FRACTION"
48bf215546Sopenharmony_cifi
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_ci# If the job is parallel at the gitab job level, take the corresponding fraction
51bf215546Sopenharmony_ci# of the caselist.
52bf215546Sopenharmony_ciif [ -n "$CI_NODE_INDEX" ]; then
53bf215546Sopenharmony_ci   PIGLIT_RUNNER_OPTIONS="$PIGLIT_RUNNER_OPTIONS --fraction-start ${CI_NODE_INDEX}"
54bf215546Sopenharmony_cifi
55bf215546Sopenharmony_ci
56bf215546Sopenharmony_ciif [ -e "$INSTALL/$GPU_VERSION-fails.txt" ]; then
57bf215546Sopenharmony_ci    PIGLIT_RUNNER_OPTIONS="$PIGLIT_RUNNER_OPTIONS --baseline $INSTALL/$GPU_VERSION-fails.txt"
58bf215546Sopenharmony_cifi
59bf215546Sopenharmony_ci
60bf215546Sopenharmony_ci# Default to an empty known flakes file if it doesn't exist.
61bf215546Sopenharmony_citouch $INSTALL/$GPU_VERSION-flakes.txt
62bf215546Sopenharmony_ci
63bf215546Sopenharmony_ciif [ -n "$VK_DRIVER" ] && [ -e "$INSTALL/$VK_DRIVER-skips.txt" ]; then
64bf215546Sopenharmony_ci    PIGLIT_SKIPS="$PIGLIT_SKIPS $INSTALL/$VK_DRIVER-skips.txt"
65bf215546Sopenharmony_cifi
66bf215546Sopenharmony_ci
67bf215546Sopenharmony_ciif [ -n "$GALLIUM_DRIVER" ] && [ -e "$INSTALL/$GALLIUM_DRIVER-skips.txt" ]; then
68bf215546Sopenharmony_ci    PIGLIT_SKIPS="$PIGLIT_SKIPS $INSTALL/$GALLIUM_DRIVER-skips.txt"
69bf215546Sopenharmony_cifi
70bf215546Sopenharmony_ci
71bf215546Sopenharmony_ciif [ -n "$DRIVER_NAME" ] && [ -e "$INSTALL/$DRIVER_NAME-skips.txt" ]; then
72bf215546Sopenharmony_ci    PIGLIT_SKIPS="$PIGLIT_SKIPS $INSTALL/$DRIVER_NAME-skips.txt"
73bf215546Sopenharmony_cifi
74bf215546Sopenharmony_ci
75bf215546Sopenharmony_ciif [ -e "$INSTALL/$GPU_VERSION-skips.txt" ]; then
76bf215546Sopenharmony_ci    PIGLIT_SKIPS="$PIGLIT_SKIPS $INSTALL/$GPU_VERSION-skips.txt"
77bf215546Sopenharmony_cifi
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_ciset +e
80bf215546Sopenharmony_ci
81bf215546Sopenharmony_cipiglit-runner \
82bf215546Sopenharmony_ci    run \
83bf215546Sopenharmony_ci    --piglit-folder /piglit \
84bf215546Sopenharmony_ci    --output $RESULTS \
85bf215546Sopenharmony_ci    --jobs ${FDO_CI_CONCURRENT:-4} \
86bf215546Sopenharmony_ci    --skips $INSTALL/all-skips.txt $PIGLIT_SKIPS \
87bf215546Sopenharmony_ci    --flakes $INSTALL/$GPU_VERSION-flakes.txt \
88bf215546Sopenharmony_ci    --profile $PIGLIT_PROFILES \
89bf215546Sopenharmony_ci    --process-isolation \
90bf215546Sopenharmony_ci    $PIGLIT_RUNNER_OPTIONS \
91bf215546Sopenharmony_ci    -v -v
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_ciPIGLIT_EXITCODE=$?
94bf215546Sopenharmony_ci
95bf215546Sopenharmony_cideqp-runner junit \
96bf215546Sopenharmony_ci   --testsuite $PIGLIT_PROFILES \
97bf215546Sopenharmony_ci   --results $RESULTS/failures.csv \
98bf215546Sopenharmony_ci   --output $RESULTS/junit.xml \
99bf215546Sopenharmony_ci   --limit 50 \
100bf215546Sopenharmony_ci   --template "See https://$CI_PROJECT_ROOT_NAMESPACE.pages.freedesktop.org/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/results/{{testcase}}.xml"
101bf215546Sopenharmony_ci
102bf215546Sopenharmony_ci# Report the flakes to the IRC channel for monitoring (if configured):
103bf215546Sopenharmony_ciif [ -n "$FLAKES_CHANNEL" ]; then
104bf215546Sopenharmony_ci  python3 $INSTALL/report-flakes.py \
105bf215546Sopenharmony_ci         --host irc.oftc.net \
106bf215546Sopenharmony_ci         --port 6667 \
107bf215546Sopenharmony_ci         --results $RESULTS/results.csv \
108bf215546Sopenharmony_ci         --known-flakes $INSTALL/$GPU_VERSION-flakes.txt \
109bf215546Sopenharmony_ci         --channel "$FLAKES_CHANNEL" \
110bf215546Sopenharmony_ci         --runner "$CI_RUNNER_DESCRIPTION" \
111bf215546Sopenharmony_ci         --job "$CI_JOB_ID" \
112bf215546Sopenharmony_ci         --url "$CI_JOB_URL" \
113bf215546Sopenharmony_ci         --branch "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-$CI_COMMIT_BRANCH}" \
114bf215546Sopenharmony_ci         --branch-title "${CI_MERGE_REQUEST_TITLE:-$CI_COMMIT_TITLE}"
115bf215546Sopenharmony_cifi
116bf215546Sopenharmony_ci
117bf215546Sopenharmony_ciexit $PIGLIT_EXITCODE
118