Commit 710f8c3e by Nicolas Capens Committed by Nicolas Capens

Regres: support testlist creation from specified hash

Using --dailynow --dailychange <hash> makes Regres check out the specified change to obtain the vk-master.txt from and perform a full run of all the tests. Also fix --keep usage. Bug: none Change-Id: Ia126bfc136e6b86a6fcc570f79a9293ae97ca392 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42109Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com>
parent ce25c2d4
...@@ -79,6 +79,7 @@ var ( ...@@ -79,6 +79,7 @@ var (
dryRun = flag.Bool("dry", false, "don't post regres reports to gerrit") 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") 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") dailyNow = flag.Bool("dailynow", false, "Start by running the daily pass")
dailyChange = flag.String("dailychange", "", "Change hash to use for daily pass, HEAD if not provided")
priority = flag.String("priority", "", "Prioritize a single change with the given id") priority = flag.String("priority", "", "Prioritize a single change with the given id")
) )
...@@ -96,6 +97,7 @@ func main() { ...@@ -96,6 +97,7 @@ func main() {
keepCheckouts: *keepCheckouts, keepCheckouts: *keepCheckouts,
dryRun: *dryRun, dryRun: *dryRun,
dailyNow: *dailyNow, dailyNow: *dailyNow,
dailyChange: *dailyChange,
priority: *priority, priority: *priority,
} }
...@@ -117,6 +119,7 @@ type regres struct { ...@@ -117,6 +119,7 @@ type regres struct {
dryRun bool // don't post any reviews dryRun bool // don't post any reviews
maxProcMemory uint64 // max virtual memory for child processes maxProcMemory uint64 // max virtual memory for child processes
dailyNow bool // start with a daily run dailyNow bool // start with a daily run
dailyChange string // Change hash to use for daily pass, HEAD if not provided
priority string // Prioritize a single change with the given id priority string // Prioritize a single change with the given id
} }
...@@ -508,40 +511,46 @@ func (r *regres) testParent(change *changeInfo, testlists testlist.Lists, d deqp ...@@ -508,40 +511,46 @@ func (r *regres) testParent(change *changeInfo, testlists testlist.Lists, d deqp
func (r *regres) updateTestLists(client *gerrit.Client) error { func (r *regres) updateTestLists(client *gerrit.Client) error {
log.Println("Updating test lists") log.Println("Updating test lists")
dailyHash := git.Hash{}
if r.dailyChange == "" {
headHash, err := git.FetchRefHash("HEAD", gitURL) headHash, err := git.FetchRefHash("HEAD", gitURL)
if err != nil { if err != nil {
return cause.Wrap(err, "Could not get hash of master HEAD") return cause.Wrap(err, "Could not get hash of master HEAD")
} }
dailyHash = headHash
} else {
dailyHash = git.ParseHash(r.dailyChange)
}
// Get the full test results for latest master. // Get the full test results.
test := r.newTest(headHash) test := r.newTest(dailyHash)
defer test.cleanup() defer test.cleanup()
// Always need to checkout the change. // Always need to checkout the change.
if err := test.checkout(); err != nil { if err := test.checkout(); err != nil {
return cause.Wrap(err, "Failed to checkout '%s'", headHash) return cause.Wrap(err, "Failed to checkout '%s'", dailyHash)
} }
d, err := r.getOrBuildDEQP(test) d, err := r.getOrBuildDEQP(test)
if err != nil { if err != nil {
return cause.Wrap(err, "Failed to build deqp for '%s'", headHash) return cause.Wrap(err, "Failed to build deqp for '%s'", dailyHash)
} }
// Load the test lists. // Load the test lists.
testLists, err := test.loadTestLists(fullTestListRelPath) testLists, err := test.loadTestLists(fullTestListRelPath)
if err != nil { if err != nil {
return cause.Wrap(err, "Failed to load full test lists for '%s'", headHash) return cause.Wrap(err, "Failed to load full test lists for '%s'", dailyHash)
} }
// Build the change. // Build the change.
if err := test.build(); err != nil { if err := test.build(); err != nil {
return cause.Wrap(err, "Failed to build '%s'", headHash) return cause.Wrap(err, "Failed to build '%s'", dailyHash)
} }
// Run the tests on the change. // Run the tests on the change.
results, err := test.run(testLists, d) results, err := test.run(testLists, d)
if err != nil { if err != nil {
return cause.Wrap(err, "Failed to test '%s'", headHash) return cause.Wrap(err, "Failed to test '%s'", dailyHash)
} }
// Write out the test list status files. // Write out the test list status files.
...@@ -565,7 +574,7 @@ func (r *regres) updateTestLists(client *gerrit.Client) error { ...@@ -565,7 +574,7 @@ func (r *regres) updateTestLists(client *gerrit.Client) error {
} }
commitMsg := strings.Builder{} commitMsg := strings.Builder{}
commitMsg.WriteString(consts.TestListUpdateCommitSubjectPrefix + headHash.String()[:8]) commitMsg.WriteString(consts.TestListUpdateCommitSubjectPrefix + dailyHash.String()[:8])
if existingChange != nil { if existingChange != nil {
// Reuse gerrit change ID if there's already a change up for review. // Reuse gerrit change ID if there's already a change up for review.
commitMsg.WriteString("\n\n") commitMsg.WriteString("\n\n")
...@@ -799,19 +808,18 @@ type test struct { ...@@ -799,19 +808,18 @@ type test struct {
srcDir string // directory for the SwiftShader checkout srcDir string // directory for the SwiftShader checkout
resDir string // directory for the test results resDir string // directory for the test results
buildDir string // directory for SwiftShader build buildDir string // directory for SwiftShader build
keepCheckouts bool // don't delete source & build checkouts after testing
} }
// cleanup removes any temporary files used by the test. // cleanup removes any temporary files used by the test.
func (t *test) cleanup() { func (t *test) cleanup() {
if t.srcDir != "" && !t.keepCheckouts { if t.srcDir != "" && !t.r.keepCheckouts {
os.RemoveAll(t.srcDir) os.RemoveAll(t.srcDir)
} }
} }
// checkout clones the test's source commit into t.src. // checkout clones the test's source commit into t.src.
func (t *test) checkout() error { func (t *test) checkout() error {
if util.IsDir(t.srcDir) && t.keepCheckouts { if util.IsDir(t.srcDir) && t.r.keepCheckouts {
log.Printf("Reusing source cache for commit '%s'\n", t.commit) log.Printf("Reusing source cache for commit '%s'\n", t.commit)
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment