aa-log: add -f option to set a log file.

This commit is contained in:
Alexandre Pujol 2022-02-10 21:30:51 +00:00
parent ba0ccc3edc
commit 6876938719
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
4 changed files with 47 additions and 13 deletions

View file

@ -131,26 +131,26 @@ func TestAppArmorLogs_String(t *testing.T) {
func Test_app(t *testing.T) {
tests := []struct {
name string
args []string
path string
profile string
wantErr bool
}{
{
name: "OK",
args: []string{"aa-log", ""},
path: "../../tests/audit.log",
profile: "",
wantErr: false,
},
{
name: "No logfile",
args: []string{"aa-log", ""},
path: "../../tests/log",
profile: "",
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := aaLog(tt.args, tt.path); (err != nil) != tt.wantErr {
if err := aaLog(tt.path, tt.profile); (err != nil) != tt.wantErr {
t.Errorf("aaLog() error = %v, wantErr %v", err, tt.wantErr)
}
})