Fix linux test

remove debug lines
This commit is contained in:
Aaron Bieber 2023-03-21 07:22:37 -06:00
parent 082fa5e918
commit e433d9038e
No known key found for this signature in database
2 changed files with 7 additions and 14 deletions

View File

@ -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")

View File

@ -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" {