| // Copyright 2021 The ChromiumOS Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| package firmware |
| |
| import ( |
| "context" |
| |
| "go.chromium.org/tast-tests/cros/remote/firmware" |
| "go.chromium.org/tast-tests/cros/remote/firmware/reporters" |
| "go.chromium.org/tast-tests/cros/common/tbdep" |
| "go.chromium.org/tast/core/testing" |
| "go.chromium.org/tast/core/testing/hwdep" |
| ) |
| |
| func init() { |
| testing.AddTest(&testing.Test{ |
| Func: CodelabConfig, |
| Desc: "Demonstrates common functionality for remote firmware tests", |
| Contacts: []string{ |
| "chromeos-faft@google.com", // Owning team list |
| "me@chromium.org", // Test author |
| }, |
| BugComponent: "b:792402", // ChromeOS > Platform > Enablement > Firmware > FAFT |
| Data: []string{firmware.ConfigFile}, |
| // TODO(b/427195218): Add servo-exists + servo_state:WORKING after bug resolved. |
| TestBedDeps: []string{tbdep.ServoPresent}, |
| // TODO: When stable, change firmware_unstable to a different attr. |
| Attr: []string{"group:firmware", "firmware_unstable"}, |
| HardwareDeps: hwdep.D(hwdep.ChromeEC()), |
| }) |
| } |
| |
| // CodelabConfig demonstrates initializing and using a firmware.Config (fw-testing-configs). |
| func CodelabConfig(ctx context.Context, s *testing.State) { |
| r := reporters.New(s.DUT()) |
| board, err := r.Board(ctx) |
| if err != nil { |
| s.Fatal("Failed to report board: ", err) |
| } |
| model, err := r.Model(ctx) |
| if err != nil { |
| s.Fatal("Failed to report model: ", err) |
| } |
| s.Logf("Reported board=%s, model=%s", board, model) |
| |
| cfg, err := firmware.NewConfig(s.DataPath(firmware.ConfigFile), board, model) |
| if err != nil { |
| s.Fatal("Failed to create config: ", err) |
| } |
| s.Log("This DUT's mode-switcher type is: ", cfg.ModeSwitcherType) |
| } |