162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0+ 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci========================================= 462306a36Sopenharmony_ciAutomated testing of the DRM subsystem 562306a36Sopenharmony_ci========================================= 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciIntroduction 862306a36Sopenharmony_ci============ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciMaking sure that changes to the core or drivers don't introduce regressions can 1162306a36Sopenharmony_cibe very time-consuming when lots of different hardware configurations need to 1262306a36Sopenharmony_cibe tested. Moreover, it isn't practical for each person interested in this 1362306a36Sopenharmony_citesting to have to acquire and maintain what can be a considerable amount of 1462306a36Sopenharmony_cihardware. 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciAlso, it is desirable for developers to check for regressions in their code by 1762306a36Sopenharmony_cithemselves, instead of relying on the maintainers to find them and then 1862306a36Sopenharmony_cireporting back. 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciThere are facilities in gitlab.freedesktop.org to automatically test Mesa that 2162306a36Sopenharmony_cican be used as well for testing the DRM subsystem. This document explains how 2262306a36Sopenharmony_cipeople interested in testing it can use this shared infrastructure to save 2362306a36Sopenharmony_ciquite some time and effort. 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciRelevant files 2762306a36Sopenharmony_ci============== 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_cidrivers/gpu/drm/ci/gitlab-ci.yml 3062306a36Sopenharmony_ci-------------------------------- 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciThis is the root configuration file for GitLab CI. Among other less interesting 3362306a36Sopenharmony_cibits, it specifies the specific version of the scripts to be used. There are 3462306a36Sopenharmony_cisome variables that can be modified to change the behavior of the pipeline: 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciDRM_CI_PROJECT_PATH 3762306a36Sopenharmony_ci Repository that contains the Mesa software infrastructure for CI 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ciDRM_CI_COMMIT_SHA 4062306a36Sopenharmony_ci A particular revision to use from that repository 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ciUPSTREAM_REPO 4362306a36Sopenharmony_ci URL to git repository containing the target branch 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ciTARGET_BRANCH 4662306a36Sopenharmony_ci Branch to which this branch is to be merged into 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ciIGT_VERSION 4962306a36Sopenharmony_ci Revision of igt-gpu-tools being used, from 5062306a36Sopenharmony_ci https://gitlab.freedesktop.org/drm/igt-gpu-tools 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_cidrivers/gpu/drm/ci/testlist.txt 5362306a36Sopenharmony_ci------------------------------- 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ciIGT tests to be run on all drivers (unless mentioned in a driver's \*-skips.txt 5662306a36Sopenharmony_cifile, see below). 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_cidrivers/gpu/drm/ci/${DRIVER_NAME}-${HW_REVISION}-fails.txt 5962306a36Sopenharmony_ci---------------------------------------------------------- 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciLists the known failures for a given driver on a specific hardware revision. 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_cidrivers/gpu/drm/ci/${DRIVER_NAME}-${HW_REVISION}-flakes.txt 6462306a36Sopenharmony_ci----------------------------------------------------------- 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ciLists the tests that for a given driver on a specific hardware revision are 6762306a36Sopenharmony_ciknown to behave unreliably. These tests won't cause a job to fail regardless of 6862306a36Sopenharmony_cithe result. They will still be run. 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_cidrivers/gpu/drm/ci/${DRIVER_NAME}-${HW_REVISION}-skips.txt 7162306a36Sopenharmony_ci----------------------------------------------------------- 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ciLists the tests that won't be run for a given driver on a specific hardware 7462306a36Sopenharmony_cirevision. These are usually tests that interfere with the running of the test 7562306a36Sopenharmony_cilist due to hanging the machine, causing OOM, taking too long, etc. 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ciHow to enable automated testing on your tree 7962306a36Sopenharmony_ci============================================ 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci1. Create a Linux tree in https://gitlab.freedesktop.org/ if you don't have one 8262306a36Sopenharmony_ciyet 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci2. In your kernel repo's configuration (eg. 8562306a36Sopenharmony_cihttps://gitlab.freedesktop.org/janedoe/linux/-/settings/ci_cd), change the 8662306a36Sopenharmony_ciCI/CD configuration file from .gitlab-ci.yml to 8762306a36Sopenharmony_cidrivers/gpu/drm/ci/gitlab-ci.yml. 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci3. Next time you push to this repository, you will see a CI pipeline being 9062306a36Sopenharmony_cicreated (eg. https://gitlab.freedesktop.org/janedoe/linux/-/pipelines) 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci4. The various jobs will be run and when the pipeline is finished, all jobs 9362306a36Sopenharmony_cishould be green unless a regression has been found. 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ciHow to update test expectations 9762306a36Sopenharmony_ci=============================== 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ciIf your changes to the code fix any tests, you will have to remove one or more 10062306a36Sopenharmony_cilines from one or more of the files in 10162306a36Sopenharmony_cidrivers/gpu/drm/ci/${DRIVER_NAME}_*_fails.txt, for each of the test platforms 10262306a36Sopenharmony_ciaffected by the change. 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ciHow to expand coverage 10662306a36Sopenharmony_ci====================== 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ciIf your code changes make it possible to run more tests (by solving reliability 10962306a36Sopenharmony_ciissues, for example), you can remove tests from the flakes and/or skips lists, 11062306a36Sopenharmony_ciand then the expected results if there are any known failures. 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ciIf there is a need for updating the version of IGT being used (maybe you have 11362306a36Sopenharmony_ciadded more tests to it), update the IGT_VERSION variable at the top of the 11462306a36Sopenharmony_cigitlab-ci.yml file. 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ciHow to test your changes to the scripts 11862306a36Sopenharmony_ci======================================= 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ciFor testing changes to the scripts in the drm-ci repo, change the 12162306a36Sopenharmony_ciDRM_CI_PROJECT_PATH and DRM_CI_COMMIT_SHA variables in 12262306a36Sopenharmony_cidrivers/gpu/drm/ci/gitlab-ci.yml to match your fork of the project (eg. 12362306a36Sopenharmony_cijanedoe/drm-ci). This fork needs to be in https://gitlab.freedesktop.org/. 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ciHow to incorporate external fixes in your testing 12762306a36Sopenharmony_ci================================================= 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ciOften, regressions in other trees will prevent testing changes local to the 13062306a36Sopenharmony_citree under test. These fixes will be automatically merged in during the build 13162306a36Sopenharmony_cijobs from a branch in the target tree that is named as 13262306a36Sopenharmony_ci${TARGET_BRANCH}-external-fixes. 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ciIf the pipeline is not in a merge request and a branch with the same name 13562306a36Sopenharmony_ciexists in the local tree, commits from that branch will be merged in as well. 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ciHow to deal with automated testing labs that may be down 13962306a36Sopenharmony_ci======================================================== 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ciIf a hardware farm is down and thus causing pipelines to fail that would 14262306a36Sopenharmony_ciotherwise pass, one can disable all jobs that would be submitted to that farm 14362306a36Sopenharmony_ciby editing the file at 14462306a36Sopenharmony_cihttps://gitlab.freedesktop.org/gfx-ci/lab-status/-/blob/main/lab-status.yml. 145