aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/fortify/default.nix
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-21 17:05:17 +0900
committerOphestra <cat@gensokyo.uk>2025-02-21 17:05:17 +0900
commit64b6dc41ba76fca1656374775f5fa57c4b6b39f1 (patch)
treea3cd0f87dee49ee52afd92b20e053a2baaf2eabe /tests/fortify/default.nix
parentc64b8163e79d47f1e710c1d067589bb393f8463c (diff)
nix: split integration test
For adding tests for fpkg. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'tests/fortify/default.nix')
-rw-r--r--tests/fortify/default.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/fortify/default.nix b/tests/fortify/default.nix
new file mode 100644
index 00000000..44879413
--- /dev/null
+++ b/tests/fortify/default.nix
@@ -0,0 +1,51 @@
+{
+ system,
+ self,
+ nixosTest,
+ writeShellScriptBin,
+}:
+
+nixosTest {
+ name = "fortify";
+ nodes.machine = {
+ environment.systemPackages = [
+ # For go tests:
+ self.packages.${system}.fhs
+ (writeShellScriptBin "fortify-src" "echo -n ${self.packages.${system}.fortify.src}")
+ ];
+
+ # Run with Go race detector:
+ environment.fortify.package =
+ let
+ inherit (self.packages.${system}) fortify;
+ in
+ fortify.overrideAttrs (previousAttrs: {
+ GOFLAGS = previousAttrs.GOFLAGS ++ [ "-race" ];
+
+ # fsu does not like cgo
+ disallowedReferences = previousAttrs.disallowedReferences ++ [ fortify ];
+ postInstall =
+ previousAttrs.postInstall
+ + ''
+ cp -a "${fortify}/libexec/fsu" "$out/libexec/fsu"
+ sed -i 's:${fortify}:${placeholder "out"}:' "$out/libexec/fsu"
+ '';
+ });
+
+ imports = [
+ ./configuration.nix
+
+ self.nixosModules.fortify
+ self.inputs.home-manager.nixosModules.home-manager
+ ];
+ };
+
+ # adapted from nixos sway integration tests
+
+ # testScriptWithTypes:49: error: Cannot call function of unknown type
+ # (machine.succeed if succeed else machine.execute)(
+ # ^
+ # Found 1 error in 1 file (checked 1 source file)
+ skipTypeCheck = true;
+ testScript = builtins.readFile ./test.py;
+}