1 # RUN: %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-BASIC %s
2 # CHECK-BASIC: Testing: 5 tests
4 # Check that regex-filtering works
6 # RUN: %{lit} --filter 'o[a-z]e' %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s
7 # CHECK-FILTER: Testing: 2 of 5 tests
9 # Check that regex-filtering based on environment variables work.
11 # RUN: env LIT_FILTER='o[a-z]e' %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER-ENV %s
12 # CHECK-FILTER-ENV: Testing: 2 of 5 tests
15 # Check that maximum counts work
17 # RUN: %{lit} --max-tests 3 %{inputs}/discovery | FileCheck --check-prefix=CHECK-MAX %s
18 # CHECK-MAX: Testing: 3 of 5 tests
21 # Check that sharding partitions the testsuite in a way that distributes the
22 # rounding error nicely (i.e. 5/3 => 2 2 1, not 1 1 3 or whatever)
24 # RUN: %{lit} --num-shards 3 --run-shard 1 %{inputs}/discovery >%t.out 2>%t.err
25 # RUN: FileCheck --check-prefix=CHECK-SHARD0-ERR < %t.err %s
26 # RUN: FileCheck --check-prefix=CHECK-SHARD0-OUT < %t.out %s
27 # CHECK-SHARD0-ERR: note: Selecting shard 1/3 = size 2/5 = tests #(3*k)+1 = [1, 4]
28 # CHECK-SHARD0-OUT: Testing: 2 of 5 tests
30 # RUN: %{lit} --num-shards 3 --run-shard 2 %{inputs}/discovery >%t.out 2>%t.err
31 # RUN: FileCheck --check-prefix=CHECK-SHARD1-ERR < %t.err %s
32 # RUN: FileCheck --check-prefix=CHECK-SHARD1-OUT < %t.out %s
33 # CHECK-SHARD1-ERR: note: Selecting shard 2/3 = size 2/5 = tests #(3*k)+2 = [2, 5]
34 # CHECK-SHARD1-OUT: Testing: 2 of 5 tests
36 # RUN: %{lit} --num-shards 3 --run-shard 3 %{inputs}/discovery >%t.out 2>%t.err
37 # RUN: FileCheck --check-prefix=CHECK-SHARD2-ERR < %t.err %s
38 # RUN: FileCheck --check-prefix=CHECK-SHARD2-OUT < %t.out %s
39 # CHECK-SHARD2-ERR: note: Selecting shard 3/3 = size 1/5 = tests #(3*k)+3 = [3]
40 # CHECK-SHARD2-OUT: Testing: 1 of 5 tests
43 # Check that sharding via env vars works.
45 # RUN: env LIT_NUM_SHARDS=3 LIT_RUN_SHARD=1 %{lit} %{inputs}/discovery >%t.out 2>%t.err
46 # RUN: FileCheck --check-prefix=CHECK-SHARD0-ENV-ERR < %t.err %s
47 # RUN: FileCheck --check-prefix=CHECK-SHARD0-ENV-OUT < %t.out %s
48 # CHECK-SHARD0-ENV-ERR: note: Selecting shard 1/3 = size 2/5 = tests #(3*k)+1 = [1, 4]
49 # CHECK-SHARD0-ENV-OUT: Testing: 2 of 5 tests
51 # RUN: env LIT_NUM_SHARDS=3 LIT_RUN_SHARD=2 %{lit} %{inputs}/discovery >%t.out 2>%t.err
52 # RUN: FileCheck --check-prefix=CHECK-SHARD1-ENV-ERR < %t.err %s
53 # RUN: FileCheck --check-prefix=CHECK-SHARD1-ENV-OUT < %t.out %s
54 # CHECK-SHARD1-ENV-ERR: note: Selecting shard 2/3 = size 2/5 = tests #(3*k)+2 = [2, 5]
55 # CHECK-SHARD1-ENV-OUT: Testing: 2 of 5 tests
57 # RUN: env LIT_NUM_SHARDS=3 LIT_RUN_SHARD=3 %{lit} %{inputs}/discovery >%t.out 2>%t.err
58 # RUN: FileCheck --check-prefix=CHECK-SHARD2-ENV-ERR < %t.err %s
59 # RUN: FileCheck --check-prefix=CHECK-SHARD2-ENV-OUT < %t.out %s
60 # CHECK-SHARD2-ENV-ERR: note: Selecting shard 3/3 = size 1/5 = tests #(3*k)+3 = [3]
61 # CHECK-SHARD2-ENV-OUT: Testing: 1 of 5 tests
64 # Check that providing more shards than tests results in 1 test per shard
65 # until we run out, then 0.
67 # RUN: %{lit} --num-shards 100 --run-shard 2 %{inputs}/discovery >%t.out 2>%t.err
68 # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR1 < %t.err %s
69 # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-OUT1 < %t.out %s
70 # CHECK-SHARD-BIG-ERR1: note: Selecting shard 2/100 = size 1/5 = tests #(100*k)+2 = [2]
71 # CHECK-SHARD-BIG-OUT1: Testing: 1 of 5 tests
73 # RUN: %{lit} --num-shards 100 --run-shard 6 %{inputs}/discovery >%t.out 2>%t.err
74 # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR2 < %t.err %s
75 # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-OUT2 < %t.out %s
76 # CHECK-SHARD-BIG-ERR2: note: Selecting shard 6/100 = size 0/5 = tests #(100*k)+6 = []
77 # CHECK-SHARD-BIG-OUT2: Testing: 0 of 5 tests
79 # RUN: %{lit} --num-shards 100 --run-shard 50 %{inputs}/discovery >%t.out 2>%t.err
80 # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR3 < %t.err %s
81 # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-OUT3 < %t.out %s
82 # CHECK-SHARD-BIG-ERR3: note: Selecting shard 50/100 = size 0/5 = tests #(100*k)+50 = []
83 # CHECK-SHARD-BIG-OUT3: Testing: 0 of 5 tests
86 # Check that range constraints are enforced
88 # RUN: not %{lit} --num-shards 0 --run-shard 2 %{inputs}/discovery >%t.out 2>%t.err
89 # RUN: FileCheck --check-prefix=CHECK-SHARD-ERR < %t.err %s
90 # CHECK-SHARD-ERR: error: --num-shards must be positive
92 # RUN: not %{lit} --num-shards 3 --run-shard 4 %{inputs}/discovery >%t.out 2>%t.err
93 # RUN: FileCheck --check-prefix=CHECK-SHARD-ERR2 < %t.err %s
94 # CHECK-SHARD-ERR2: error: --run-shard must be between 1 and --num-shards (inclusive)