From 7c9a0c2af6a3fd75c425d329e2d18b368efc7dee Mon Sep 17 00:00:00 2001 From: Nathan Youngman Date: Thu, 30 Aug 2018 14:13:18 -0600 Subject: [PATCH 1/2] travis: less verbose tests TravisCI: skip tip --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 410801f8..568aaa12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ go: - "1.10.4" - "1.9.x" - "1.8.x" - - tip matrix: allow_failures: @@ -17,7 +16,7 @@ before_script: - go get -u golang.org/x/lint/golint script: - - go test -v --race ./... + - go test --race ./... after_script: - test -z "$(gofmt -s -l -w . | tee /dev/stderr)" From c2f4d0bf9e1fde4ac562ec0474bc01278c86ddbf Mon Sep 17 00:00:00 2001 From: Nathan Youngman Date: Thu, 30 Aug 2018 14:16:33 -0600 Subject: [PATCH 2/2] darwin tests: Exchangedata is deprecated on 10.13 #264 --- integration_darwin_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/integration_darwin_test.go b/integration_darwin_test.go index 553767c3..c43d00c6 100644 --- a/integration_darwin_test.go +++ b/integration_darwin_test.go @@ -7,12 +7,24 @@ package fsnotify import ( "os" "path/filepath" + "strconv" + "strings" "testing" "time" "golang.org/x/sys/unix" ) +// darwinVersion returns version os Darwin (17 is macOS 10.13). +func darwinVersion() (int, error) { + s, err := unix.Sysctl("kern.osrelease") + if err != nil { + return 0, err + } + s = strings.Split(s, ".")[0] + return strconv.Atoi(s) +} + // testExchangedataForWatcher tests the watcher with the exchangedata operation on macOS. // // This is widely used for atomic saves on macOS, e.g. TextMate and in Apple's NSDocument. @@ -20,6 +32,14 @@ import ( // See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/exchangedata.2.html // Also see: https://github.com/textmate/textmate/blob/cd016be29489eba5f3c09b7b70b06da134dda550/Frameworks/io/src/swap_file_data.cc#L20 func testExchangedataForWatcher(t *testing.T, watchDir bool) { + osVersion, err := darwinVersion() + if err != nil { + t.Fatal("unable to get Darwin version:", err) + } + if osVersion >= 17 { + t.Skip("Exchangedata is deprecated in macOS 10.13") + } + // Create directory to watch testDir1 := tempMkdir(t)