Skip to content

Commit bf8ff8b

Browse files
authored
Merge pull request #1657 from ahoppen/custom-timeout
Allow overriding the timeout duration for tests
2 parents 37f7540 + b9370cf commit bf8ff8b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Documentation/Environment Variables.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ The following environment variables can be used to control some behavior in Sour
1717
- `SKIP_LONG_TESTS`: Skip tests that typically take more than 1s to execute.
1818
- `SOURCEKITLSP_KEEP_TEST_SCRATCH_DIR`: Does not delete the temporary files created during test execution. Allows inspection of the test projects after the test finishes.
1919
- `SOURCEKIT_LSP_TEST_MODULE_CACHE`: Specifies where tests should store their shared module cache. Defaults to writing the module cache to a temporary directory. Intended so that CI systems can clean the module cache directory after running.
20+
- `SOURCEKIT_LSP_TEST_TIMEOUT`: Override the timeout duration for tests, in seconds.

Sources/SKTestSupport/Timeouts.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,11 @@ import Foundation
1414

1515
/// The default duration how long tests should wait for responses from
1616
/// SourceKit-LSP / sourcekitd / clangd.
17-
package let defaultTimeout: TimeInterval = 180
17+
package let defaultTimeout: TimeInterval = {
18+
if let customTimeoutStr = ProcessInfo.processInfo.environment["SOURCEKIT_LSP_TEST_TIMEOUT"],
19+
let customTimeout = TimeInterval(customTimeoutStr)
20+
{
21+
return customTimeout
22+
}
23+
return 180
24+
}()

0 commit comments

Comments
 (0)