diff --git a/benchmark/Package.swift b/benchmark/Package.swift index cb6c0ecdf4f14..4e31fdd2ef3fb 100644 --- a/benchmark/Package.swift +++ b/benchmark/Package.swift @@ -22,19 +22,19 @@ func getSingleSourceLibraries(subDirectory: String) -> [String] { let fileURLs = try! f.contentsOfDirectory(at: dirURL, includingPropertiesForKeys: nil) return fileURLs.compactMap { (path: URL) -> String? in - let c = path.lastPathComponent.split(separator: ".") - // Too many components. Must be a gyb file. - if c.count > 2 { - return nil - } - if c[1] != "swift" { + guard let lastDot = path.lastPathComponent.lastIndex(of: ".") else { return nil } + let ext = String(path.lastPathComponent.suffix(from: lastDot)) + guard ext == ".swift" else { return nil } + + let name = String(path.lastPathComponent.prefix(upTo: lastDot)) - let name = String(c[0]) + // Test names must have a single component. + if name.contains(".") { return nil } - // We do not support this test. if unsupportedTests.contains(name) { + // We do not support this test. return nil }