File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
utils/swift_snapshot_tool/Sources/swift_snapshot_tool Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ struct BisectToolchains: AsyncParsableCommand {
95
95
// just say 50 toolchains ago. To get a few weeks worth. This is easier than
96
96
// writing dates a lot.
97
97
let oldDateAsDate = self . oldDateAsDate
98
- guard let goodTagIndex = tags. firstIndex ( where: { $0. tag. date ( branch: self . branch) < oldDateAsDate } ) else {
98
+ guard let goodTagIndex = tags. firstIndex ( where: { $0. tag. date ( branch: self . branch) <= oldDateAsDate } ) else {
99
99
log ( " Failed to find tag with date: \( oldDateAsDate) " )
100
100
fatalError ( )
101
101
}
Original file line number Diff line number Diff line change @@ -39,8 +39,18 @@ struct RunToolchains: AsyncParsableCommand {
39
39
""" )
40
40
var script : String
41
41
42
- @Option ( help: " Snapshot tag to run the test for " )
43
- var tag : String
42
+ @Option ( help: " Date. We use the first snapshot produced before the given date " )
43
+ var date : String
44
+
45
+ var dateAsDate : Date {
46
+ let d = DateFormatter ( )
47
+ d. dateFormat = " yyyy-MM-dd "
48
+ guard let result = d. date ( from: date) else {
49
+ log ( " Improperly formatted date: \( date) ! Expected format: yyyy_MM_dd. " )
50
+ fatalError ( )
51
+ }
52
+ return result
53
+ }
44
54
45
55
@Flag ( help: " Invert the test so that we assume the newest succeeds " )
46
56
var invert = false
@@ -69,8 +79,9 @@ struct RunToolchains: AsyncParsableCommand {
69
79
// Load our tags from swift's github repo
70
80
let tags = try ! await getTagsFromSwiftRepo ( branch: branch)
71
81
72
- guard var tagIndex = tags. firstIndex ( where: { $0. tag. name == self . tag } ) else {
73
- log ( " Failed to find tag: \( self . tag) " )
82
+ let date = self . dateAsDate
83
+ guard var tagIndex = tags. firstIndex ( where: { $0. tag. date ( branch: self . branch) <= date } ) else {
84
+ log ( " Failed to find tag with date: \( date) " )
74
85
fatalError ( )
75
86
}
76
87
You can’t perform that action at this time.
0 commit comments