summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2023-01-30 17:59:23 +0200
committerGitHub <noreply@github.com>2023-01-30 17:59:23 +0200
commitd88425e91ca77d6041fd0c1801012bcbe0fae56b (patch)
tree05f61024bd348f593f30f96fe516d6f6fd4008a6 /nixos
parent23ce77d76e3f679146eb3bde92c90bd5223067dc (diff)
parent22ebaedc73f3c221cba2ea12cc3e6a688bbe3457 (diff)
Merge pull request #199512 from 06kellyjac/tracee
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/tracee.nix20
1 files changed, 10 insertions, 10 deletions
diff --git a/nixos/tests/tracee.nix b/nixos/tests/tracee.nix
index 6ef7e5342bee..1e0249056fea 100644
--- a/nixos/tests/tracee.nix
+++ b/nixos/tests/tracee.nix
@@ -11,19 +11,19 @@ import ./make-test-python.nix ({ pkgs, ... }: {
# build the go integration tests as a binary
(pkgs.tracee.overrideAttrs (oa: {
pname = oa.pname + "-integration";
- patches = oa.patches or [] ++ [
- # change the prefix from /usr/bin to /run to find nix processes
- ../../pkgs/tools/security/tracee/test-EventFilters-prefix-nix-friendly.patch
- ];
+ postPatch = oa.postPatch or "" + ''
+ # prepare tester.sh
+ patchShebangs tests/integration/tester.sh
+ # fix the test to look at nixos paths for running programs
+ substituteInPlace tests/integration/integration_test.go \
+ --replace "/usr/bin" "/run"
+ '';
+ nativeBuildInputs = oa.nativeBuildInputs or [ ] ++ [ pkgs.makeWrapper ];
buildPhase = ''
runHook preBuild
# just build the static lib we need for the go test binary
make $makeFlags ''${enableParallelBuilding:+-j$NIX_BUILD_CORES} bpf-core ./dist/btfhub
- # remove the /usr/bin prefix to work with the patch above
- substituteInPlace tests/integration/integration_test.go \
- --replace "/usr/bin/ls" "ls"
-
# then compile the tests to be ran later
CGO_LDFLAGS="$(pkg-config --libs libbpf)" go test -tags core,ebpf,integration -p 1 -c -o $GOPATH/tracee-integration ./tests/integration/...
runHook postBuild
@@ -31,7 +31,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
doCheck = false;
installPhase = ''
mkdir -p $out/bin
- cp $GOPATH/tracee-integration $out/bin
+ mv $GOPATH/tracee-integration $out/bin/
'';
doInstallCheck = false;
}))
@@ -44,6 +44,6 @@ import ./make-test-python.nix ({ pkgs, ... }: {
# EventFilters/trace_only_events_from_new_containers also requires a container called "alpine"
machine.succeed('tar cv -C ${pkgs.pkgsStatic.busybox} . | podman import - alpine --change ENTRYPOINT=sleep')
- print(machine.succeed('TRC_BIN="${pkgs.tracee}" tracee-integration -test.v'))
+ print(machine.succeed('tracee-integration -test.v'))
'';
})