aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat/emulate_test.go
blob: 16383f2601988c0f5fa35957140d6f6340767b0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package syscallcompat

import (
	"os"
	"testing"

	"golang.org/x/sys/unix"
)

func TestEmulateMknodat(t *testing.T) {
	err := emulateMknodat(tmpDirFd, "fifo1", unix.S_IFIFO, 0)
	if err != nil {
		t.Fatal(err)
	}
	_, err = os.Stat(tmpDir + "/fifo1")
	if err != nil {
		t.Fatal(err)
	}
	// Test with absolute path
	err = emulateMknodat(-1, tmpDir+"/fifo2", unix.S_IFIFO, 0)
	if err != nil {
		t.Fatal(err)
	}
	_, err = os.Stat(tmpDir + "/fifo2")
	if err != nil {
		t.Fatal(err)
	}
}