selecting.py 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # RUN: %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-BASIC %s
  2. # CHECK-BASIC: Testing: 5 tests
  3. # Check that regex-filtering works, is case-insensitive, and can be configured via env var.
  4. #
  5. # RUN: %{lit} --filter 'o[a-z]e' %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s
  6. # RUN: %{lit} --filter 'O[A-Z]E' %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s
  7. # RUN: env LIT_FILTER='o[a-z]e' %{lit} %{inputs}/discovery | FileCheck --check-prefix=CHECK-FILTER %s
  8. # CHECK-FILTER: Testing: 2 of 5 tests
  9. # Check that maximum counts work
  10. #
  11. # RUN: %{lit} --max-tests 3 %{inputs}/discovery | FileCheck --check-prefix=CHECK-MAX %s
  12. # CHECK-MAX: Testing: 3 of 5 tests
  13. # Check that sharding partitions the testsuite in a way that distributes the
  14. # rounding error nicely (i.e. 5/3 => 2 2 1, not 1 1 3 or whatever)
  15. #
  16. # RUN: %{lit} --num-shards 3 --run-shard 1 %{inputs}/discovery >%t.out 2>%t.err
  17. # RUN: FileCheck --check-prefix=CHECK-SHARD0-ERR < %t.err %s
  18. # RUN: FileCheck --check-prefix=CHECK-SHARD0-OUT < %t.out %s
  19. # CHECK-SHARD0-ERR: note: Selecting shard 1/3 = size 2/5 = tests #(3*k)+1 = [1, 4]
  20. # CHECK-SHARD0-OUT: Testing: 2 of 5 tests
  21. #
  22. # RUN: %{lit} --num-shards 3 --run-shard 2 %{inputs}/discovery >%t.out 2>%t.err
  23. # RUN: FileCheck --check-prefix=CHECK-SHARD1-ERR < %t.err %s
  24. # RUN: FileCheck --check-prefix=CHECK-SHARD1-OUT < %t.out %s
  25. # CHECK-SHARD1-ERR: note: Selecting shard 2/3 = size 2/5 = tests #(3*k)+2 = [2, 5]
  26. # CHECK-SHARD1-OUT: Testing: 2 of 5 tests
  27. #
  28. # RUN: %{lit} --num-shards 3 --run-shard 3 %{inputs}/discovery >%t.out 2>%t.err
  29. # RUN: FileCheck --check-prefix=CHECK-SHARD2-ERR < %t.err %s
  30. # RUN: FileCheck --check-prefix=CHECK-SHARD2-OUT < %t.out %s
  31. # CHECK-SHARD2-ERR: note: Selecting shard 3/3 = size 1/5 = tests #(3*k)+3 = [3]
  32. # CHECK-SHARD2-OUT: Testing: 1 of 5 tests
  33. # Check that sharding via env vars works.
  34. #
  35. # RUN: env LIT_NUM_SHARDS=3 LIT_RUN_SHARD=1 %{lit} %{inputs}/discovery >%t.out 2>%t.err
  36. # RUN: FileCheck --check-prefix=CHECK-SHARD0-ENV-ERR < %t.err %s
  37. # RUN: FileCheck --check-prefix=CHECK-SHARD0-ENV-OUT < %t.out %s
  38. # CHECK-SHARD0-ENV-ERR: note: Selecting shard 1/3 = size 2/5 = tests #(3*k)+1 = [1, 4]
  39. # CHECK-SHARD0-ENV-OUT: Testing: 2 of 5 tests
  40. #
  41. # RUN: env LIT_NUM_SHARDS=3 LIT_RUN_SHARD=2 %{lit} %{inputs}/discovery >%t.out 2>%t.err
  42. # RUN: FileCheck --check-prefix=CHECK-SHARD1-ENV-ERR < %t.err %s
  43. # RUN: FileCheck --check-prefix=CHECK-SHARD1-ENV-OUT < %t.out %s
  44. # CHECK-SHARD1-ENV-ERR: note: Selecting shard 2/3 = size 2/5 = tests #(3*k)+2 = [2, 5]
  45. # CHECK-SHARD1-ENV-OUT: Testing: 2 of 5 tests
  46. #
  47. # RUN: env LIT_NUM_SHARDS=3 LIT_RUN_SHARD=3 %{lit} %{inputs}/discovery >%t.out 2>%t.err
  48. # RUN: FileCheck --check-prefix=CHECK-SHARD2-ENV-ERR < %t.err %s
  49. # RUN: FileCheck --check-prefix=CHECK-SHARD2-ENV-OUT < %t.out %s
  50. # CHECK-SHARD2-ENV-ERR: note: Selecting shard 3/3 = size 1/5 = tests #(3*k)+3 = [3]
  51. # CHECK-SHARD2-ENV-OUT: Testing: 1 of 5 tests
  52. # Check that providing more shards than tests results in 1 test per shard
  53. # until we run out, then 0.
  54. #
  55. # RUN: %{lit} --num-shards 100 --run-shard 2 %{inputs}/discovery >%t.out 2>%t.err
  56. # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR1 < %t.err %s
  57. # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-OUT1 < %t.out %s
  58. # CHECK-SHARD-BIG-ERR1: note: Selecting shard 2/100 = size 1/5 = tests #(100*k)+2 = [2]
  59. # CHECK-SHARD-BIG-OUT1: Testing: 1 of 5 tests
  60. #
  61. # RUN: %{lit} --num-shards 100 --run-shard 6 %{inputs}/discovery >%t.out 2>%t.err
  62. # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR2 < %t.err %s
  63. # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-OUT2 < %t.out %s
  64. # CHECK-SHARD-BIG-ERR2: note: Selecting shard 6/100 = size 0/5 = tests #(100*k)+6 = []
  65. # CHECK-SHARD-BIG-OUT2: Testing: 0 of 5 tests
  66. #
  67. # RUN: %{lit} --num-shards 100 --run-shard 50 %{inputs}/discovery >%t.out 2>%t.err
  68. # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-ERR3 < %t.err %s
  69. # RUN: FileCheck --check-prefix=CHECK-SHARD-BIG-OUT3 < %t.out %s
  70. # CHECK-SHARD-BIG-ERR3: note: Selecting shard 50/100 = size 0/5 = tests #(100*k)+50 = []
  71. # CHECK-SHARD-BIG-OUT3: Testing: 0 of 5 tests
  72. # Check that range constraints are enforced
  73. #
  74. # RUN: not %{lit} --num-shards 0 --run-shard 2 %{inputs}/discovery >%t.out 2>%t.err
  75. # RUN: FileCheck --check-prefix=CHECK-SHARD-ERR < %t.err %s
  76. # CHECK-SHARD-ERR: error: argument --num-shards: requires positive integer, but found '0'
  77. #
  78. # RUN: not %{lit} --num-shards 3 --run-shard 4 %{inputs}/discovery >%t.out 2>%t.err
  79. # RUN: FileCheck --check-prefix=CHECK-SHARD-ERR2 < %t.err %s
  80. # CHECK-SHARD-ERR2: error: --run-shard must be between 1 and --num-shards (inclusive)