diff --git a/revid/revid_test.go b/revid/revid_test.go index 692633e5..6f2fd6df 100644 --- a/revid/revid_test.go +++ b/revid/revid_test.go @@ -5,20 +5,26 @@ import ( "os" "runtime" "testing" - + "bitbucket.org/ausocean/iot/pi/netsender" ) -// Supress all test logging, except for t.Errorf output. +const raspividPath = "/usr/local/bin/raspivid" + +// Suppress all test logging, except for t.Errorf output. var silent bool func TestRaspivid(t *testing.T) { + if _, err := os.Stat(raspividPath); os.IsNotExist(err) { + t.Skip("Skipping TestRaspivid since no raspivid found.") + } + var logger testLogger ns, err := netsender.New(&logger, nil, nil, nil) if err != nil { t.Errorf("netsender.New failed with error %v", err) } - + var c Config c.Logger = &logger c.Input = Raspivid @@ -28,7 +34,7 @@ func TestRaspivid(t *testing.T) { if err != nil { t.Errorf("revid.New failed with error %v", err) } - + err = rv.Start() if err != nil { t.Errorf("revid.Start failed with error %v", err) @@ -36,7 +42,7 @@ func TestRaspivid(t *testing.T) { } // testLogger implements a netsender.Logger. -type testLogger struct {} +type testLogger struct{} func (tl *testLogger) SetLevel(level int8) { }