Skip to content

Commit

Permalink
fix(test): fix skipped tests, closes goburrow#4
Browse files Browse the repository at this point in the history
  • Loading branch information
gq0 committed Mar 23, 2018
1 parent 7cd69ed commit 374849f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
GO_FILES := $(shell find . -type f -name "*.go")
GO_BUILD := CGO_ENABLED=0 go build -ldflags "-w -s"
GO_TOOLS := gridx/golang-tools:master-839443d
#GO_TOOLS := gridx/golang-tools:master-839443d
GO_TOOLS := gridx/golang-tools:1.8.7
DOCKER_RUN := docker run --rm -v $$PWD:/go/src/github.com/grid-x/modbus -w /go/src/github.com/grid-x/modbus
GO_RUN := ${DOCKER_RUN} ${GO_TOOLS} bash -c

Expand All @@ -10,7 +11,9 @@ all: bin/

.PHONY: test
test:
go test -v $(shell glide nv)
diagslave -m tcp -p 5020 & go test -run TCP -v $(shell glide nv)
socat -d -d pty,raw,echo=0 pty,raw,echo=0 & diagslave -m rtu /dev/pts/1 & go test -run RTU -v $(shell glide nv)
socat -d -d pty,raw,echo=0 pty,raw,echo=0 & diagslave -m ascii /dev/pts/3 & go test -run ASCII -v $(shell glide nv)

.PHONY: lint
lint:
Expand Down
4 changes: 1 addition & 3 deletions test/asciiclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ import (
)

const (
asciiDevice = "/dev/pts/6"
asciiDevice = "/dev/pts/2"
)

func TestASCIIClient(t *testing.T) {
t.Skip()
// Diagslave does not support broadcast id.
handler := modbus.NewASCIIClientHandler(asciiDevice)
handler.SlaveId = 17
ClientTestAll(t, modbus.NewClient(handler))
}

func TestASCIIClientAdvancedUsage(t *testing.T) {
t.Skip()
handler := modbus.NewASCIIClientHandler(asciiDevice)
handler.BaudRate = 19200
handler.DataBits = 8
Expand Down
4 changes: 1 addition & 3 deletions test/rtuclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ import (
)

const (
rtuDevice = "/dev/pts/6"
rtuDevice = "/dev/pts/0"
)

func TestRTUClient(t *testing.T) {
t.Skip()
// Diagslave does not support broadcast id.
handler := modbus.NewRTUClientHandler(rtuDevice)
handler.SlaveId = 17
ClientTestAll(t, modbus.NewClient(handler))
}

func TestRTUClientAdvancedUsage(t *testing.T) {
t.Skip()
handler := modbus.NewRTUClientHandler(rtuDevice)
handler.BaudRate = 19200
handler.DataBits = 8
Expand Down
2 changes: 0 additions & 2 deletions test/tcpclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ const (
)

func TestTCPClient(t *testing.T) {
t.Skip()
client := modbus.TCPClient(tcpDevice)
ClientTestAll(t, client)
}

func TestTCPClientAdvancedUsage(t *testing.T) {
t.Skip()
handler := modbus.NewTCPClientHandler(tcpDevice)
handler.Timeout = 5 * time.Second
handler.SlaveId = 1
Expand Down

0 comments on commit 374849f

Please sign in to comment.