From 1a1a4ebd7dc60cbc921f03bfa73cd99f64afb2b4 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Wed, 9 Oct 2024 10:15:27 -0700 Subject: [PATCH] tests/srcOnly: init --- pkgs/build-support/src-only/tests.nix | 28 +++++++++++++++++++++++++++ pkgs/test/default.nix | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/build-support/src-only/tests.nix diff --git a/pkgs/build-support/src-only/tests.nix b/pkgs/build-support/src-only/tests.nix new file mode 100644 index 0000000000000..7ea7c23621be0 --- /dev/null +++ b/pkgs/build-support/src-only/tests.nix @@ -0,0 +1,28 @@ +{ + runCommand, + srcOnly, + emptyDirectory, + glibc, +}: + +let + emptySrc = srcOnly emptyDirectory; + glibcSrc = srcOnly glibc; +in + +runCommand "srcOnly-tests" { } '' + # Test that emptySrc is empty + if [ -n "$(ls -A ${emptySrc})" ]; then + echo "emptySrc is not empty" + exit 1 + fi + + # Test that glibcSrc is not empty + if [ -z "$(ls -A ${glibcSrc})" ]; then + echo "glibcSrc is empty" + exit 1 + fi + + # Make $out exist to avoid build failure + mkdir -p $out +'' diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index adb112fd36680..2c9497712b328 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -180,6 +180,8 @@ with pkgs; auto-patchelf-hook = callPackage ./auto-patchelf-hook { }; + srcOnly = callPackage ../build-support/src-only/tests.nix { }; + systemd = callPackage ./systemd { }; replaceVars = recurseIntoAttrs (callPackage ./replace-vars { });