162306a36Sopenharmony_ci#!/bin/sh
262306a36Sopenharmony_ci# SPDX-License-Identifier: MIT
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciset -ex
562306a36Sopenharmony_ci
662306a36Sopenharmony_ciexport IGT_FORCE_DRIVER=${DRIVER_NAME}
762306a36Sopenharmony_ciexport PATH=$PATH:/igt/bin/
862306a36Sopenharmony_ciexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/igt/lib/aarch64-linux-gnu/:/igt/lib/x86_64-linux-gnu:/igt/lib:/igt/lib64
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci# Uncomment the below to debug problems with driver probing
1162306a36Sopenharmony_ci: '
1262306a36Sopenharmony_cils -l /dev/dri/
1362306a36Sopenharmony_cicat /sys/kernel/debug/devices_deferred
1462306a36Sopenharmony_cicat /sys/kernel/debug/device_component/*
1562306a36Sopenharmony_ci'
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci# Dump drm state to confirm that kernel was able to find a connected display:
1862306a36Sopenharmony_ci# TODO this path might not exist for all drivers.. maybe run modetest instead?
1962306a36Sopenharmony_ciset +e
2062306a36Sopenharmony_cicat /sys/kernel/debug/dri/*/state
2162306a36Sopenharmony_ciset -e
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci# Cannot use HWCI_KERNEL_MODULES as at that point we don't have the module in /lib
2462306a36Sopenharmony_ciif [ "$IGT_FORCE_DRIVER" = "amdgpu" ]; then
2562306a36Sopenharmony_ci    mv /install/modules/lib/modules/* /lib/modules/.
2662306a36Sopenharmony_ci    modprobe amdgpu
2762306a36Sopenharmony_cifi
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciif [ -e "/install/xfails/$DRIVER_NAME-$GPU_VERSION-skips.txt" ]; then
3062306a36Sopenharmony_ci    IGT_SKIPS="--skips /install/xfails/$DRIVER_NAME-$GPU_VERSION-skips.txt"
3162306a36Sopenharmony_cifi
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciif [ -e "/install/xfails/$DRIVER_NAME-$GPU_VERSION-flakes.txt" ]; then
3462306a36Sopenharmony_ci    IGT_FLAKES="--flakes /install/xfails/$DRIVER_NAME-$GPU_VERSION-flakes.txt"
3562306a36Sopenharmony_cifi
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciif [ -e "/install/xfails/$DRIVER_NAME-$GPU_VERSION-fails.txt" ]; then
3862306a36Sopenharmony_ci    IGT_FAILS="--baseline /install/xfails/$DRIVER_NAME-$GPU_VERSION-fails.txt"
3962306a36Sopenharmony_cifi
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciif [ "`uname -m`" = "aarch64" ]; then
4262306a36Sopenharmony_ci    ARCH="arm64"
4362306a36Sopenharmony_cielif [ "`uname -m`" = "armv7l" ]; then
4462306a36Sopenharmony_ci    ARCH="arm"
4562306a36Sopenharmony_cielse
4662306a36Sopenharmony_ci    ARCH="x86_64"
4762306a36Sopenharmony_cifi
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_cicurl -L --retry 4 -f --retry-all-errors --retry-delay 60 -s ${FDO_HTTP_CACHE_URI:-}$PIPELINE_ARTIFACTS_BASE/$ARCH/igt.tar.gz | tar --zstd -v -x -C /
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciset +e
5262306a36Sopenharmony_ciigt-runner \
5362306a36Sopenharmony_ci    run \
5462306a36Sopenharmony_ci    --igt-folder /igt/libexec/igt-gpu-tools \
5562306a36Sopenharmony_ci    --caselist /install/testlist.txt \
5662306a36Sopenharmony_ci    --output /results \
5762306a36Sopenharmony_ci    $IGT_SKIPS \
5862306a36Sopenharmony_ci    $IGT_FLAKES \
5962306a36Sopenharmony_ci    $IGT_FAILS \
6062306a36Sopenharmony_ci    --fraction-start $CI_NODE_INDEX \
6162306a36Sopenharmony_ci    --fraction $CI_NODE_TOTAL \
6262306a36Sopenharmony_ci    --jobs 1
6362306a36Sopenharmony_ciret=$?
6462306a36Sopenharmony_ciset -e
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_cideqp-runner junit \
6762306a36Sopenharmony_ci   --testsuite IGT \
6862306a36Sopenharmony_ci   --results /results/failures.csv \
6962306a36Sopenharmony_ci   --output /results/junit.xml \
7062306a36Sopenharmony_ci   --limit 50 \
7162306a36Sopenharmony_ci   --template "See https://$CI_PROJECT_ROOT_NAMESPACE.pages.freedesktop.org/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/results/{{testcase}}.xml"
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci# Store the results also in the simpler format used by the runner in ChromeOS CI
7462306a36Sopenharmony_ci#sed -r 's/(dmesg-warn|pass)/success/g' /results/results.txt > /results/results_simple.txt
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_cicd $oldpath
7762306a36Sopenharmony_ciexit $ret
78