Merge "Add a major incremental build scenario to cuj metrics."

This commit is contained in:
Treehugger Robot 2020-03-25 16:59:16 +00:00 committed by Gerrit Code Review
commit 38a2e3cb92
1 changed files with 48 additions and 2 deletions

View File

@ -33,8 +33,9 @@ import (
)
type Test struct {
name string
args []string
name string
args []string
before func() error
results TestResults
}
@ -119,6 +120,15 @@ func (t *Test) Run(logsDir string) {
t.results.metrics = met
}
// Touch the Intent.java file to cause a rebuild of the frameworks to monitor the
// incremental build speed as mentioned b/152046247. Intent.java file was chosen
// as it is a key component of the framework and is often modified.
func touchIntentFile() error {
const intentFileName = "frameworks/base/core/java/android/content/Intent.java"
currentTime := time.Now().Local()
return os.Chtimes(intentFileName, currentTime, currentTime)
}
func main() {
outDir := os.Getenv("OUT_DIR")
if outDir == "" {
@ -170,6 +180,36 @@ func main() {
name: "framework_rebuild_twice",
args: []string{"framework"},
},
{
// Scenario major_inc_build (b/152046247): tracking build speed of major incremental build.
name: "major_inc_build_droid",
args: []string{"droid"},
},
{
name: "major_inc_build_framework_minus_apex_after_droid_build",
args: []string{"framework-minus-apex"},
before: touchIntentFile,
},
{
name: "major_inc_build_framework_after_droid_build",
args: []string{"framework"},
before: touchIntentFile,
},
{
name: "major_inc_build_sync_after_droid_build",
args: []string{"sync"},
before: touchIntentFile,
},
{
name: "major_inc_build_droid_rebuild",
args: []string{"droid"},
before: touchIntentFile,
},
{
name: "major_inc_build_update_api_after_droid_rebuild",
args: []string{"update-api"},
before: touchIntentFile,
},
}
cujMetrics := metrics.NewCriticalUserJourneysMetrics()
@ -178,6 +218,12 @@ func main() {
for i, t := range tests {
logsSubDir := fmt.Sprintf("%02d_%s", i, t.name)
logsDir := filepath.Join(cujDir, "logs", logsSubDir)
if t.before != nil {
if err := t.before(); err != nil {
fmt.Printf("error running before function on test %q: %v\n", t.name, err)
break
}
}
t.Run(logsDir)
if t.results.err != nil {
fmt.Printf("error running test %q: %s\n", t.name, t.results.err)