Skip if raspivid not present.

This commit is contained in:
scruzin 2019-03-08 20:43:01 +10:30
parent e0471d5e2c
commit db265404eb
1 changed files with 11 additions and 5 deletions

View File

@ -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) {
}