| 1 |
# REQUIRES: lit-max-individual-test-time |
| 2 |
|
| 3 |
############################################################################### |
| 4 |
# Check tests can hit timeout when set |
| 5 |
############################################################################### |
| 6 |
|
| 7 |
# Check that the per test timeout is enforced when running GTest tests. |
| 8 |
# |
| 9 |
# RUN: not %{lit} -v %{inputs}/googletest-timeout \ |
| 10 |
# RUN: --param gtest_filter=InfiniteLoopSubTest --timeout=1 > %t.cmd.out |
| 11 |
# RUN: FileCheck --check-prefix=CHECK-INF < %t.cmd.out %s |
| 12 |
|
| 13 |
# Check that the per test timeout is enforced when running GTest tests via |
| 14 |
# the configuration file |
| 15 |
# |
| 16 |
# RUN: not %{lit} -v %{inputs}/googletest-timeout \ |
| 17 |
# RUN: --param gtest_filter=InfiniteLoopSubTest --param set_timeout=1 \ |
| 18 |
# RUN: > %t.cfgset.out |
| 19 |
# RUN: FileCheck --check-prefix=CHECK-INF < %t.cfgset.out %s |
| 20 |
|
| 21 |
# CHECK-INF: -- Testing: |
| 22 |
# CHECK-INF: TIMEOUT: googletest-timeout :: [[PATH:[Dd]ummy[Ss]ub[Dd]ir/]][[FILE:OneTest.py]]/0/2 |
| 23 |
# CHECK-INF-NEXT: ******************** TEST 'googletest-timeout :: [[PATH]][[FILE]]/0/2' FAILED ******************** |
| 24 |
# CHECK-INF-NEXT: Script(shard): |
| 25 |
# CHECK-INF-NEXT: -- |
| 26 |
# CHECK-INF-NEXT: GTEST_OUTPUT=json:{{[^[:space:]]*}} GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=2 GTEST_SHARD_INDEX=0 {{.*}}[[FILE]] |
| 27 |
# CHECK-INF-NEXT: -- |
| 28 |
# CHECK-INF-EMPTY: |
| 29 |
# CHECK-INF-EMPTY: |
| 30 |
# CHECK-INF-NEXT: -- |
| 31 |
# CHECK-INF-NEXT: exit: |
| 32 |
# CHECK-INF-NEXT: -- |
| 33 |
# CHECK-INF-NEXT: Reached timeout of 1 seconds |
| 34 |
# CHECK-INF: Timed Out: 1 |
| 35 |
|
| 36 |
############################################################################### |
| 37 |
# Check tests can complete with a timeout set |
| 38 |
# |
| 39 |
# `QuickSubTest` should execute quickly so we shouldn't wait anywhere near the |
| 40 |
# 3600 second timeout. |
| 41 |
############################################################################### |
| 42 |
|
| 43 |
# RUN: %{lit} -v %{inputs}/googletest-timeout \ |
| 44 |
# RUN: --param gtest_filter=QuickSubTest --timeout=3600 > %t.cmd.out |
| 45 |
# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmd.out %s |
| 46 |
|
| 47 |
# CHECK-QUICK: PASS: googletest-timeout :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/0/2 {{.*}} |
| 48 |
# CHECK-QUICK: Passed: 1 |
| 49 |
|
| 50 |
# Test per test timeout via a config file and on the command line. |
| 51 |
# The value set on the command line should override the config file. |
| 52 |
# RUN: %{lit} -v %{inputs}/googletest-timeout --param gtest_filter=QuickSubTest \ |
| 53 |
# RUN: --param set_timeout=1 --timeout=3600 \ |
| 54 |
# RUN: > %t.cmdover.out 2> %t.cmdover.err |
| 55 |
# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmdover.out %s |
| 56 |
# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.cmdover.err %s |
| 57 |
|
| 58 |
# CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 3600 seconds |