xref: /minix3/external/bsd/llvm/dist/llvm/utils/lit/tests/discovery.py (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc# Check the basic discovery process, including a sub-suite.
2*f4a2713aSLionel Sambuc#
3*f4a2713aSLionel Sambuc# RUN: %{lit} %{inputs}/discovery \
4*f4a2713aSLionel Sambuc# RUN:   -j 1 --debug --show-tests --show-suites \
5*f4a2713aSLionel Sambuc# RUN:   -v > %t.out 2> %t.err
6*f4a2713aSLionel Sambuc# RUN: FileCheck --check-prefix=CHECK-BASIC-OUT < %t.out %s
7*f4a2713aSLionel Sambuc# RUN: FileCheck --check-prefix=CHECK-BASIC-ERR < %t.err %s
8*f4a2713aSLionel Sambuc#
9*f4a2713aSLionel Sambuc# CHECK-BASIC-ERR: loading suite config '{{.*}}/discovery/lit.cfg'
10*f4a2713aSLionel Sambuc# CHECK-BASIC-ERR: loading local config '{{.*}}/discovery/subdir/lit.local.cfg'
11*f4a2713aSLionel Sambuc# CHECK-BASIC-ERR: loading suite config '{{.*}}/discovery/subsuite/lit.cfg'
12*f4a2713aSLionel Sambuc#
13*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT: -- Test Suites --
14*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT:   sub-suite - 2 tests
15*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT:     Source Root: {{.*/discovery/subsuite$}}
16*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT:     Exec Root  : {{.*/discovery/subsuite$}}
17*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT:   top-level-suite - 3 tests
18*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT:     Source Root: {{.*/discovery$}}
19*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT:     Exec Root  : {{.*/discovery$}}
20*f4a2713aSLionel Sambuc#
21*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT: -- Available Tests --
22*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT: sub-suite :: test-one
23*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT: sub-suite :: test-two
24*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT: top-level-suite :: subdir/test-three
25*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT: top-level-suite :: test-one
26*f4a2713aSLionel Sambuc# CHECK-BASIC-OUT: top-level-suite :: test-two
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambuc# Check discovery when exact test names are given.
30*f4a2713aSLionel Sambuc#
31*f4a2713aSLionel Sambuc# RUN: %{lit} \
32*f4a2713aSLionel Sambuc# RUN:     %{inputs}/discovery/subdir/test-three.py \
33*f4a2713aSLionel Sambuc# RUN:     %{inputs}/discovery/subsuite/test-one.txt \
34*f4a2713aSLionel Sambuc# RUN:   -j 1 --show-tests --show-suites -v > %t.out
35*f4a2713aSLionel Sambuc# RUN: FileCheck --check-prefix=CHECK-EXACT-TEST < %t.out %s
36*f4a2713aSLionel Sambuc#
37*f4a2713aSLionel Sambuc# CHECK-EXACT-TEST: -- Available Tests --
38*f4a2713aSLionel Sambuc# CHECK-EXACT-TEST: sub-suite :: test-one
39*f4a2713aSLionel Sambuc# CHECK-EXACT-TEST: top-level-suite :: subdir/test-three
40*f4a2713aSLionel Sambuc
41*f4a2713aSLionel Sambuc
42*f4a2713aSLionel Sambuc# Check discovery when using an exec path.
43*f4a2713aSLionel Sambuc#
44*f4a2713aSLionel Sambuc# RUN: %{lit} %{inputs}/exec-discovery \
45*f4a2713aSLionel Sambuc# RUN:   -j 1 --debug --show-tests --show-suites \
46*f4a2713aSLionel Sambuc# RUN:   -v > %t.out 2> %t.err
47*f4a2713aSLionel Sambuc# RUN: FileCheck --check-prefix=CHECK-ASEXEC-OUT < %t.out %s
48*f4a2713aSLionel Sambuc# RUN: FileCheck --check-prefix=CHECK-ASEXEC-ERR < %t.err %s
49*f4a2713aSLionel Sambuc#
50*f4a2713aSLionel Sambuc# CHECK-ASEXEC-ERR: loading suite config '{{.*}}/exec-discovery/lit.site.cfg'
51*f4a2713aSLionel Sambuc# CHECK-ASEXEC-ERR: load_config from '{{.*}}/discovery/lit.cfg'
52*f4a2713aSLionel Sambuc# CHECK-ASEXEC-ERR: loaded config '{{.*}}/discovery/lit.cfg'
53*f4a2713aSLionel Sambuc# CHECK-ASEXEC-ERR: loaded config '{{.*}}/exec-discovery/lit.site.cfg'
54*f4a2713aSLionel Sambuc# CHECK-ASEXEC-ERR: loading local config '{{.*}}/discovery/subdir/lit.local.cfg'
55*f4a2713aSLionel Sambuc# CHECK-ASEXEC-ERR: loading suite config '{{.*}}/discovery/subsuite/lit.cfg'
56*f4a2713aSLionel Sambuc#
57*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT: -- Test Suites --
58*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT:   sub-suite - 2 tests
59*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT:     Source Root: {{.*/discovery/subsuite$}}
60*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT:     Exec Root  : {{.*/discovery/subsuite$}}
61*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT:   top-level-suite - 3 tests
62*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT:     Source Root: {{.*/discovery$}}
63*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT:     Exec Root  : {{.*/exec-discovery$}}
64*f4a2713aSLionel Sambuc#
65*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT: -- Available Tests --
66*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT: sub-suite :: test-one
67*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT: sub-suite :: test-two
68*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT: top-level-suite :: subdir/test-three
69*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT: top-level-suite :: test-one
70*f4a2713aSLionel Sambuc# CHECK-ASEXEC-OUT: top-level-suite :: test-two
71*f4a2713aSLionel Sambuc
72*f4a2713aSLionel Sambuc# Check discovery when exact test names are given.
73*f4a2713aSLionel Sambuc#
74*f4a2713aSLionel Sambuc# FIXME: Note that using a path into a subsuite doesn't work correctly here.
75*f4a2713aSLionel Sambuc#
76*f4a2713aSLionel Sambuc# RUN: %{lit} \
77*f4a2713aSLionel Sambuc# RUN:     %{inputs}/exec-discovery/subdir/test-three.py \
78*f4a2713aSLionel Sambuc# RUN:   -j 1 --show-tests --show-suites -v > %t.out
79*f4a2713aSLionel Sambuc# RUN: FileCheck --check-prefix=CHECK-ASEXEC-EXACT-TEST < %t.out %s
80*f4a2713aSLionel Sambuc#
81*f4a2713aSLionel Sambuc# CHECK-ASEXEC-EXACT-TEST: -- Available Tests --
82*f4a2713aSLionel Sambuc# CHECK-ASEXEC-EXACT-TEST: top-level-suite :: subdir/test-three
83*f4a2713aSLionel Sambuc
84*f4a2713aSLionel Sambuc
85*f4a2713aSLionel Sambuc# Check that we don't recurse infinitely when loading an site specific test
86*f4a2713aSLionel Sambuc# suite located inside the test source root.
87*f4a2713aSLionel Sambuc#
88*f4a2713aSLionel Sambuc# RUN: %{lit} \
89*f4a2713aSLionel Sambuc# RUN:     %{inputs}/exec-discovery-in-tree/obj/ \
90*f4a2713aSLionel Sambuc# RUN:   -j 1 --show-tests --show-suites -v > %t.out
91*f4a2713aSLionel Sambuc# RUN: FileCheck --check-prefix=CHECK-ASEXEC-INTREE < %t.out %s
92*f4a2713aSLionel Sambuc#
93*f4a2713aSLionel Sambuc#      CHECK-ASEXEC-INTREE:   exec-discovery-in-tree-suite - 1 tests
94*f4a2713aSLionel Sambuc# CHECK-ASEXEC-INTREE-NEXT:     Source Root: {{.*/exec-discovery-in-tree$}}
95*f4a2713aSLionel Sambuc# CHECK-ASEXEC-INTREE-NEXT:     Exec Root  : {{.*/exec-discovery-in-tree/obj$}}
96*f4a2713aSLionel Sambuc# CHECK-ASEXEC-INTREE-NEXT: -- Available Tests --
97*f4a2713aSLionel Sambuc# CHECK-ASEXEC-INTREE-NEXT: exec-discovery-in-tree-suite :: test-one
98