mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-12-27 07:27:24 +01:00
59ac54e2fc
- ABI4 by default, fallback to abi 3. - aa-prebuild cli that can be used by other project shipping profiles. - --file option to cli to only build one dev profile. - add abi version filter to only & exclude directives.
56 lines
959 B
Go
56 lines
959 B
Go
// apparmor.d - Full set of apparmor profiles
|
|
// Copyright (C) 2023-2024 Alexandre Pujol <alexandre@pujol.io>
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"testing"
|
|
|
|
"github.com/roddhjav/apparmor.d/pkg/prebuild"
|
|
)
|
|
|
|
func chdirGitRoot() {
|
|
cmd := exec.Command("git", "rev-parse", "--show-toplevel")
|
|
out, err := cmd.Output()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
root := string(out[0 : len(out)-1])
|
|
if err := os.Chdir(root); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func Test_main(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
dist string
|
|
}{
|
|
{
|
|
name: "Build for Archlinux",
|
|
dist: "arch",
|
|
},
|
|
{
|
|
name: "Build for Ubuntu",
|
|
dist: "ubuntu",
|
|
},
|
|
{
|
|
name: "Build for Debian",
|
|
dist: "debian",
|
|
},
|
|
{
|
|
name: "Build for OpenSUSE Tumbleweed",
|
|
dist: "opensuse",
|
|
},
|
|
}
|
|
chdirGitRoot()
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
prebuild.Distribution = tt.dist
|
|
main()
|
|
})
|
|
}
|
|
}
|