Skip to content

Commit

Permalink
add build test
Browse files Browse the repository at this point in the history
Signed-off-by: Alessio Greggi <[email protected]>
  • Loading branch information
alegrey91 committed Aug 10, 2024
1 parent 8ccbd50 commit 23befbb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ var buildCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(buildCmd)

buildCmd.Flags().StringVarP(&inputDirectory, "directory", "D", "", "Directory containing harpoon's files")
buildCmd.Flags().StringVarP(&inputDirectory, "directory", "D", "", "Directory containing harpoon's metadata files")
buildCmd.MarkFlagRequired("directory")

buildCmd.Flags().BoolVarP(&saveProfile, "save-profile", "s", false, "Save profile to a file")
buildCmd.Flags().StringVarP(&profileName, "name", "n", profileName, "Save profile to a file")
buildCmd.Flags().BoolVarP(&saveProfile, "save", "S", false, "Save profile to a file")
buildCmd.Flags().StringVarP(&profileName, "name", "n", profileName, "Specify a name for the seccomp profile")
}
25 changes: 25 additions & 0 deletions tests/analyze.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ exists harpoon/github_com_alegrey91_seccomp-test-coverage_pkg_randomic_FlipCoin
exists harpoon/github_com_alegrey91_seccomp-test-coverage_pkg_randomic_RockPaperScissors
exists harpoon/github_com_alegrey91_seccomp-test-coverage_pkg_randomic_ThrowDice

exec harpoon build -D harpoon/ -S --name profile.json
exists profile.json
cmp profile.json expected-profile.json

-- testcases/example-app/harpoon-expected-report.yml --
---
symbolsOrigins:
Expand All @@ -31,3 +35,24 @@ symbolsOrigins:
- github.com/alegrey91/seccomp-test-coverage/pkg/randomic.FlipCoin
- github.com/alegrey91/seccomp-test-coverage/pkg/randomic.DoSomethingSpecial


-- testcases/example-app/expected-profile.json --
{
"defaultAction": "SCMP_ACT_ERRNO",
"architectures": [
"SCMP_ARCH_X86_64",
"SCMP_ARCH_X86",
"SCMP_ARCH_X32"
],
"syscalls": [
{
"names": [
"futex",
"gettid",
"nanosleep",
"write"
],
"action": "SCMP_ACT_ALLOW"
}
]
}

0 comments on commit 23befbb

Please sign in to comment.