Skip to content

Commit

Permalink
tests/srcOnly: init (#347548)
Browse files Browse the repository at this point in the history
  • Loading branch information
philiptaron authored Nov 1, 2024
2 parents 5d93226 + 1a1a4eb commit 8d9fcbc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkgs/build-support/src-only/tests.nix
Original file line number Diff line number Diff line change
@@ -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
''
2 changes: 2 additions & 0 deletions pkgs/test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,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 { });
Expand Down

0 comments on commit 8d9fcbc

Please sign in to comment.