Regres: Add flag to prioritize a single change

Change-Id: Ieaec8e9dd2017803d862ce8bcdc6b00582b7d45b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33486
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/tests/regres/main.go b/tests/regres/main.go
index fcb2a56..aa2ca20 100644
--- a/tests/regres/main.go
+++ b/tests/regres/main.go
@@ -77,6 +77,7 @@
 	dryRun        = flag.Bool("dry", false, "don't post regres reports to gerrit")
 	maxProcMemory = flag.Uint64("max-proc-mem", shell.MaxProcMemory, "maximum virtual memory per child process")
 	dailyNow      = flag.Bool("dailynow", false, "Start by running the daily pass")
+	priority      = flag.String("priority", "", "Prioritize a single change with the given id")
 )
 
 func main() {
@@ -98,6 +99,7 @@
 		keepCheckouts: *keepCheckouts,
 		dryRun:        *dryRun,
 		dailyNow:      *dailyNow,
+		priority:      *priority,
 	}
 
 	if err := r.run(); err != nil {
@@ -118,6 +120,7 @@
 	dryRun        bool   // don't post any reviews
 	maxProcMemory uint64 // max virtual memory for child processes
 	dailyNow      bool   // start with a daily run
+	priority      string // Prioritize a single change with the given id
 }
 
 // resolveDirs ensures that the necessary directories used can be found, and
@@ -228,6 +231,13 @@
 			}
 		}
 
+		for _, c := range changes {
+			if c.pending && r.priority == c.id {
+				log.Printf("Prioritizing change '%s'\n", c.id)
+				c.priority = 1e6
+			}
+		}
+
 		// Find the change with the highest priority.
 		var change *changeInfo
 		numPending := 0