automated_testing.rst 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. =========================================
  3. Automated testing of the DRM subsystem
  4. =========================================
  5. Introduction
  6. ============
  7. Making sure that changes to the core or drivers don't introduce regressions can
  8. be very time-consuming when lots of different hardware configurations need to
  9. be tested. Moreover, it isn't practical for each person interested in this
  10. testing to have to acquire and maintain what can be a considerable amount of
  11. hardware.
  12. Also, it is desirable for developers to check for regressions in their code by
  13. themselves, instead of relying on the maintainers to find them and then
  14. reporting back.
  15. There are facilities in gitlab.freedesktop.org to automatically test Mesa that
  16. can be used as well for testing the DRM subsystem. This document explains how
  17. people interested in testing it can use this shared infrastructure to save
  18. quite some time and effort.
  19. Relevant files
  20. ==============
  21. drivers/gpu/drm/ci/gitlab-ci.yml
  22. --------------------------------
  23. This is the root configuration file for GitLab CI. Among other less interesting
  24. bits, it specifies the specific version of the scripts to be used. There are
  25. some variables that can be modified to change the behavior of the pipeline:
  26. DRM_CI_PROJECT_PATH
  27. Repository that contains the Mesa software infrastructure for CI
  28. DRM_CI_COMMIT_SHA
  29. A particular revision to use from that repository
  30. UPSTREAM_REPO
  31. URL to git repository containing the target branch
  32. TARGET_BRANCH
  33. Branch to which this branch is to be merged into
  34. IGT_VERSION
  35. Revision of igt-gpu-tools being used, from
  36. https://gitlab.freedesktop.org/drm/igt-gpu-tools
  37. drivers/gpu/drm/ci/testlist.txt
  38. -------------------------------
  39. IGT tests to be run on all drivers (unless mentioned in a driver's \*-skips.txt
  40. file, see below).
  41. drivers/gpu/drm/ci/${DRIVER_NAME}-${HW_REVISION}-fails.txt
  42. ----------------------------------------------------------
  43. Lists the known failures for a given driver on a specific hardware revision.
  44. drivers/gpu/drm/ci/${DRIVER_NAME}-${HW_REVISION}-flakes.txt
  45. -----------------------------------------------------------
  46. Lists the tests that for a given driver on a specific hardware revision are
  47. known to behave unreliably. These tests won't cause a job to fail regardless of
  48. the result. They will still be run.
  49. Each new flake entry must be associated with a link to the email reporting the
  50. bug to the author of the affected driver or the relevant GitLab issue. The entry
  51. must also include the board name or Device Tree name, the first kernel version
  52. affected, the IGT version used for tests, and an approximation of the failure rate.
  53. They should be provided under the following format::
  54. # Bug Report: $LORE_URL_OR_GITLAB_ISSUE
  55. # Board Name: broken-board.dtb
  56. # Linux Version: 6.6-rc1
  57. # IGT Version: 1.28-gd2af13d9f
  58. # Failure Rate: 100
  59. flaky-test
  60. Use the appropriate link below to create a GitLab issue:
  61. amdgpu driver: https://gitlab.freedesktop.org/drm/amd/-/issues
  62. i915 driver: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues
  63. msm driver: https://gitlab.freedesktop.org/drm/msm/-/issues
  64. xe driver: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues
  65. drivers/gpu/drm/ci/${DRIVER_NAME}-${HW_REVISION}-skips.txt
  66. -----------------------------------------------------------
  67. Lists the tests that won't be run for a given driver on a specific hardware
  68. revision. These are usually tests that interfere with the running of the test
  69. list due to hanging the machine, causing OOM, taking too long, etc.
  70. How to enable automated testing on your tree
  71. ============================================
  72. 1. Create a Linux tree in https://gitlab.freedesktop.org/ if you don't have one
  73. yet
  74. 2. In your kernel repo's configuration (eg.
  75. https://gitlab.freedesktop.org/janedoe/linux/-/settings/ci_cd), change the
  76. CI/CD configuration file from .gitlab-ci.yml to
  77. drivers/gpu/drm/ci/gitlab-ci.yml.
  78. 3. Request to be added to the drm/ci-ok group so that your user has the
  79. necessary privileges to run the CI on https://gitlab.freedesktop.org/drm/ci-ok
  80. 4. Next time you push to this repository, you will see a CI pipeline being
  81. created (eg. https://gitlab.freedesktop.org/janedoe/linux/-/pipelines)
  82. 5. The various jobs will be run and when the pipeline is finished, all jobs
  83. should be green unless a regression has been found.
  84. 6. Warnings in the pipeline indicate that lockdep
  85. (see Documentation/locking/lockdep-design.rst) issues have been detected
  86. during the tests.
  87. How to update test expectations
  88. ===============================
  89. If your changes to the code fix any tests, you will have to remove one or more
  90. lines from one or more of the files in
  91. drivers/gpu/drm/ci/${DRIVER_NAME}_*_fails.txt, for each of the test platforms
  92. affected by the change.
  93. How to expand coverage
  94. ======================
  95. If your code changes make it possible to run more tests (by solving reliability
  96. issues, for example), you can remove tests from the flakes and/or skips lists,
  97. and then the expected results if there are any known failures.
  98. If there is a need for updating the version of IGT being used (maybe you have
  99. added more tests to it), update the IGT_VERSION variable at the top of the
  100. gitlab-ci.yml file.
  101. How to test your changes to the scripts
  102. =======================================
  103. For testing changes to the scripts in the drm-ci repo, change the
  104. DRM_CI_PROJECT_PATH and DRM_CI_COMMIT_SHA variables in
  105. drivers/gpu/drm/ci/gitlab-ci.yml to match your fork of the project (eg.
  106. janedoe/drm-ci). This fork needs to be in https://gitlab.freedesktop.org/.
  107. How to incorporate external fixes in your testing
  108. =================================================
  109. Often, regressions in other trees will prevent testing changes local to the
  110. tree under test. These fixes will be automatically merged in during the build
  111. jobs from a branch in the target tree that is named as
  112. ${TARGET_BRANCH}-external-fixes.
  113. If the pipeline is not in a merge request and a branch with the same name
  114. exists in the local tree, commits from that branch will be merged in as well.
  115. How to deal with automated testing labs that may be down
  116. ========================================================
  117. If a hardware farm is down and thus causing pipelines to fail that would
  118. otherwise pass, one can disable all jobs that would be submitted to that farm
  119. by editing the file at
  120. https://gitlab.freedesktop.org/gfx-ci/lab-status/-/blob/main/lab-status.yml.