mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-18 00:48:10 +01:00
fix: profile compilation.
This commit is contained in:
parent
da3717991e
commit
a2c6580725
2 changed files with 10 additions and 2 deletions
|
@ -67,4 +67,4 @@
|
|||
@{user_torrents_dirs}=@{HOME}/@{XDG_TORRENTS_DIR} @{MOUNTS}/@{XDG_TORRENTS_DIR}
|
||||
@{user_vm_dirs}=@{HOME}/@{XDG_VM_DIR} @{MOUNTS}/@{XDG_VM_DIR}
|
||||
|
||||
# vim:syntax=apparmor
|
||||
# vim:syntax=apparmor
|
||||
|
|
|
@ -6,6 +6,7 @@ package aa
|
|||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/roddhjav/apparmor.d/pkg/paths"
|
||||
|
@ -17,6 +18,13 @@ var (
|
|||
intData = paths.New("../../apparmor.d")
|
||||
)
|
||||
|
||||
// mustReadProfileFile read a file and return its content as a slice of string.
|
||||
// It panics if an error occurs. It removes the last comment line.
|
||||
func mustReadProfileFile(path *paths.Path) string {
|
||||
res := strings.Split(util.MustReadFile(path), "\n")
|
||||
return strings.Join(res[:len(res)-2], "\n")
|
||||
}
|
||||
|
||||
func TestAppArmorProfileFile_String(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -230,7 +238,7 @@ func TestAppArmorProfileFile_Integration(t *testing.T) {
|
|||
},
|
||||
}},
|
||||
},
|
||||
want: util.MustReadFile(intData.Join("profiles-a-f/aa-status")),
|
||||
want: mustReadProfileFile(intData.Join("profiles-a-f/aa-status")),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
|
Loading…
Reference in a new issue