From a045e4bbfc26f45e8cc64663a5a82cbc1b1a2fe2 Mon Sep 17 00:00:00 2001 From: Danielle Lancashire Date: Tue, 15 Mar 2022 11:06:57 +0000 Subject: [PATCH] expect_test: Look up binaries from the path Not all systems include binaries in the same location. On my (NixOS, so albeit a little weird) system these binaries exist in very different locations. This test switches to looking up the paths from the users PATH or skips the test if they do not exist to improve the `make test` experience on such systems. --- pkg/expect/expect_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/expect/expect_test.go b/pkg/expect/expect_test.go index c5ed18ec6..f091f1377 100644 --- a/pkg/expect/expect_test.go +++ b/pkg/expect/expect_test.go @@ -23,7 +23,7 @@ import ( ) func TestExpectFunc(t *testing.T) { - ep, err := NewExpect("/bin/echo", "hello world") + ep, err := NewExpect("echo", "hello world") if err != nil { t.Fatal(err) } @@ -41,7 +41,7 @@ func TestExpectFunc(t *testing.T) { } func TestEcho(t *testing.T) { - ep, err := NewExpect("/bin/echo", "hello world") + ep, err := NewExpect("echo", "hello world") if err != nil { t.Fatal(err) } @@ -62,7 +62,7 @@ func TestEcho(t *testing.T) { } func TestLineCount(t *testing.T) { - ep, err := NewExpect("/usr/bin/printf", "1\n2\n3") + ep, err := NewExpect("printf", "1\n2\n3") if err != nil { t.Fatal(err) } @@ -83,7 +83,7 @@ func TestLineCount(t *testing.T) { } func TestSend(t *testing.T) { - ep, err := NewExpect("/usr/bin/tr", "a", "b") + ep, err := NewExpect("tr", "a", "b") if err != nil { t.Fatal(err) } @@ -99,7 +99,7 @@ func TestSend(t *testing.T) { } func TestSignal(t *testing.T) { - ep, err := NewExpect("/bin/sleep", "100") + ep, err := NewExpect("sleep", "100") if err != nil { t.Fatal(err) }