Skip to content

Improvements to test case reduction using swift-parser-test #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Sources/swift-parser-test/swift-parser-test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class Reduce: ParsableCommand {
}

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