File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
utils/swift_snapshot_tool/Sources/swift_snapshot_tool Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,18 @@ struct RunToolchains: AsyncParsableCommand {
3939 """ )
4040 var script : String
4141
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+ }
4454
4555 @Flag ( help: " Invert the test so that we assume the newest succeeds " )
4656 var invert = false
@@ -69,8 +79,9 @@ struct RunToolchains: AsyncParsableCommand {
6979 // Load our tags from swift's github repo
7080 let tags = try ! await getTagsFromSwiftRepo ( branch: branch)
7181
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) " )
7485 fatalError ( )
7586 }
7687
You can’t perform that action at this time.
0 commit comments