1# RUN: %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-BASIC %s 2# CHECK-BASIC: Testing: 5 tests 3 4 5# Check that we exit with an error if we do not discover any tests, even with --allow-empty-runs. 6# 7# RUN: not %{lit} %{inputs}/nonexistent 2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s 8# RUN: not %{lit} %{inputs}/nonexistent --allow-empty-runs 2>&1 | FileCheck --check-prefix=CHECK-BAD-PATH %s 9# CHECK-BAD-PATH: error: did not discover any tests for provided path(s) 10 11# Check that we exit with an error if we filter out all tests, but allow it with --allow-empty-runs. 12# Check that we exit with an error if we skip all tests, but allow it with --allow-empty-runs. 13# 14# RUN: not %{lit} --filter 'nonexistent' %{inputs}/discovery 2>&1 | FileCheck --check-prefixes=CHECK-BAD-FILTER,CHECK-BAD-FILTER-ERROR %s 15# RUN: %{lit} --filter 'nonexistent' --allow-empty-runs %{inputs}/discovery 2>&1 | FileCheck --check-prefixes=CHECK-BAD-FILTER,CHECK-BAD-FILTER-ALLOW %s 16# RUN: not %{lit} --filter-out '.*' %{inputs}/discovery 2>&1 | FileCheck --check-prefixes=CHECK-BAD-FILTER,CHECK-BAD-FILTER-ERROR %s 17# RUN: %{lit} --filter-out '.*' --allow-empty-runs %{inputs}/discovery 2>&1 | FileCheck --check-prefixes=CHECK-BAD-FILTER,CHECK-BAD-FILTER-ALLOW %s 18# CHECK-BAD-FILTER: error: filter did not match any tests (of 5 discovered). 19# CHECK-BAD-FILTER-ERROR: Use '--allow-empty-runs' to suppress this error. 20# CHECK-BAD-FILTER-ALLOW: Suppressing error because '--allow-empty-runs' was specified. 21 22# Check that regex-filtering works, is case-insensitive, and can be configured via env var. 23# 24# RUN: %{lit} --filter 'o[a-z]e' %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s 25# RUN: %{lit} --filter 'O[A-Z]E' %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s 26# RUN: env LIT_FILTER='o[a-z]e' %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s 27# RUN: %{lit} --filter-out 'test-t[a-z]' %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s 28# RUN: %{lit} --filter-out 'test-t[A-Z]' %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s 29# RUN: env LIT_FILTER_OUT='test-t[a-z]' %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s 30# CHECK-FILTER: Testing: 2 of 5 tests 31# CHECK-FILTER: Excluded: 3 32 33 34# Check that maximum counts work 35# 36# RUN: %{lit} --max-tests 3 %{inputs}/discovery | FileCheck --check-prefix=CHECK-MAX %s 37# CHECK-MAX: Testing: 3 of 5 tests 38# CHECK-MAX: Excluded: 2 39 40 41# Check that sharding partitions the testsuite in a way that distributes the 42# rounding error nicely (i.e. 5/3 => 2 2 1, not 1 1 3 or whatever) 43# 44# RUN: %{lit} --num-shards 3 --run-shard 1 %{inputs}/discovery >%t.out 2>%t.err 45# RUN: FileCheck --check-prefix=CHECK-SHARD0-ERR < %t.err %s 46# RUN: FileCheck --check-prefix=CHECK-SHARD0-OUT < %t.out %s 47# CHECK-SHARD0-ERR: note: Selecting shard 1/3 = size 2/5 = tests #(3*k)+1 = [1, 4] 48# CHECK-SHARD0-OUT: Testing: 2 of 5 tests 49# CHECK-SHARD0-OUT: Excluded: 3 50# 51# RUN: %{lit} --num-shards 3 --run-shard 2 %{inputs}/discovery >%t.out 2>%t.err 52# RUN: FileCheck --check-prefix=CHECK-SHARD1-ERR < %t.err %s 53# RUN: FileCheck --check-prefix=CHECK-SHARD1-OUT < %t.out %s 54# CHECK-SHARD1-ERR: note: Selecting shard 2/3 = size 2/5 = tests #(3*k)+2 = [2, 5] 55# CHECK-SHARD1-OUT: Testing: 2 of 5 tests 56# 57# RUN: %{lit} --num-shards 3 --run-shard 3 %{inputs}/discovery >%t.out 2>%t.err 58# RUN: FileCheck --check-prefix=CHECK-SHARD2-ERR < %t.err %s 59# RUN: FileCheck --check-prefix=CHECK-SHARD2-OUT < %t.out %s 60# CHECK-SHARD2-ERR: note: Selecting shard 3/3 = size 1/5 = tests #(3*k)+3 = [3] 61# CHECK-SHARD2-OUT: Testing: 1 of 5 tests 62 63 64# Check that sharding via env vars works. 65# 66# RUN: env LIT_NUM_SHARDS=3 LIT_RUN_SHARD=1 %{lit} %{inputs}/discovery >%t.out 2>%t.err 67# RUN: FileCheck --check-prefix=CHECK-SHARD0-ENV-ERR < %t.err %s 68# RUN: FileCheck --check-prefix=CHECK-SHARD0-ENV-OUT < %t.out %s 69# CHECK-SHARD0-ENV-ERR: note: Selecting shard 1/3 = size 2/5 = tests #(3*k)+1 = [1, 4] 70# CHECK-SHARD0-ENV-OUT: Testing: 2 of 5 tests 71# 72# RUN: env LIT_NUM_SHARDS=3 LIT_RUN_SHARD=2 %{lit} %{inputs}/discovery >%t.out 2>%t.err 73# RUN: FileCheck --check-prefix=CHECK-SHARD1-ENV-ERR < %t.err %s 74# RUN: FileCheck --check-prefix=CHECK-SHARD1-ENV-OUT < %t.out %s 75# CHECK-SHARD1-ENV-ERR: note: Selecting shard 2/3 = size 2/5 = tests #(3*k)+2 = [2, 5] 76# CHECK-SHARD1-ENV-OUT: Testing: 2 of 5 tests 77# 78# RUN: env LIT_NUM_SHARDS=3 LIT_RUN_SHARD=3 %{lit} %{inputs}/discovery >%t.out 2>%t.err 79# RUN: FileCheck --check-prefix=CHECK-SHARD2-ENV-ERR < %t.err %s 80# RUN: FileCheck --check-prefix=CHECK-SHARD2-ENV-OUT < %t.out %s 81# CHECK-SHARD2-ENV-ERR: note: Selecting shard 3/3 = size 1/5 = tests #(3*k)+3 = [3] 82# CHECK-SHARD2-ENV-OUT: Testing: 1 of 5 tests 83 84 85# Check that providing more shards than tests results in 1 test per shard 86# until we run out, then 0. 87# 88# RUN: %{lit} --num-shards 100 --run-shard 2 %{inputs}/discovery >%t.out 2>%t.err 89# RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR1 < %t.err %s 90# RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-OUT1 < %t.out %s 91# CHECK-SHARD-BIG-ERR1: note: Selecting shard 2/100 = size 1/5 = tests #(100*k)+2 = [2] 92# CHECK-SHARD-BIG-OUT1: Testing: 1 of 5 tests 93# 94# RUN: %{lit} --num-shards 100 --run-shard 6 %{inputs}/discovery >%t.out 2>%t.err 95# RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR2 < %t.err %s 96# CHECK-SHARD-BIG-ERR2: note: Selecting shard 6/100 = size 0/5 = tests #(100*k)+6 = [] 97# CHECK-SHARD-BIG-ERR2: warning: shard does not contain any tests. Consider decreasing the number of shards. 98# 99# RUN: %{lit} --num-shards 100 --run-shard 50 %{inputs}/discovery >%t.out 2>%t.err 100# RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR3 < %t.err %s 101# CHECK-SHARD-BIG-ERR3: note: Selecting shard 50/100 = size 0/5 = tests #(100*k)+50 = [] 102# CHECK-SHARD-BIG-ERR3: warning: shard does not contain any tests. Consider decreasing the number of shards. 103 104 105# Check that range constraints are enforced 106# 107# RUN: not %{lit} --num-shards 0 --run-shard 2 %{inputs}/discovery >%t.out 2>%t.err 108# RUN: FileCheck --check-prefix=CHECK-SHARD-ERR < %t.err %s 109# CHECK-SHARD-ERR: error: argument --num-shards: requires positive integer, but found '0' 110# 111# RUN: not %{lit} --num-shards 3 --run-shard 4 %{inputs}/discovery >%t.out 2>%t.err 112# RUN: FileCheck --check-prefix=CHECK-SHARD-ERR2 < %t.err %s 113# CHECK-SHARD-ERR2: error: --run-shard must be between 1 and --num-shards (inclusive) 114