1bf215546Sopenharmony_ci#!/bin/sh
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ciset -ex
4bf215546Sopenharmony_ci
5bf215546Sopenharmony_ciINSTALL=`pwd`/install
6bf215546Sopenharmony_ci
7bf215546Sopenharmony_ci# Set up the driver environment.
8bf215546Sopenharmony_ciexport LD_LIBRARY_PATH=`pwd`/install/lib/
9bf215546Sopenharmony_ciexport LIBVA_DRIVERS_PATH=`pwd`/install/lib/dri/
10bf215546Sopenharmony_ci# libva spams driver open info by default, and that happens per testcase.
11bf215546Sopenharmony_ciexport LIBVA_MESSAGING_LEVEL=1
12bf215546Sopenharmony_ci
13bf215546Sopenharmony_ciif [ -e "$INSTALL/$GPU_VERSION-fails.txt" ]; then
14bf215546Sopenharmony_ci    GTEST_RUNNER_OPTIONS="$GTEST_RUNNER_OPTIONS --baseline $INSTALL/$GPU_VERSION-fails.txt"
15bf215546Sopenharmony_cifi
16bf215546Sopenharmony_ci
17bf215546Sopenharmony_ci# Default to an empty known flakes file if it doesn't exist.
18bf215546Sopenharmony_citouch $INSTALL/$GPU_VERSION-flakes.txt
19bf215546Sopenharmony_ci
20bf215546Sopenharmony_ciif [ -n "$GALLIUM_DRIVER" ] && [ -e "$INSTALL/$GALLIUM_DRIVER-skips.txt" ]; then
21bf215546Sopenharmony_ci    GTEST_SKIPS="$GTEST_SKIPS --skips $INSTALL/$GALLIUM_DRIVER-skips.txt"
22bf215546Sopenharmony_cifi
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ciif [ -n "$DRIVER_NAME" ] && [ -e "$INSTALL/$DRIVER_NAME-skips.txt" ]; then
25bf215546Sopenharmony_ci    GTEST_SKIPS="$GTEST_SKIPS --skips $INSTALL/$DRIVER_NAME-skips.txt"
26bf215546Sopenharmony_cifi
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ciif [ -e "$INSTALL/$GPU_VERSION-skips.txt" ]; then
29bf215546Sopenharmony_ci    GTEST_SKIPS="$GTEST_SKIPS --skips $INSTALL/$GPU_VERSION-skips.txt"
30bf215546Sopenharmony_cifi
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ciset +e
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_cigtest-runner \
35bf215546Sopenharmony_ci    run \
36bf215546Sopenharmony_ci    --gtest $GTEST \
37bf215546Sopenharmony_ci    --output ${GTEST_RESULTS_DIR:-results} \
38bf215546Sopenharmony_ci    --jobs ${FDO_CI_CONCURRENT:-4} \
39bf215546Sopenharmony_ci    $GTEST_SKIPS \
40bf215546Sopenharmony_ci    --flakes $INSTALL/$GPU_VERSION-flakes.txt \
41bf215546Sopenharmony_ci    --fraction-start ${CI_NODE_INDEX:-1} \
42bf215546Sopenharmony_ci    --fraction $((${CI_NODE_TOTAL:-1} * ${GTEST_FRACTION:-1})) \
43bf215546Sopenharmony_ci    --env "LD_PRELOAD=$TEST_LD_PRELOAD" \
44bf215546Sopenharmony_ci    $GTEST_RUNNER_OPTIONS
45bf215546Sopenharmony_ci
46bf215546Sopenharmony_ciGTEST_EXITCODE=$?
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_cideqp-runner junit \
49bf215546Sopenharmony_ci   --testsuite gtest \
50bf215546Sopenharmony_ci   --results $RESULTS/failures.csv \
51bf215546Sopenharmony_ci   --output $RESULTS/junit.xml \
52bf215546Sopenharmony_ci   --limit 50 \
53bf215546Sopenharmony_ci   --template "See https://$CI_PROJECT_ROOT_NAMESPACE.pages.freedesktop.org/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/results/{{testcase}}.xml"
54bf215546Sopenharmony_ci
55bf215546Sopenharmony_ci# Report the flakes to the IRC channel for monitoring (if configured):
56bf215546Sopenharmony_ciif [ -n "$FLAKES_CHANNEL" ]; then
57bf215546Sopenharmony_ci  python3 $INSTALL/report-flakes.py \
58bf215546Sopenharmony_ci         --host irc.oftc.net \
59bf215546Sopenharmony_ci         --port 6667 \
60bf215546Sopenharmony_ci         --results $RESULTS/results.csv \
61bf215546Sopenharmony_ci         --known-flakes $INSTALL/$GPU_VERSION-flakes.txt \
62bf215546Sopenharmony_ci         --channel "$FLAKES_CHANNEL" \
63bf215546Sopenharmony_ci         --runner "$CI_RUNNER_DESCRIPTION" \
64bf215546Sopenharmony_ci         --job "$CI_JOB_ID" \
65bf215546Sopenharmony_ci         --url "$CI_JOB_URL" \
66bf215546Sopenharmony_ci         --branch "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-$CI_COMMIT_BRANCH}" \
67bf215546Sopenharmony_ci         --branch-title "${CI_MERGE_REQUEST_TITLE:-$CI_COMMIT_TITLE}"
68bf215546Sopenharmony_cifi
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_ciexit $GTEST_EXITCODE
71