Skip to content

Run all request kinds by default #155

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
9 changes: 2 additions & 7 deletions SourceKitStressTester/Sources/Common/Message.swift
Original file line number Diff line number Diff line change
Expand Up @@ -558,16 +558,13 @@ public enum RequestKind: String, CaseIterable, CustomStringConvertible, Codable
case collectExpressionType = "CollectExpressionType"
case format = "Format"
case testModule = "TestModule"
case ide = "IDE"
case all = "All"

public var description: String { self.rawValue }

public static let ideRequests: [RequestKind] =
public static let allRequests: [RequestKind] =
[.cursorInfo, .rangeInfo, .codeComplete, .collectExpressionType, .format,
.typeContextInfo, .conformingMethodList]
public static let allRequests: [RequestKind] = ideRequests +
[.testModule]
.typeContextInfo, .conformingMethodList, .testModule]

public static func byName(_ name: String) -> RequestKind? {
let lower = name.lowercased()
Expand All @@ -578,8 +575,6 @@ public enum RequestKind: String, CaseIterable, CustomStringConvertible, Codable
public static func reduce(_ kinds: [RequestKind]) -> Set<RequestKind> {
return Set(kinds.flatMap { kind -> [RequestKind] in
switch kind {
case .ide:
return ideRequests
case .all:
return allRequests
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public struct StressTesterTool: ParsableCommand {

@Option(name: [.customLong("request"), .customShort("r")],
help: "One of '\(RequestKind.allCases.map({ $0.rawValue }).joined(separator: "\", \""))'")
public var requests: [RequestKind] = [.ide]
public var requests: [RequestKind] = [.all]

@Flag(name: .shortAndLong, help: """
Dump the sourcekitd requests the stress tester would perform instead of \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public struct SwiftCWrapperTool {
let astBuildLimit = try astBuildLimitEnv.get(from: environment)
let requestDurationsOutputFile = try requestDurationsOutputFileEnv.get(from: environment).map(URL.init(fileURLWithPath:))
let rewriteModes = try rewriteModesEnv.get(from: environment) ?? [.none, .concurrent, .insideOut]
let requestKinds = RequestKind.reduce(try requestKindsEnv.get(from: environment) ?? [.ide])
let requestKinds = RequestKind.reduce(try requestKindsEnv.get(from: environment) ?? [.all])
let conformingMethodTypes = try conformingMethodTypesEnv.get(from: environment)
let maxJobs = try maxJobsEnv.get(from: environment)
let dumpResponsesPath = try dumpResponsesPathEnv.get(from: environment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class StressTesterToolTests: XCTestCase {
XCTAssertEqual(defaults.format, .humanReadable)
XCTAssertEqual(defaults.limit, nil)
XCTAssertEqual(defaults.page, Page())
XCTAssertEqual(defaults.requests, [.ide])
XCTAssertEqual(defaults.requests, [.all])
XCTAssertEqual(defaults.dryRun, false)
XCTAssertEqual(defaults.reportResponses, false)
XCTAssertEqual(defaults.conformingMethodsTypeList, ["s:SQ", "s:SH"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class SwiftCWrapperToolTests: XCTestCase {

private func assertInvocationsMatch(invocations: [Substring],
rewriteModes: [RewriteMode],
requestKinds: [RequestKind] = RequestKind.ideRequests) {
requestKinds: [RequestKind] = RequestKind.allRequests) {
for invocation in invocations {
XCTAssertTrue(invocation.contains("--format json"),
"Missing json format in '\(invocation)'")
Expand Down