Fix linux test
remove debug lines
This commit is contained in:
parent
082fa5e918
commit
e433d9038e
@ -22,7 +22,6 @@ func (l lands) landAdd(path, flags string) error {
|
||||
|
||||
switch mode := s.Mode(); {
|
||||
case mode.IsDir():
|
||||
log.Println("directory", path)
|
||||
switch flags {
|
||||
case "r":
|
||||
l = append(l, landlock.RODirs(path))
|
||||
@ -32,7 +31,6 @@ func (l lands) landAdd(path, flags string) error {
|
||||
l = append(l, landlock.RWDirs(path))
|
||||
}
|
||||
default:
|
||||
log.Println("file", path)
|
||||
switch flags {
|
||||
case "r":
|
||||
log.Println("READ ONLY")
|
||||
|
@ -2,38 +2,33 @@ package protect
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
/*
|
||||
FIXME
|
||||
func TestLandlockFileWrite(t *testing.T) {
|
||||
if runtime.GOOS != "linux" {
|
||||
t.Skip("Not running on Linux... skipping landlock test")
|
||||
}
|
||||
|
||||
f, err := os.CreateTemp("", "landlockTest")
|
||||
dir, err := os.MkdirTemp("", "landlock")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.Remove(f.Name())
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
unveil("/tmp", "r")
|
||||
unveil(dir, "r")
|
||||
err = unveilBlock()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if c, err := f.Write([]byte("badbeef")); err == nil {
|
||||
t.Fatalf("wrote %d bytes to %q when I shouldn't have been able too\n", c, f.Name())
|
||||
}
|
||||
|
||||
if err := f.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
f, err := os.OpenFile(path.Join(dir, "deadbeef"), os.O_RDWR|os.O_CREATE, 0600)
|
||||
if err == nil {
|
||||
t.Fatalf("should not have been able to create %q, but was able to do so\n", f.Name())
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func TestLandlockRO(t *testing.T) {
|
||||
if runtime.GOOS != "linux" {
|
||||
|
Loading…
Reference in New Issue
Block a user