blob: c23ddd2356947e3bddc82a63fdb6b1d400ec0c60 [file] [log] [blame]
// Copyright 2020 The Fuchsia 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 support
import (
"os"
"path/filepath"
"strings"
"testing"
)
func ZbiPath(t *testing.T) string {
ex, err := os.Executable()
if err != nil {
t.Fatal(err)
return ""
}
exPath := filepath.Dir(ex)
return filepath.Join(exPath, "../zedboot.zbi")
}
func ToolPath(t *testing.T, name string) string {
ex, err := os.Executable()
if err != nil {
t.Fatal(err)
return ""
}
exPath := filepath.Dir(ex)
return filepath.Join(exPath, "test_data", "tools", name)
}
func EnsureContains(t *testing.T, output string, lookFor string) {
if !strings.Contains(output, lookFor) {
t.Fatalf("output did not contain '%s'", lookFor)
}
}
func EnsureDoesNotContain(t *testing.T, output string, lookFor string) {
if strings.Contains(output, lookFor) {
t.Fatalf("output contains '%s'", lookFor)
}
}