mirror of
https://github.com/restic/restic.git
synced 2025-10-25 18:34:15 +00:00
fs: test File implementation of Local FS
This commit is contained in:
parent
6cb19e0190
commit
b51bf0c0c4
2 changed files with 262 additions and 0 deletions
40
internal/fs/fs_local_unix_test.go
Normal file
40
internal/fs/fs_local_unix_test.go
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
//go:build unix
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/internal/restic"
|
||||
rtest "github.com/restic/restic/internal/test"
|
||||
)
|
||||
|
||||
func TestFSLocalMetadataUnix(t *testing.T) {
|
||||
for _, test := range []fsLocalMetadataTestcase{
|
||||
{
|
||||
name: "socket",
|
||||
setup: func(t *testing.T, path string) {
|
||||
fd, err := syscall.Socket(syscall.AF_UNIX, syscall.SOCK_STREAM, 0)
|
||||
rtest.OK(t, err)
|
||||
defer func() {
|
||||
_ = syscall.Close(fd)
|
||||
}()
|
||||
|
||||
addr := &syscall.SockaddrUnix{Name: path}
|
||||
rtest.OK(t, syscall.Bind(fd, addr))
|
||||
},
|
||||
nodeType: restic.NodeTypeSocket,
|
||||
},
|
||||
{
|
||||
name: "fifo",
|
||||
setup: func(t *testing.T, path string) {
|
||||
rtest.OK(t, mkfifo(path, 0o600))
|
||||
},
|
||||
nodeType: restic.NodeTypeFifo,
|
||||
},
|
||||
// device files can only be created as root
|
||||
} {
|
||||
runFSLocalTestcase(t, test)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue