mirror of https://bitbucket.org/ausocean/av.git
Skip if raspivid not present.
This commit is contained in:
parent
e0471d5e2c
commit
db265404eb
|
@ -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) {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue