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# CHECK-BASIC-OUT:     Available Features: feature1 feature2
21# CHECK-BASIC-OUT:     Available Substitutions: %key1 => value1
22# CHECK-BASIC-OUT:                              %key2 => value2
23#
24# CHECK-BASIC-OUT: -- Available Tests --
25# CHECK-BASIC-OUT: sub-suite :: test-one
26# CHECK-BASIC-OUT: sub-suite :: test-two
27# CHECK-BASIC-OUT: top-level-suite :: subdir/test-three
28# CHECK-BASIC-OUT: top-level-suite :: test-one
29# CHECK-BASIC-OUT: top-level-suite :: test-two
30
31# Check discovery when providing the special builtin 'config_map'
32# RUN: %{python} %{inputs}/config-map-discovery/driver.py \
33# RUN:           %{inputs}/config-map-discovery/main-config/lit.cfg \
34# RUN:           %{inputs}/config-map-discovery/lit.alt.cfg \
35# RUN:           --workers=1 --debug --show-tests --show-suites > %t.out 2> %t.err
36# RUN: FileCheck --check-prefix=CHECK-CONFIG-MAP-OUT < %t.out %s
37# RUN: FileCheck --check-prefix=CHECK-CONFIG-MAP-ERR < %t.err %s
38
39# CHECK-CONFIG-MAP-OUT-NOT: ERROR: lit.cfg invoked
40# CHECK-CONFIG-MAP-OUT: -- Test Suites --
41# CHECK-CONFIG-MAP-OUT:   config-map - 2 tests
42# CHECK-CONFIG-MAP-OUT:     Source Root: {{.*[/\\]config-map-discovery[/\\]tests}}
43# CHECK-CONFIG-MAP-OUT:     Exec Root  : {{.*[/\\]tests[/\\]Inputs[/\\]config-map-discovery}}
44# CHECK-CONFIG-MAP-OUT: -- Available Tests --
45# CHECK-CONFIG-MAP-OUT-NOT: invalid-test.txt
46# CHECK-CONFIG-MAP-OUT:   config-map :: test1.txt
47# CHECK-CONFIG-MAP-OUT:   config-map :: test2.txt
48
49# CHECK-CONFIG-MAP-ERR: loading suite config '{{.*}}lit.alt.cfg'
50# CHECK-CONFIG-MAP-ERR: loaded config '{{.*}}lit.alt.cfg'
51# CHECK-CONFIG-MAP-ERR: resolved input '{{.*(/|\\\\)config-map-discovery(/|\\\\)main-config}}' to 'config-map'::()
52
53
54# Check discovery when tests are named directly.
55#
56# RUN: %{lit} \
57# RUN:     %{inputs}/discovery/subdir/test-three.py \
58# RUN:     %{inputs}/discovery/subsuite/test-one.txt \
59# RUN:   -j 1 --show-tests --show-suites -v > %t.out
60# RUN: FileCheck --check-prefix=CHECK-DIRECT-TEST < %t.out %s
61#
62# CHECK-DIRECT-TEST: -- Available Tests --
63# CHECK-DIRECT-TEST: sub-suite :: test-one
64# CHECK-DIRECT-TEST: top-level-suite :: subdir/test-three
65
66# Check discovery when config files end in .py
67# RUN: %{lit} %{inputs}/py-config-discovery \
68# RUN:   -j 1 --debug --show-tests --show-suites \
69# RUN:   -v > %t.out 2> %t.err
70# RUN: FileCheck --check-prefix=CHECK-PYCONFIG-OUT < %t.out %s
71# RUN: FileCheck --check-prefix=CHECK-PYCONFIG-ERR < %t.err %s
72#
73# CHECK-PYCONFIG-ERR: loading suite config '{{.*(/|\\\\)py-config-discovery(/|\\\\)lit.site.cfg.py}}'
74# CHECK-PYCONFIG-ERR: load_config from '{{.*(/|\\\\)discovery(/|\\\\)lit.cfg}}'
75# CHECK-PYCONFIG-ERR: loaded config '{{.*(/|\\\\)discovery(/|\\\\)lit.cfg}}'
76# CHECK-PYCONFIG-ERR: loaded config '{{.*(/|\\\\)py-config-discovery(/|\\\\)lit.site.cfg.py}}'
77# CHECK-PYCONFIG-ERR-DAG: loading suite config '{{.*(/|\\\\)discovery(/|\\\\)subsuite(/|\\\\)lit.cfg}}'
78# CHECK-PYCONFIG-ERR-DAG: loading local config '{{.*(/|\\\\)discovery(/|\\\\)subdir(/|\\\\)lit.local.cfg}}'
79#
80# CHECK-PYCONFIG-OUT: -- Test Suites --
81# CHECK-PYCONFIG-OUT:   sub-suite - 2 tests
82# CHECK-PYCONFIG-OUT:     Source Root: {{.*[/\\]discovery[/\\]subsuite$}}
83# CHECK-PYCONFIG-OUT:     Exec Root  : {{.*[/\\]discovery[/\\]subsuite$}}
84# CHECK-PYCONFIG-OUT:   top-level-suite - 3 tests
85# CHECK-PYCONFIG-OUT:     Source Root: {{.*[/\\]discovery$}}
86# CHECK-PYCONFIG-OUT:     Exec Root  : {{.*[/\\]py-config-discovery$}}
87#
88# CHECK-PYCONFIG-OUT: -- Available Tests --
89# CHECK-PYCONFIG-OUT: sub-suite :: test-one
90# CHECK-PYCONFIG-OUT: sub-suite :: test-two
91# CHECK-PYCONFIG-OUT: top-level-suite :: subdir/test-three
92# CHECK-PYCONFIG-OUT: top-level-suite :: test-one
93# CHECK-PYCONFIG-OUT: top-level-suite :: test-two
94
95# Check discovery when using an exec path.
96#
97# RUN: %{lit} %{inputs}/exec-discovery \
98# RUN:   -j 1 --debug --show-tests --show-suites \
99# RUN:   -v > %t.out 2> %t.err
100# RUN: FileCheck --check-prefix=CHECK-ASEXEC-OUT < %t.out %s
101# RUN: FileCheck --check-prefix=CHECK-ASEXEC-ERR < %t.err %s
102#
103# CHECK-ASEXEC-ERR: loading suite config '{{.*(/|\\\\)exec-discovery(/|\\\\)lit.site.cfg}}'
104# CHECK-ASEXEC-ERR: load_config from '{{.*(/|\\\\)discovery(/|\\\\)lit.cfg}}'
105# CHECK-ASEXEC-ERR: loaded config '{{.*(/|\\\\)discovery(/|\\\\)lit.cfg}}'
106# CHECK-ASEXEC-ERR: loaded config '{{.*(/|\\\\)exec-discovery(/|\\\\)lit.site.cfg}}'
107# CHECK-ASEXEC-ERR-DAG: loading suite config '{{.*(/|\\\\)discovery(/|\\\\)subsuite(/|\\\\)lit.cfg}}'
108# CHECK-ASEXEC-ERR-DAG: loading local config '{{.*(/|\\\\)discovery(/|\\\\)subdir(/|\\\\)lit.local.cfg}}'
109#
110# CHECK-ASEXEC-OUT: -- Test Suites --
111# CHECK-ASEXEC-OUT:   sub-suite - 2 tests
112# CHECK-ASEXEC-OUT:     Source Root: {{.*[/\\]discovery[/\\]subsuite$}}
113# CHECK-ASEXEC-OUT:     Exec Root  : {{.*[/\\]discovery[/\\]subsuite$}}
114# CHECK-ASEXEC-OUT:   top-level-suite - 3 tests
115# CHECK-ASEXEC-OUT:     Source Root: {{.*[/\\]discovery$}}
116# CHECK-ASEXEC-OUT:     Exec Root  : {{.*[/\\]exec-discovery$}}
117#
118# CHECK-ASEXEC-OUT: -- Available Tests --
119# CHECK-ASEXEC-OUT: sub-suite :: test-one
120# CHECK-ASEXEC-OUT: sub-suite :: test-two
121# CHECK-ASEXEC-OUT: top-level-suite :: subdir/test-three
122# CHECK-ASEXEC-OUT: top-level-suite :: test-one
123# CHECK-ASEXEC-OUT: top-level-suite :: test-two
124
125# Check discovery when tests are named directly.
126#
127# FIXME: Note that using a path into a subsuite doesn't work correctly here.
128#
129# RUN: %{lit} \
130# RUN:     %{inputs}/exec-discovery/subdir/test-three.py \
131# RUN:   -j 1 --show-tests --show-suites -v > %t.out
132# RUN: FileCheck --check-prefix=CHECK-ASEXEC-DIRECT-TEST < %t.out %s
133#
134# CHECK-ASEXEC-DIRECT-TEST: -- Available Tests --
135# CHECK-ASEXEC-DIRECT-TEST: top-level-suite :: subdir/test-three
136
137# Check an error is emitted when the directly named test would not be run
138# indirectly (e.g. when the directory containing the test is specified).
139#
140# RUN: not %{lit} \
141# RUN:     %{inputs}/discovery/test.not-txt -j 1 2>%t.err
142# RUN: FileCheck --check-prefix=CHECK-ERROR-INDIRECT-RUN-CHECK < %t.err %s
143#
144# CHECK-ERROR-INDIRECT-RUN-CHECK: error: 'top-level-suite :: test.not-txt' would not be run indirectly
145
146# Check that no error is emitted with --no-indirectly-run-check.
147#
148# RUN: %{lit} \
149# RUN:     %{inputs}/discovery/test.not-txt -j 1 --no-indirectly-run-check
150
151# Check that we don't recurse infinitely when loading an site specific test
152# suite located inside the test source root.
153#
154# RUN: %{lit} \
155# RUN:     %{inputs}/exec-discovery-in-tree/obj/ \
156# RUN:   -j 1 --show-tests --show-suites -v > %t.out
157# RUN: FileCheck --check-prefix=CHECK-ASEXEC-INTREE < %t.out %s
158#
159# Try it again after cd'ing into the test suite using a short relative path.
160#
161# RUN: cd %{inputs}/exec-discovery-in-tree/obj/
162# RUN: %{lit} . \
163# RUN:   -j 1 --show-tests --show-suites -v > %t.out
164# RUN: FileCheck --check-prefix=CHECK-ASEXEC-INTREE < %t.out %s
165#
166#      CHECK-ASEXEC-INTREE:   exec-discovery-in-tree-suite - 1 tests
167# CHECK-ASEXEC-INTREE-NEXT:     Source Root: {{.*[/\\]exec-discovery-in-tree$}}
168# CHECK-ASEXEC-INTREE-NEXT:     Exec Root  : {{.*[/\\]exec-discovery-in-tree[/\\]obj$}}
169# CHECK-ASEXEC-INTREE-NEXT:     Available Features:
170# CHECK-ASEXEC-INTREE-NEXT:     Available Substitutions:
171# CHECK-ASEXEC-INTREE-NEXT: -- Available Tests --
172# CHECK-ASEXEC-INTREE-NEXT: exec-discovery-in-tree-suite :: test-one
173