selecting.py 4.4 KB

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