mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-11-15 16:03:51 +01:00
test(aa-log): add & update some variabe parsing test
This commit is contained in:
parent
73109bb09c
commit
422418e0e2
@ -76,6 +76,15 @@ func TestAppArmorProfile_ParseVariables(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "snapd",
|
||||||
|
content: `@{lib_dirs} = @{lib}/ /snap/snapd/@{int}@{lib}
|
||||||
|
@{exec_path} = @{lib_dirs}/snapd/snapd`,
|
||||||
|
want: []Variable{
|
||||||
|
{"lib_dirs", []string{"@{lib}/", "/snap/snapd/@{int}@{lib}"}},
|
||||||
|
{"exec_path", []string{"@{lib_dirs}/snapd/snapd"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
@ -132,9 +141,9 @@ func TestAppArmorProfile_ResolveAttachments(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "chromium",
|
name: "chromium",
|
||||||
variables: []Variable{
|
variables: []Variable{
|
||||||
{"chromium_name", []string{"chromium"}},
|
{"name", []string{"chromium"}},
|
||||||
{"chromium_lib_dirs", []string{"/{usr/,}lib/@{chromium_name}"}},
|
{"lib_dirs", []string{"/{usr/,}lib/@{name}"}},
|
||||||
{"exec_path", []string{"@{chromium_lib_dirs}/@{chromium_name}"}},
|
{"exec_path", []string{"@{lib_dirs}/@{name}"}},
|
||||||
},
|
},
|
||||||
want: []string{
|
want: []string{
|
||||||
"/{usr/,}lib/chromium/chromium",
|
"/{usr/,}lib/chromium/chromium",
|
||||||
@ -155,9 +164,9 @@ func TestAppArmorProfile_ResolveAttachments(t *testing.T) {
|
|||||||
name: "opera",
|
name: "opera",
|
||||||
variables: []Variable{
|
variables: []Variable{
|
||||||
{"multiarch", []string{"*-linux-gnu*"}},
|
{"multiarch", []string{"*-linux-gnu*"}},
|
||||||
{"chromium_name", []string{"opera{,-beta,-developer}"}},
|
{"name", []string{"opera{,-beta,-developer}"}},
|
||||||
{"chromium_lib_dirs", []string{"/{usr/,}lib/@{multiarch}/@{chromium_name}"}},
|
{"lib_dirs", []string{"/{usr/,}lib/@{multiarch}/@{name}"}},
|
||||||
{"exec_path", []string{"@{chromium_lib_dirs}/@{chromium_name}"}},
|
{"exec_path", []string{"@{lib_dirs}/@{name}"}},
|
||||||
},
|
},
|
||||||
want: []string{
|
want: []string{
|
||||||
"/{usr/,}lib/*-linux-gnu*/opera{,-beta,-developer}/opera{,-beta,-developer}",
|
"/{usr/,}lib/*-linux-gnu*/opera{,-beta,-developer}/opera{,-beta,-developer}",
|
||||||
|
Loading…
Reference in New Issue
Block a user