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