diff --git a/.travis.yml b/.travis.yml index 30268c0fb..d7430a651 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,7 @@ script: - GIT_CHECK_EXCLUDE="./vendor" TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE/.../..}" make dco - make fmt - make vet + - make build - make binaries - if [ "$GOOS" = "linux" ]; then sudo make install ; fi - if [ "$GOOS" = "linux" ]; then make coverage ; fi diff --git a/cmd/containerd-shim/shim_unix.go b/cmd/containerd-shim/shim_unix.go index 0ff70d499..2315163b7 100644 --- a/cmd/containerd-shim/shim_unix.go +++ b/cmd/containerd-shim/shim_unix.go @@ -1,4 +1,4 @@ -// +build !linux +// +build !linux,!windows package main diff --git a/fs/fstest/file.go b/fs/fstest/file.go index 2b9345449..02b4ebd0f 100644 --- a/fs/fstest/file.go +++ b/fs/fstest/file.go @@ -5,8 +5,6 @@ import ( "os" "path/filepath" "time" - - "github.com/containerd/continuity/sysx" ) // Applier applies single file changes @@ -96,12 +94,6 @@ func Link(oldname, newname string) Applier { }) } -func SetXAttr(name, key, value string) Applier { - return applyFn(func(root string) error { - return sysx.LSetxattr(name, key, []byte(value), 0) - }) -} - // TODO: Make platform specific, windows applier is always no-op //func Mknod(name string, mode int32, dev int) Applier { // return func(root string) error { diff --git a/fs/fstest/file_unix.go b/fs/fstest/file_unix.go new file mode 100644 index 000000000..ee303215a --- /dev/null +++ b/fs/fstest/file_unix.go @@ -0,0 +1,11 @@ +// +build !windows + +package fstest + +import "github.com/containerd/continuity/sysx" + +func SetXAttr(name, key, value string) Applier { + return applyFn(func(root string) error { + return sysx.LSetxattr(name, key, []byte(value), 0) + }) +} diff --git a/linux/shim/client.go b/linux/shim/client.go index ae27afa01..d0e0f4858 100644 --- a/linux/shim/client.go +++ b/linux/shim/client.go @@ -1,3 +1,5 @@ +// +build !windows + package shim import ( diff --git a/metrics/cgroups/cgroups.go b/metrics/cgroups/cgroups.go index 708caf1de..ab3009893 100644 --- a/metrics/cgroups/cgroups.go +++ b/metrics/cgroups/cgroups.go @@ -1,3 +1,5 @@ +// +build linux + package cgroups import ( diff --git a/snapshot/testsuite/testsuite.go b/snapshot/testsuite/testsuite.go index a37c925be..f447802d0 100644 --- a/snapshot/testsuite/testsuite.go +++ b/snapshot/testsuite/testsuite.go @@ -6,7 +6,6 @@ import ( "io/ioutil" "os" "path/filepath" - "syscall" "testing" "github.com/containerd/containerd/fs/fstest" @@ -28,8 +27,8 @@ func SnapshotterSuite(t *testing.T, name string, snapshotterFn func(ctx context. func makeTest(t *testing.T, name string, snapshotterFn func(ctx context.Context, root string) (snapshot.Snapshotter, func(), error), fn func(ctx context.Context, t *testing.T, snapshotter snapshot.Snapshotter, work string)) func(t *testing.T) { return func(t *testing.T) { ctx := context.Background() - oldumask := syscall.Umask(0) - defer syscall.Umask(oldumask) + restoreMask := clearMask() + defer restoreMask() // Make two directories: a snapshotter root and a play area for the tests: // // /tmp diff --git a/snapshot/testsuite/testsuite_unix.go b/snapshot/testsuite/testsuite_unix.go new file mode 100644 index 000000000..6a02eda9d --- /dev/null +++ b/snapshot/testsuite/testsuite_unix.go @@ -0,0 +1,12 @@ +// +build !windows + +package testsuite + +import "syscall" + +func clearMask() func() { + oldumask := syscall.Umask(0) + return func() { + syscall.Umask(oldumask) + } +} diff --git a/snapshot/testsuite/testsuite_windows.go b/snapshot/testsuite/testsuite_windows.go new file mode 100644 index 000000000..c3cc8c22b --- /dev/null +++ b/snapshot/testsuite/testsuite_windows.go @@ -0,0 +1,5 @@ +package testsuite + +func clearMask() func() { + return func() {} +} diff --git a/testutil/helpers.go b/testutil/helpers.go index af46b4b75..893afd1ad 100644 --- a/testutil/helpers.go +++ b/testutil/helpers.go @@ -6,9 +6,9 @@ import ( "os" "path/filepath" "strconv" - "syscall" "testing" + "github.com/containerd/containerd/mount" "github.com/stretchr/testify/assert" ) @@ -21,7 +21,7 @@ func init() { // Unmount unmounts a given mountPoint and sets t.Error if it fails func Unmount(t *testing.T, mountPoint string) { t.Log("unmount", mountPoint) - if err := syscall.Unmount(mountPoint, 0); err != nil { + if err := mount.Unmount(mountPoint, 0); err != nil { t.Error("Could not umount", mountPoint, err) } }