59 lines · python
1# REQUIRES: lit-max-individual-test-time2 3###############################################################################4# Check tests can hit timeout when set5###############################################################################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.out11# RUN: FileCheck --check-prefix=CHECK-INF < %t.cmd.out %s12 13# Check that the per test timeout is enforced when running GTest tests via14# the configuration file15#16# RUN: not %{lit} -v %{inputs}/googletest-timeout \17# RUN: --param gtest_filter=InfiniteLoopSubTest --param set_timeout=1 \18# RUN: > %t.cfgset.out19# RUN: FileCheck --check-prefix=CHECK-INF < %t.cfgset.out %s20 21# CHECK-INF: -- Testing:22# CHECK-INF: TIMEOUT: googletest-timeout :: [[PATH:[Dd]ummy[Ss]ub[Dd]ir/]][[FILE:OneTest.py]]/0/223# 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 seconds34# CHECK-INF: Timed Out: 135 36###############################################################################37# Check tests can complete with a timeout set38#39# `QuickSubTest` should execute quickly so we shouldn't wait anywhere near the40# 3600 second timeout.41###############################################################################42 43# RUN: %{lit} -v %{inputs}/googletest-timeout \44# RUN: --param gtest_filter=QuickSubTest --timeout=3600 > %t.cmd.out45# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmd.out %s46 47# CHECK-QUICK: PASS: googletest-timeout :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/0/2 {{.*}}48# CHECK-QUICK: Passed: 149 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.err55# RUN: FileCheck --check-prefix=CHECK-QUICK < %t.cmdover.out %s56# RUN: FileCheck --check-prefix=CHECK-CMDLINE-OVERRIDE-ERR < %t.cmdover.err %s57 58# CHECK-CMDLINE-OVERRIDE-ERR: Forcing timeout to be 3600 seconds59