Fix CI AppVeyor 'make check' errors for go 1.15 on windows (#8061)

Avoid writing to nul on windows.  On Appveyor, writing to nul creates a file instead of discarding output.  The file's existence creates errors later in the build.
This commit is contained in:
Sven Rebhan 2020-09-01 19:52:41 +02:00 committed by GitHub
parent 3278054c5c
commit b5fafb4c95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 21 deletions

View File

@ -1,11 +1,5 @@
ifeq ($(OS), Windows_NT)
devnull := nul
else
devnull := /dev/null
endif
next_version := 1.16.0
tag := $(shell git describe --exact-match --tags 2>$(devnull))
tag := $(shell git describe --exact-match --tags 2>git_describe_error.tmp; rm -f git_describe_error.tmp)
branch := $(shell git rev-parse --abbrev-ref HEAD)
commit := $(shell git rev-parse --short=8 HEAD)

View File

@ -4,6 +4,7 @@ package win_perf_counters
import (
"errors"
"fmt"
"testing"
"time"
@ -185,11 +186,11 @@ func TestWinPerfcountersConfigGet2(t *testing.T) {
if len(m.counters) == 1 {
require.NoError(t, nil)
} else if len(m.counters) == 0 {
var errorstring1 = "No results returned from the counterPath: " + string(len(m.counters))
var errorstring1 = "No results returned from the counterPath"
err2 := errors.New(errorstring1)
require.NoError(t, err2)
} else if len(m.counters) > 1 {
var errorstring1 = "Too many results returned from the counterPath: " + string(len(m.counters))
var errorstring1 = fmt.Sprintf("Too many results returned from the counterPath: %v", len(m.counters))
err2 := errors.New(errorstring1)
require.NoError(t, err2)
}
@ -233,12 +234,12 @@ func TestWinPerfcountersConfigGet3(t *testing.T) {
require.NoError(t, nil)
} else if len(m.counters) < 2 {
var errorstring1 = "Too few results returned from the counterPath. " + string(len(m.counters))
var errorstring1 = fmt.Sprintf("Too few results returned from the counterPath: %v", len(m.counters))
err2 := errors.New(errorstring1)
require.NoError(t, err2)
} else if len(m.counters) > 2 {
var errorstring1 = "Too many results returned from the counterPath: " + string(len(m.counters))
var errorstring1 = fmt.Sprintf("Too many results returned from the counterPath: %v", len(m.counters))
err2 := errors.New(errorstring1)
require.NoError(t, err2)
}
@ -282,12 +283,12 @@ func TestWinPerfcountersConfigGet4(t *testing.T) {
require.NoError(t, nil)
} else if len(m.counters) < 2 {
var errorstring1 = "Too few results returned from the counterPath: " + string(len(m.counters))
var errorstring1 = fmt.Sprintf("Too few results returned from the counterPath: %v", len(m.counters))
err2 := errors.New(errorstring1)
require.NoError(t, err2)
} else if len(m.counters) > 2 {
var errorstring1 = "Too many results returned from the counterPath: " + string(len(m.counters))
var errorstring1 = fmt.Sprintf("Too many results returned from the counterPath: %v", len(m.counters))
err2 := errors.New(errorstring1)
require.NoError(t, err2)
}
@ -331,13 +332,11 @@ func TestWinPerfcountersConfigGet5(t *testing.T) {
if len(m.counters) == 4 {
require.NoError(t, nil)
} else if len(m.counters) < 4 {
var errorstring1 = "Too few results returned from the counterPath: " +
string(len(m.counters))
var errorstring1 = fmt.Sprintf("Too few results returned from the counterPath: %v", len(m.counters))
err2 := errors.New(errorstring1)
require.NoError(t, err2)
} else if len(m.counters) > 4 {
var errorstring1 = "Too many results returned from the counterPath: " +
string(len(m.counters))
var errorstring1 = fmt.Sprintf("Too many results returned from the counterPath: %v", len(m.counters))
err2 := errors.New(errorstring1)
require.NoError(t, err2)
}
@ -415,13 +414,11 @@ func TestWinPerfcountersConfigGet7(t *testing.T) {
if len(m.counters) == 2 {
require.NoError(t, nil)
} else if len(m.counters) < 2 {
var errorstring1 = "Too few results returned from the counterPath: " +
string(len(m.counters))
var errorstring1 = fmt.Sprintf("Too few results returned from the counterPath: %v", len(m.counters))
err2 := errors.New(errorstring1)
require.NoError(t, err2)
} else if len(m.counters) > 2 {
var errorstring1 = "Too many results returned from the counterPath: " +
string(len(m.counters))
var errorstring1 = fmt.Sprintf("Too many results returned from the counterPath: %v", len(m.counters))
err2 := errors.New(errorstring1)
require.NoError(t, err2)
}