diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fa02ed2..a3009e50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,19 +75,16 @@ jobs: run: make build binaries working-directory: src/github.com/containerd/continuity - - name: Linux Tests - if: startsWith(matrix.os, 'ubuntu') + - name: Tests run: | make test - make root-test working-directory: src/github.com/containerd/continuity - - name: Non-Linux Tests - if: ${{ !startsWith(matrix.os, 'ubuntu') }} - shell: bash - run: make test-compile + - name: Root Tests + if: ${{ !startsWith(matrix.os, 'windows') }} + run: | + make root-test working-directory: src/github.com/containerd/continuity - cross: name: Cross-compile runs-on: ubuntu-22.04 diff --git a/fs/copy_unix.go b/fs/copy_unix.go index 0e68ba9e..dd957872 100644 --- a/fs/copy_unix.go +++ b/fs/copy_unix.go @@ -23,6 +23,7 @@ import ( "fmt" "io" "os" + "runtime" "syscall" "github.com/containerd/continuity/sysx" @@ -71,6 +72,10 @@ func copyFileContent(dst, src *os.File) error { func copyXAttrs(dst, src string, excludes map[string]struct{}, errorHandler XAttrErrorHandler) error { xattrKeys, err := sysx.LListxattr(src) if err != nil { + if os.IsPermission(err) && runtime.GOOS == "darwin" { + // On darwin, character devices do not permit listing xattrs + return nil + } e := fmt.Errorf("failed to list xattrs on %s: %w", src, err) if errorHandler != nil { e = errorHandler(dst, src, "", e) diff --git a/fs/copy_unix_test.go b/fs/copy_unix_test.go index d4a02038..69eb2d52 100644 --- a/fs/copy_unix_test.go +++ b/fs/copy_unix_test.go @@ -22,6 +22,7 @@ package fs import ( "os" "path/filepath" + "runtime" "syscall" "testing" @@ -89,11 +90,13 @@ func TestCopyIrregular(t *testing.T) { t.Fatal(err) } prepared++ - f2Socket := filepath.Join(src, "f2.sock") - if err := unix.Mknod(f2Socket, 0o600|unix.S_IFSOCK, 0); err != nil { - t.Fatal(err) + if runtime.GOOS != "darwin" { + f2Socket := filepath.Join(src, "f2.sock") + if err := unix.Mknod(f2Socket, 0o600|unix.S_IFSOCK, 0); err != nil { + t.Fatal(err) + } + prepared++ } - prepared++ f3Dev := filepath.Join(src, "f3.dev") if err := unix.Mknod(f3Dev, 0o600|unix.S_IFCHR, 42); err != nil { t.Logf("skipping testing S_IFCHR: %v", err) diff --git a/fs/diff_test.go b/fs/diff_test.go index 58c66fb3..395ee2a1 100644 --- a/fs/diff_test.go +++ b/fs/diff_test.go @@ -150,6 +150,9 @@ func TestRemoveDirectoryTree(t *testing.T) { } func TestRemoveDirectoryTreeWithDash(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("windows fails this test with `-` files reported as modified") + } l1 := fstest.Apply( fstest.CreateDir("/dir1/dir2/dir3", 0o755), fstest.CreateFile("/dir1/f1", []byte("f1"), 0o644), diff --git a/fs/du_test.go b/fs/du_test.go index 4744df01..9839a577 100644 --- a/fs/du_test.go +++ b/fs/du_test.go @@ -73,17 +73,6 @@ func TestUsage(t *testing.T) { } if runtime.GOOS != "windows" { testCases = append(testCases, []testCase{ - { - name: "SparseFiles", - fs: fstest.Apply( - fstest.CreateDir("/dir", 0o755), - fstest.CreateRandomFile("/dir/file1", 7, 5, 0o644), - createSparseFile("/dir/sparse1", 8, 0o644, 5, 1024*1024, 5), - createSparseFile("/dir/sparse2", 9, 0o644, 0, 1024*1024), - createSparseFile("/dir/sparse2", 10, 0o644, 0, 1024*1024*1024, 1024), - ), - size: dirs(2) + align(5)*3 + align(1024), - }, { name: "Hardlinks", fs: fstest.Apply( @@ -104,6 +93,21 @@ func TestUsage(t *testing.T) { }, }...) } + if runtime.GOOS != "windows" && runtime.GOOS != "darwin" { + testCases = append(testCases, []testCase{ + { + name: "SparseFiles", + fs: fstest.Apply( + fstest.CreateDir("/dir", 0o755), + fstest.CreateRandomFile("/dir/file1", 7, 5, 0o644), + createSparseFile("/dir/sparse1", 8, 0o644, 5, 1024*1024, 5), + createSparseFile("/dir/sparse2", 9, 0o644, 0, 1024*1024), + createSparseFile("/dir/sparse2", 10, 0o644, 0, 1024*1024*1024, 1024), + ), + size: dirs(2) + align(5)*3 + align(1024), + }, + }...) + } for i := range testCases { tc := testCases[i] diff --git a/fs/du_windows_test.go b/fs/du_windows_test.go index f07f8a47..1b963496 100644 --- a/fs/du_windows_test.go +++ b/fs/du_windows_test.go @@ -22,7 +22,7 @@ func getTmpAlign(t testing.TB) (func(int64) int64, func(int64) int64, error) { return func(s int64) int64 { return s }, func(c int64) int64 { - return c * 4096 + return 0 }, nil }