automated_testing.rst 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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, the board name or Device Tree name of
  51. the board, the first kernel version affected, the IGT version used for tests,
  52. and an approximation of the failure rate.
  53. They should be provided under the following format::
  54. # Bug Report: $LORE_OR_PATCHWORK_URL
  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. drivers/gpu/drm/ci/${DRIVER_NAME}-${HW_REVISION}-skips.txt
  61. -----------------------------------------------------------
  62. Lists the tests that won't be run for a given driver on a specific hardware
  63. revision. These are usually tests that interfere with the running of the test
  64. list due to hanging the machine, causing OOM, taking too long, etc.
  65. How to enable automated testing on your tree
  66. ============================================
  67. 1. Create a Linux tree in https://gitlab.freedesktop.org/ if you don't have one
  68. yet
  69. 2. In your kernel repo's configuration (eg.
  70. https://gitlab.freedesktop.org/janedoe/linux/-/settings/ci_cd), change the
  71. CI/CD configuration file from .gitlab-ci.yml to
  72. drivers/gpu/drm/ci/gitlab-ci.yml.
  73. 3. Request to be added to the drm/ci-ok group so that your user has the
  74. necessary privileges to run the CI on https://gitlab.freedesktop.org/drm/ci-ok
  75. 4. Next time you push to this repository, you will see a CI pipeline being
  76. created (eg. https://gitlab.freedesktop.org/janedoe/linux/-/pipelines)
  77. 5. The various jobs will be run and when the pipeline is finished, all jobs
  78. should be green unless a regression has been found.
  79. How to update test expectations
  80. ===============================
  81. If your changes to the code fix any tests, you will have to remove one or more
  82. lines from one or more of the files in
  83. drivers/gpu/drm/ci/${DRIVER_NAME}_*_fails.txt, for each of the test platforms
  84. affected by the change.
  85. How to expand coverage
  86. ======================
  87. If your code changes make it possible to run more tests (by solving reliability
  88. issues, for example), you can remove tests from the flakes and/or skips lists,
  89. and then the expected results if there are any known failures.
  90. If there is a need for updating the version of IGT being used (maybe you have
  91. added more tests to it), update the IGT_VERSION variable at the top of the
  92. gitlab-ci.yml file.
  93. How to test your changes to the scripts
  94. =======================================
  95. For testing changes to the scripts in the drm-ci repo, change the
  96. DRM_CI_PROJECT_PATH and DRM_CI_COMMIT_SHA variables in
  97. drivers/gpu/drm/ci/gitlab-ci.yml to match your fork of the project (eg.
  98. janedoe/drm-ci). This fork needs to be in https://gitlab.freedesktop.org/.
  99. How to incorporate external fixes in your testing
  100. =================================================
  101. Often, regressions in other trees will prevent testing changes local to the
  102. tree under test. These fixes will be automatically merged in during the build
  103. jobs from a branch in the target tree that is named as
  104. ${TARGET_BRANCH}-external-fixes.
  105. If the pipeline is not in a merge request and a branch with the same name
  106. exists in the local tree, commits from that branch will be merged in as well.
  107. How to deal with automated testing labs that may be down
  108. ========================================================
  109. If a hardware farm is down and thus causing pipelines to fail that would
  110. otherwise pass, one can disable all jobs that would be submitted to that farm
  111. by editing the file at
  112. https://gitlab.freedesktop.org/gfx-ci/lab-status/-/blob/main/lab-status.yml.