Skip to content

Commit 17b81be

Browse files
authored
Merge pull request #633 from ahoppen/pr/swift-syntax-test-changes
Improvements to test case reduction using `swift-parser-test`
2 parents 69f8b2a + 0b61102 commit 17b81be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/swift-parser-test/swift-parser-test.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class Reduce: ParsableCommand {
231231
}
232232

233233
try process.run()
234-
if sema.wait(timeout: DispatchTime.now() + .seconds(1)) == .timedOut {
234+
if sema.wait(timeout: DispatchTime.now() + .seconds(2)) == .timedOut {
235235
#if os(Windows)
236236
_ = TerminateProcess(process.processHandle, 0)
237237
#else
@@ -265,6 +265,10 @@ class Reduce: ParsableCommand {
265265
var reduced = source
266266
var chunkSize = source.count / 4
267267
while chunkSize > 0 {
268+
if chunkSize < reduced.count / 20 {
269+
// The chunk sizes are really tiny compared to the source file. Looks like we aren't making any progress reducing. Abort.
270+
break
271+
}
268272
if verbose {
269273
printerr("Current source size \(reduced.count), reducing with chunk size \(chunkSize)")
270274
}

0 commit comments

Comments
 (0)