discovery.py 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. # Check the basic discovery process, including a sub-suite.
  2. #
  3. # RUN: %{lit} %{inputs}/discovery \
  4. # RUN: -j 1 --debug --show-tests --show-suites \
  5. # RUN: -v > %t.out 2> %t.err
  6. # RUN: FileCheck --check-prefix=CHECK-BASIC-OUT < %t.out %s
  7. # RUN: FileCheck --check-prefix=CHECK-BASIC-ERR < %t.err %s
  8. #
  9. # CHECK-BASIC-ERR: loading suite config '{{.*(/|\\\\)discovery(/|\\\\)lit.cfg}}'
  10. # CHECK-BASIC-ERR-DAG: loading suite config '{{.*(/|\\\\)discovery(/|\\\\)subsuite(/|\\\\)lit.cfg}}'
  11. # CHECK-BASIC-ERR-DAG: loading local config '{{.*(/|\\\\)discovery(/|\\\\)subdir(/|\\\\)lit.local.cfg}}'
  12. #
  13. # CHECK-BASIC-OUT: -- Test Suites --
  14. # CHECK-BASIC-OUT: sub-suite - 2 tests
  15. # CHECK-BASIC-OUT: Source Root: {{.*[/\\]discovery[/\\]subsuite$}}
  16. # CHECK-BASIC-OUT: Exec Root : {{.*[/\\]discovery[/\\]subsuite$}}
  17. # CHECK-BASIC-OUT: top-level-suite - 3 tests
  18. # CHECK-BASIC-OUT: Source Root: {{.*[/\\]discovery$}}
  19. # CHECK-BASIC-OUT: Exec Root : {{.*[/\\]discovery$}}
  20. #
  21. # CHECK-BASIC-OUT: -- Available Tests --
  22. # CHECK-BASIC-OUT: sub-suite :: test-one
  23. # CHECK-BASIC-OUT: sub-suite :: test-two
  24. # CHECK-BASIC-OUT: top-level-suite :: subdir/test-three
  25. # CHECK-BASIC-OUT: top-level-suite :: test-one
  26. # CHECK-BASIC-OUT: top-level-suite :: test-two
  27. # Check discovery when providing the special builtin 'config_map'
  28. # RUN: %{python} %{inputs}/config-map-discovery/driver.py \
  29. # RUN: %{inputs}/config-map-discovery/main-config/lit.cfg \
  30. # RUN: %{inputs}/config-map-discovery/lit.alt.cfg \
  31. # RUN: --workers=1 --debug --show-tests --show-suites > %t.out 2> %t.err
  32. # RUN: FileCheck --check-prefix=CHECK-CONFIG-MAP-OUT < %t.out %s
  33. # RUN: FileCheck --check-prefix=CHECK-CONFIG-MAP-ERR < %t.err %s
  34. # CHECK-CONFIG-MAP-OUT-NOT: ERROR: lit.cfg invoked
  35. # CHECK-CONFIG-MAP-OUT: -- Test Suites --
  36. # CHECK-CONFIG-MAP-OUT: config-map - 2 tests
  37. # CHECK-CONFIG-MAP-OUT: Source Root: {{.*[/\\]config-map-discovery[/\\]tests}}
  38. # CHECK-CONFIG-MAP-OUT: Exec Root : {{.*[/\\]tests[/\\]Inputs[/\\]config-map-discovery}}
  39. # CHECK-CONFIG-MAP-OUT: -- Available Tests --
  40. # CHECK-CONFIG-MAP-OUT-NOT: invalid-test.txt
  41. # CHECK-CONFIG-MAP-OUT: config-map :: test1.txt
  42. # CHECK-CONFIG-MAP-OUT: config-map :: test2.txt
  43. # CHECK-CONFIG-MAP-ERR: loading suite config '{{.*}}lit.alt.cfg'
  44. # CHECK-CONFIG-MAP-ERR: loaded config '{{.*}}lit.alt.cfg'
  45. # CHECK-CONFIG-MAP-ERR: resolved input '{{.*(/|\\\\)config-map-discovery(/|\\\\)main-config}}' to 'config-map'::()
  46. # Check discovery when exact test names are given.
  47. #
  48. # RUN: %{lit} \
  49. # RUN: %{inputs}/discovery/subdir/test-three.py \
  50. # RUN: %{inputs}/discovery/subsuite/test-one.txt \
  51. # RUN: -j 1 --show-tests --show-suites -v > %t.out
  52. # RUN: FileCheck --check-prefix=CHECK-EXACT-TEST < %t.out %s
  53. #
  54. # CHECK-EXACT-TEST: -- Available Tests --
  55. # CHECK-EXACT-TEST: sub-suite :: test-one
  56. # CHECK-EXACT-TEST: top-level-suite :: subdir/test-three
  57. # Check discovery when config files end in .py
  58. # RUN: %{lit} %{inputs}/py-config-discovery \
  59. # RUN: -j 1 --debug --show-tests --show-suites \
  60. # RUN: -v > %t.out 2> %t.err
  61. # RUN: FileCheck --check-prefix=CHECK-PYCONFIG-OUT < %t.out %s
  62. # RUN: FileCheck --check-prefix=CHECK-PYCONFIG-ERR < %t.err %s
  63. #
  64. # CHECK-PYCONFIG-ERR: loading suite config '{{.*(/|\\\\)py-config-discovery(/|\\\\)lit.site.cfg.py}}'
  65. # CHECK-PYCONFIG-ERR: load_config from '{{.*(/|\\\\)discovery(/|\\\\)lit.cfg}}'
  66. # CHECK-PYCONFIG-ERR: loaded config '{{.*(/|\\\\)discovery(/|\\\\)lit.cfg}}'
  67. # CHECK-PYCONFIG-ERR: loaded config '{{.*(/|\\\\)py-config-discovery(/|\\\\)lit.site.cfg.py}}'
  68. # CHECK-PYCONFIG-ERR-DAG: loading suite config '{{.*(/|\\\\)discovery(/|\\\\)subsuite(/|\\\\)lit.cfg}}'
  69. # CHECK-PYCONFIG-ERR-DAG: loading local config '{{.*(/|\\\\)discovery(/|\\\\)subdir(/|\\\\)lit.local.cfg}}'
  70. #
  71. # CHECK-PYCONFIG-OUT: -- Test Suites --
  72. # CHECK-PYCONFIG-OUT: sub-suite - 2 tests
  73. # CHECK-PYCONFIG-OUT: Source Root: {{.*[/\\]discovery[/\\]subsuite$}}
  74. # CHECK-PYCONFIG-OUT: Exec Root : {{.*[/\\]discovery[/\\]subsuite$}}
  75. # CHECK-PYCONFIG-OUT: top-level-suite - 3 tests
  76. # CHECK-PYCONFIG-OUT: Source Root: {{.*[/\\]discovery$}}
  77. # CHECK-PYCONFIG-OUT: Exec Root : {{.*[/\\]py-config-discovery$}}
  78. #
  79. # CHECK-PYCONFIG-OUT: -- Available Tests --
  80. # CHECK-PYCONFIG-OUT: sub-suite :: test-one
  81. # CHECK-PYCONFIG-OUT: sub-suite :: test-two
  82. # CHECK-PYCONFIG-OUT: top-level-suite :: subdir/test-three
  83. # CHECK-PYCONFIG-OUT: top-level-suite :: test-one
  84. # CHECK-PYCONFIG-OUT: top-level-suite :: test-two
  85. # Check discovery when using an exec path.
  86. #
  87. # RUN: %{lit} %{inputs}/exec-discovery \
  88. # RUN: -j 1 --debug --show-tests --show-suites \
  89. # RUN: -v > %t.out 2> %t.err
  90. # RUN: FileCheck --check-prefix=CHECK-ASEXEC-OUT < %t.out %s
  91. # RUN: FileCheck --check-prefix=CHECK-ASEXEC-ERR < %t.err %s
  92. #
  93. # CHECK-ASEXEC-ERR: loading suite config '{{.*(/|\\\\)exec-discovery(/|\\\\)lit.site.cfg}}'
  94. # CHECK-ASEXEC-ERR: load_config from '{{.*(/|\\\\)discovery(/|\\\\)lit.cfg}}'
  95. # CHECK-ASEXEC-ERR: loaded config '{{.*(/|\\\\)discovery(/|\\\\)lit.cfg}}'
  96. # CHECK-ASEXEC-ERR: loaded config '{{.*(/|\\\\)exec-discovery(/|\\\\)lit.site.cfg}}'
  97. # CHECK-ASEXEC-ERR-DAG: loading suite config '{{.*(/|\\\\)discovery(/|\\\\)subsuite(/|\\\\)lit.cfg}}'
  98. # CHECK-ASEXEC-ERR-DAG: loading local config '{{.*(/|\\\\)discovery(/|\\\\)subdir(/|\\\\)lit.local.cfg}}'
  99. #
  100. # CHECK-ASEXEC-OUT: -- Test Suites --
  101. # CHECK-ASEXEC-OUT: sub-suite - 2 tests
  102. # CHECK-ASEXEC-OUT: Source Root: {{.*[/\\]discovery[/\\]subsuite$}}
  103. # CHECK-ASEXEC-OUT: Exec Root : {{.*[/\\]discovery[/\\]subsuite$}}
  104. # CHECK-ASEXEC-OUT: top-level-suite - 3 tests
  105. # CHECK-ASEXEC-OUT: Source Root: {{.*[/\\]discovery$}}
  106. # CHECK-ASEXEC-OUT: Exec Root : {{.*[/\\]exec-discovery$}}
  107. #
  108. # CHECK-ASEXEC-OUT: -- Available Tests --
  109. # CHECK-ASEXEC-OUT: sub-suite :: test-one
  110. # CHECK-ASEXEC-OUT: sub-suite :: test-two
  111. # CHECK-ASEXEC-OUT: top-level-suite :: subdir/test-three
  112. # CHECK-ASEXEC-OUT: top-level-suite :: test-one
  113. # CHECK-ASEXEC-OUT: top-level-suite :: test-two
  114. # Check discovery when exact test names are given.
  115. #
  116. # FIXME: Note that using a path into a subsuite doesn't work correctly here.
  117. #
  118. # RUN: %{lit} \
  119. # RUN: %{inputs}/exec-discovery/subdir/test-three.py \
  120. # RUN: -j 1 --show-tests --show-suites -v > %t.out
  121. # RUN: FileCheck --check-prefix=CHECK-ASEXEC-EXACT-TEST < %t.out %s
  122. #
  123. # CHECK-ASEXEC-EXACT-TEST: -- Available Tests --
  124. # CHECK-ASEXEC-EXACT-TEST: top-level-suite :: subdir/test-three
  125. # Check that we don't recurse infinitely when loading an site specific test
  126. # suite located inside the test source root.
  127. #
  128. # RUN: %{lit} \
  129. # RUN: %{inputs}/exec-discovery-in-tree/obj/ \
  130. # RUN: -j 1 --show-tests --show-suites -v > %t.out
  131. # RUN: FileCheck --check-prefix=CHECK-ASEXEC-INTREE < %t.out %s
  132. #
  133. # Try it again after cd'ing into the test suite using a short relative path.
  134. #
  135. # RUN: cd %{inputs}/exec-discovery-in-tree/obj/
  136. # RUN: %{lit} . \
  137. # RUN: -j 1 --show-tests --show-suites -v > %t.out
  138. # RUN: FileCheck --check-prefix=CHECK-ASEXEC-INTREE < %t.out %s
  139. #
  140. # CHECK-ASEXEC-INTREE: exec-discovery-in-tree-suite - 1 tests
  141. # CHECK-ASEXEC-INTREE-NEXT: Source Root: {{.*[/\\]exec-discovery-in-tree$}}
  142. # CHECK-ASEXEC-INTREE-NEXT: Exec Root : {{.*[/\\]exec-discovery-in-tree[/\\]obj$}}
  143. # CHECK-ASEXEC-INTREE-NEXT: -- Available Tests --
  144. # CHECK-ASEXEC-INTREE-NEXT: exec-discovery-in-tree-suite :: test-one