aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra
diff options
context:
space:
mode:
authorGravatar Stephan Altmueller <stephana@google.com>2018-02-02 15:05:42 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-02 20:48:59 +0000
commitdd3eca1fc5e73e8fade9a791464e3850c1d3b08c (patch)
tree31508e5a1609e0c3124cd33b1dd4d4069eef3c94 /infra
parent4efcb7d100e824926e03f598d616f6bda5682e14 (diff)
[skqp] More args for skqp related scripts
- allows to choose api versions in run_testlab.go - adds api_version and work_arounds to generate_gn_args Bug: skia: Change-Id: I87516b493f4d8eef3689d1722a5dd864131a44f8 Reviewed-on: https://skia-review.googlesource.com/102900 Reviewed-by: Derek Sollenberger <djsollen@google.com> Reviewed-by: Ben Wagner <benjaminwagner@google.com> Commit-Queue: Stephan Altmueller <stephana@google.com>
Diffstat (limited to 'infra')
-rw-r--r--infra/cts/run_testlab.go38
1 files changed, 28 insertions, 10 deletions
diff --git a/infra/cts/run_testlab.go b/infra/cts/run_testlab.go
index 98aa160d21..6a7f76591c 100644
--- a/infra/cts/run_testlab.go
+++ b/infra/cts/run_testlab.go
@@ -16,6 +16,7 @@ import (
"os"
"os/exec"
"sort"
+ "strconv"
"strings"
"syscall"
"time"
@@ -51,19 +52,19 @@ var (
"hammerhead": {"23"},
"harpia": {"23"},
"hero2lte": {"23"},
- "herolte": {"24v"},
+ "herolte": {"24"},
"j1acevelte": {"22"},
"j5lte": {"23"},
"j7xelte": {"23"},
"lucye": {"24"},
// "mako": {"22"}, deprecated
"osprey_umts": {"22"},
- "p1": {"22"},
- "sailfish": {"26"},
- "shamu": {"23"},
- "trelte": {"22"},
- "zeroflte": {"22"},
- "zerolte": {"22"},
+ // "p1": {"22"}, deprecated
+ "sailfish": {"26"},
+ "shamu": {"23"},
+ "trelte": {"22"},
+ "zeroflte": {"22"},
+ "zerolte": {"22"},
}
)
@@ -75,6 +76,8 @@ const (
var (
serviceAccountFile = flag.String("service_account_file", "", "Credentials file for service account.")
dryRun = flag.Bool("dryrun", false, "Print out the command and quit without triggering tests.")
+ minAPIVersion = flag.Int("min_api", 22, "Minimum API version required by device.")
+ maxAPIVersion = flag.Int("max_api", 23, "Maximum API version required by device.")
)
const (
@@ -108,7 +111,7 @@ func main() {
}
// Get list of all available devices.
- devices, ignoredDevices, err := getAvailableDevices(WHITELIST_DEV_IDS)
+ devices, ignoredDevices, err := getAvailableDevices(WHITELIST_DEV_IDS, *minAPIVersion, *maxAPIVersion)
if err != nil {
sklog.Fatalf("Unable to retrieve available devices: %s", err)
}
@@ -124,7 +127,7 @@ func main() {
// getAvailableDevices is given a whitelist. It queries Firebase Testlab for all
// available devices and then returns a list of devices to be tested and the list
// of ignored devices.
-func getAvailableDevices(whiteList map[string][]string) ([]*tsuite.DeviceVersions, []*tsuite.DeviceVersions, error) {
+func getAvailableDevices(whiteList map[string][]string, minAPIVersion, maxAPIVersion int) ([]*tsuite.DeviceVersions, []*tsuite.DeviceVersions, error) {
// Get the list of all devices in JSON format from Firebase testlab.
var buf bytes.Buffer
cmd := parseCommand(CMD_AVAILABE_DEVICES)
@@ -151,7 +154,7 @@ func getAvailableDevices(whiteList map[string][]string) ([]*tsuite.DeviceVersion
// Only include devices that are on the whitelist and have versions defined.
if foundVersions, ok := whiteList[dev.ID]; ok && (len(foundVersions) > 0) {
versionSet := util.NewStringSet(dev.VersionIDs)
- reqVersions := util.NewStringSet(foundVersions)
+ reqVersions := util.NewStringSet(filterVersions(foundVersions, minAPIVersion, maxAPIVersion))
whiteListVersions := versionSet.Intersect(reqVersions).Keys()
ignoredVersions := versionSet.Complement(reqVersions).Keys()
sort.Strings(whiteListVersions)
@@ -171,6 +174,21 @@ func getAvailableDevices(whiteList map[string][]string) ([]*tsuite.DeviceVersion
return ret, ignored, nil
}
+// filterVersions returns the elements in versionIDs where minVersion <= element <= maxVersion.
+func filterVersions(versionIDs []string, minVersion, maxVersion int) []string {
+ ret := make([]string, 0, len(versionIDs))
+ for _, versionID := range versionIDs {
+ id, err := strconv.Atoi(versionID)
+ if err != nil {
+ sklog.Fatalf("Error parsing version id '%s': %s", versionID, err)
+ }
+ if (id >= minVersion) && (id <= maxVersion) {
+ ret = append(ret, versionID)
+ }
+ }
+ return ret
+}
+
// runTests runs the given apk on the given list of devices.
func runTests(apk_path string, devices, ignoredDevices []*tsuite.DeviceVersions, client *http.Client, dryRun bool) error {
// Get the model-version we want to test. Assume on average each model has 5 supported versions.