| // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| package graphics |
| |
| import ( |
| "context" |
| "time" |
| |
| "chromiumos/tast/local/crostini" |
| "chromiumos/tast/local/graphics/glbench" |
| "chromiumos/tast/testing" |
| ) |
| |
| // Tast framework requires every subtest's Val have the same reflect type. |
| // This is a wrapper to wrap interface together. |
| type config struct { |
| config glbench.Config |
| } |
| |
| func init() { |
| testing.AddTest(&testing.Test{ |
| Func: GLBench, |
| Desc: "Run glbench (a benchmark that times graphics intensive activities), check results and report its performance", |
| Contacts: []string{ |
| "andrescj@chromium.org", |
| "pwang@chromium.org", |
| "chromeos-gfx@google.com", |
| "oka@chromium.org", // Tast port |
| }, |
| SoftwareDeps: []string{"no_qemu"}, |
| Vars: []string{"keepState", "ui.gaiaPoolDefault"}, |
| Params: []testing.Param{ |
| // Parameters generated by glbench_test.go. DO NOT EDIT. |
| { |
| Name: "", |
| Val: config{config: &glbench.CrosConfig{}}, |
| Timeout: 3 * time.Hour, |
| ExtraAttr: []string{"group:graphics", "graphics_nightly"}, |
| Fixture: "graphicsNoChrome", |
| }, { |
| Name: "hasty", |
| Val: config{config: &glbench.CrosConfig{Hasty: true}}, |
| ExtraAttr: []string{"group:mainline"}, |
| Timeout: 5 * time.Minute, |
| Fixture: "graphicsNoChrome", |
| }, { |
| Name: "crostini", |
| ExtraAttr: []string{"group:graphics", "graphics_nightly"}, |
| ExtraData: []string{crostini.GetContainerMetadataArtifact("buster", false), crostini.GetContainerRootfsArtifact("buster", false)}, |
| ExtraSoftwareDeps: []string{"chrome", "crosvm_gpu", "vm_host", "dlc"}, |
| Pre: crostini.StartedByDlcBuster(), |
| Timeout: 1 * time.Hour, |
| Val: config{config: &glbench.CrostiniConfig{}}, |
| }, { |
| Name: "crostini_hasty_stable", |
| ExtraAttr: []string{"group:graphics", "graphics_perbuild", "group:mainline", "informational"}, |
| ExtraData: []string{crostini.GetContainerMetadataArtifact("buster", false), crostini.GetContainerRootfsArtifact("buster", false)}, |
| ExtraSoftwareDeps: []string{"chrome", "crosvm_gpu", "vm_host", "dlc"}, |
| ExtraHardwareDeps: crostini.CrostiniStable, |
| Pre: crostini.StartedByDlcBuster(), |
| Timeout: 5 * time.Minute, |
| Val: config{config: &glbench.CrostiniConfig{Hasty: true}}, |
| }, { |
| Name: "crostini_hasty_unstable", |
| ExtraAttr: []string{"group:graphics", "graphics_perbuild", "group:mainline", "informational"}, |
| ExtraData: []string{crostini.GetContainerMetadataArtifact("buster", false), crostini.GetContainerRootfsArtifact("buster", false)}, |
| ExtraSoftwareDeps: []string{"chrome", "crosvm_gpu", "vm_host", "dlc"}, |
| ExtraHardwareDeps: crostini.CrostiniUnstable, |
| Pre: crostini.StartedByDlcBuster(), |
| Timeout: 5 * time.Minute, |
| Val: config{config: &glbench.CrostiniConfig{Hasty: true}}, |
| }, |
| }, |
| }) |
| } |
| |
| func GLBench(ctx context.Context, s *testing.State) { |
| config := s.Param().(config).config |
| value := s.PreValue() |
| if value == nil { |
| value = s.FixtValue() |
| } |
| |
| if err := glbench.Run(ctx, s.OutDir(), value, config); err != nil { |
| s.Fatal("GLBench fails: ", err) |
| } |
| } |