[testrunner] Run snapshot after host-target tests.
Before, it would only run on tasks that ran fuchsia tests over SSH.
This will attempt to run it after tests run on the host as well.
Test: manually ran a led task and confirmed the snapshot was run.
Change-Id: I1af0dcc646474867056dfd86123185c9f11521ee
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/443374
Commit-Queue: Ina Huh <ihuh@google.com>
Reviewed-by: Oliver Newman <olivernewman@google.com>
Reviewed-by: Tamir Duberstein <tamird@google.com>
Testability-Review: Oliver Newman <olivernewman@google.com>
diff --git a/tools/testing/testrunner/cmd/main.go b/tools/testing/testrunner/cmd/main.go
index 694959a..1de56f3 100644
--- a/tools/testing/testrunner/cmd/main.go
+++ b/tools/testing/testrunner/cmd/main.go
@@ -236,6 +236,15 @@
if test.OS == "mac" && runtime.GOOS != "darwin" {
return fmt.Errorf("cannot run mac tests when GOOS = %q", runtime.GOOS)
}
+ // Initialize the fuchsia SSH tester to run the snapshot at the end in case
+ // we ran any host-target interaction tests.
+ if fuchsiaTester == nil && sshKeyFile != "" {
+ var err error
+ fuchsiaTester, err = newFuchsiaSSHTester(ctx, addr, sshKeyFile, outputs.outDir, serialSocketPath, useRuntests, perTestTimeout)
+ if err != nil {
+ logger.Errorf(ctx, "failed to initialize fuchsia tester: %s", err)
+ }
+ }
if localTester == nil {
localEnv := append(os.Environ(),
// Tell tests written in Rust to print stack on failures.