From 955f38794d38a6fdf67a18fee29b06437112b00e Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Tue, 5 Nov 2019 10:33:41 +0100 Subject: [PATCH 1/2] run mocked tests on linux only --- .github/workflows/test.yaml | 2 +- cli/cli_test.go | 33 +++++++++++++++++---------------- commands/daemon/monitor_test.go | 20 +++++++++++++++++++- go.mod | 1 + 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4737e297614..a38b26c5ac9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - operating-system: [ubuntu-18.04, windows-2019] + operating-system: [ubuntu-18.04, windows-2019, macOS-10.14] runs-on: ${{ matrix.operating-system }} diff --git a/cli/cli_test.go b/cli/cli_test.go index a0184f0694d..4a9f4245176 100644 --- a/cli/cli_test.go +++ b/cli/cli_test.go @@ -1,19 +1,20 @@ -/* - * This file is part of arduino-cli. - * - * Copyright 2018 ARDUINO SA (http://www.arduino.cc/) - * - * This software is released under the GNU General Public License version 3, - * which covers the main part of arduino-cli. - * The terms of this license can be found at: - * https://www.gnu.org/licenses/gpl-3.0.en.html - * - * You can be released from the requirements of the above licenses by purchasing - * a commercial license. Buying such a license is mandatory if you want to modify or - * otherwise use the software for commercial activities involving the Arduino - * software without disclosing the source code of your own applications. To purchase - * a commercial license, send an email to license@arduino.cc. - */ +// This file is part of arduino-cli. +// +// Copyright 2019 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +// These tests are mocked and won't work on OSX, make them run on Linux only +// +build linux package cli diff --git a/commands/daemon/monitor_test.go b/commands/daemon/monitor_test.go index b369e82a48b..ed622a38de1 100644 --- a/commands/daemon/monitor_test.go +++ b/commands/daemon/monitor_test.go @@ -1,3 +1,21 @@ +// This file is part of arduino-cli. +// +// Copyright 2019 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +// These tests are mocked and won't work on OSX, make them run on Linux only +// +build linux + package daemon_test import ( @@ -99,7 +117,7 @@ func mockOpenSerialMonitor(portName string, baudRate int) (*monitors.SerialMonit return mon, nil } -func TestFoo(t *testing.T) { +func TestConnect(t *testing.T) { monkey.Patch(monitors.OpenSerialMonitor, mockOpenSerialMonitor) svc := daemon.MonitorService{} diff --git a/go.mod b/go.mod index b0ae9aa7f2e..8427598d575 100644 --- a/go.mod +++ b/go.mod @@ -43,6 +43,7 @@ require ( go.bug.st/serial.v1 v0.0.0-20180827123349-5f7892a7bb45 golang.org/x/net v0.0.0-20190311183353-d8887717615a golang.org/x/text v0.3.0 + google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190327125643-d831d65fe17d // indirect google.golang.org/grpc v1.21.1 gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect From 11264a0a42870c1c991f3942f6a27459e53f366e Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Tue, 5 Nov 2019 11:22:47 +0100 Subject: [PATCH 2/2] open the door to Windows --- cli/cli_test.go | 4 ++-- commands/daemon/monitor_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/cli_test.go b/cli/cli_test.go index 4a9f4245176..217712ac4be 100644 --- a/cli/cli_test.go +++ b/cli/cli_test.go @@ -13,8 +13,8 @@ // Arduino software without disclosing the source code of your own applications. // To purchase a commercial license, send an email to license@arduino.cc. -// These tests are mocked and won't work on OSX, make them run on Linux only -// +build linux +// These tests are mocked and won't work on OSX +// +build !darwin package cli diff --git a/commands/daemon/monitor_test.go b/commands/daemon/monitor_test.go index ed622a38de1..e2fd28adb2b 100644 --- a/commands/daemon/monitor_test.go +++ b/commands/daemon/monitor_test.go @@ -13,8 +13,8 @@ // Arduino software without disclosing the source code of your own applications. // To purchase a commercial license, send an email to license@arduino.cc. -// These tests are mocked and won't work on OSX, make them run on Linux only -// +build linux +// These tests are mocked and won't work on OSX +// +build !darwin package daemon_test