/utils/lit/tests/shtest-timeout.py

https://gitlab.com/lobl.pavel/llvm-tinymachine-backend
Python | 116 lines | 0 code | 19 blank | 97 comment | 0 complexity | 7ec6ea186cabc74c106298d3b345ea31 MD5 | raw file
  1. # REQUIRES: python-psutil
  2. # Test per test timeout using external shell
  3. # RUN: not %{lit} \
  4. # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
  5. # RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
  6. # RUN: %{inputs}/shtest-timeout/short.py \
  7. # RUN: %{inputs}/shtest-timeout/slow.py \
  8. # RUN: -j 1 -v --debug --timeout 1 --param external=1 > %t.extsh.out 2> %t.extsh.err
  9. # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.extsh.out %s
  10. # RUN: FileCheck --check-prefix=CHECK-EXTSH-ERR < %t.extsh.err %s
  11. #
  12. # CHECK-EXTSH-ERR: Using external shell
  13. # Test per test timeout using internal shell
  14. # RUN: not %{lit} \
  15. # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
  16. # RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
  17. # RUN: %{inputs}/shtest-timeout/short.py \
  18. # RUN: %{inputs}/shtest-timeout/slow.py \
  19. # RUN: -j 1 -v --debug --timeout 1 --param external=0 > %t.intsh.out 2> %t.intsh.err
  20. # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.intsh.out %s
  21. # RUN: FileCheck --check-prefix=CHECK-INTSH-OUT < %t.intsh.out %s
  22. # RUN: FileCheck --check-prefix=CHECK-INTSH-ERR < %t.intsh.err %s
  23. #
  24. # CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
  25. # CHECK-INTSH-OUT: Command 0 Reached Timeout: True
  26. # CHECK-INTSH-OUT: Command 0 Output:
  27. # CHECK-INTSH-OUT-NEXT: Running infinite loop
  28. # CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: quick_then_slow.py
  29. # CHECK-INTSH-OUT: Timeout: Reached timeout of 1 seconds
  30. # CHECK-INTSH-OUT: Command Output
  31. # CHECK-INTSH-OUT: Command 0 Reached Timeout: False
  32. # CHECK-INTSH-OUT: Command 0 Output:
  33. # CHECK-INTSH-OUT-NEXT: Running in quick mode
  34. # CHECK-INTSH-OUT: Command 1 Reached Timeout: True
  35. # CHECK-INTSH-OUT: Command 1 Output:
  36. # CHECK-INTSH-OUT-NEXT: Running in slow mode
  37. # CHECK-INTSH-OUT: TIMEOUT: per_test_timeout :: slow.py
  38. # CHECK-INTSH-OUT: Command 0 Reached Timeout: True
  39. # CHECK-INTSH-OUT: Command 0 Output:
  40. # CHECK-INTSH-OUT-NEXT: Running slow program
  41. # CHECK-INTSH-ERR: Using internal shell
  42. # Test per test timeout set via a config file rather than on the command line
  43. # RUN: not %{lit} \
  44. # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
  45. # RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
  46. # RUN: %{inputs}/shtest-timeout/short.py \
  47. # RUN: %{inputs}/shtest-timeout/slow.py \
  48. # RUN: -j 1 -v --debug --param external=0 \
  49. # RUN: --param set_timeout=1 > %t.cfgset.out 2> %t.cfgset.err
  50. # RUN: FileCheck --check-prefix=CHECK-OUT-COMMON < %t.cfgset.out %s
  51. # RUN: FileCheck --check-prefix=CHECK-CFGSET-ERR < %t.cfgset.err %s
  52. #
  53. # CHECK-CFGSET-ERR: Using internal shell
  54. # CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: infinite_loop.py
  55. # CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
  56. # CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
  57. # CHECK-OUT-COMMON: Running infinite loop
  58. # CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: quick_then_slow.py
  59. # CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
  60. # CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
  61. # CHECK-OUT-COMMON: Running in quick mode
  62. # CHECK-OUT-COMMON: Running in slow mode
  63. # CHECK-OUT-COMMON: PASS: per_test_timeout :: short.py
  64. # CHECK-OUT-COMMON: TIMEOUT: per_test_timeout :: slow.py
  65. # CHECK-OUT-COMMON: Timeout: Reached timeout of 1 seconds
  66. # CHECK-OUT-COMMON: Command {{([0-9]+ )?}}Output
  67. # CHECK-OUT-COMMON: Running slow program
  68. # CHECK-OUT-COMMON: Expected Passes{{ *}}: 1
  69. # CHECK-OUT-COMMON: Individual Timeouts{{ *}}: 3
  70. # Test per test timeout via a config file and on the command line.
  71. # The value set on the command line should override the config file.
  72. # RUN: not %{lit} \
  73. # RUN: %{inputs}/shtest-timeout/infinite_loop.py \
  74. # RUN: %{inputs}/shtest-timeout/quick_then_slow.py \
  75. # RUN: %{inputs}/shtest-timeout/short.py \
  76. # RUN: %{inputs}/shtest-timeout/slow.py \
  77. # RUN: -j 1 -v --debug --param external=0 \
  78. # RUN: --param set_timeout=1 --timeout=2 > %t.cmdover.out 2> %t.cmdover.err
  79. # RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-OUT < %t.cmdover.out %s
  80. # RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.cmdover.err %s
  81. # CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 2 seconds
  82. # CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: infinite_loop.py
  83. # CHECK-CMDLINE-OVERRIDE-OUT: Timeout: Reached timeout of 2 seconds
  84. # CHECK-CMDLINE-OVERRIDE-OUT: Command {{([0-9]+ )?}}Output
  85. # CHECK-CMDLINE-OVERRIDE-OUT: Running infinite loop
  86. # CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: quick_then_slow.py
  87. # CHECK-CMDLINE-OVERRIDE-OUT: Timeout: Reached timeout of 2 seconds
  88. # CHECK-CMDLINE-OVERRIDE-OUT: Command {{([0-9]+ )?}}Output
  89. # CHECK-CMDLINE-OVERRIDE-OUT: Running in quick mode
  90. # CHECK-CMDLINE-OVERRIDE-OUT: Running in slow mode
  91. # CHECK-CMDLINE-OVERRIDE-OUT: PASS: per_test_timeout :: short.py
  92. # CHECK-CMDLINE-OVERRIDE-OUT: TIMEOUT: per_test_timeout :: slow.py
  93. # CHECK-CMDLINE-OVERRIDE-OUT: Timeout: Reached timeout of 2 seconds
  94. # CHECK-CMDLINE-OVERRIDE-OUT: Command {{([0-9]+ )?}}Output
  95. # CHECK-CMDLINE-OVERRIDE-OUT: Running slow program
  96. # CHECK-CMDLINE-OVERRIDE-OUT: Expected Passes{{ *}}: 1
  97. # CHECK-CMDLINE-OVERRIDE-OUT: Individual Timeouts{{ *}}: 3