core/pkgs/build-support/testers/hasPkgConfigModules/tests.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.3 KiB
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
# cd nixpkgs
# nix-build -A tests.testers.hasPkgConfigModule
{
lib,
testers,
zlib,
openssl,
runCommand,
}:
lib.recurseIntoAttrs {
zlib-has-zlib = testers.hasPkgConfigModules {
package = zlib;
moduleNames = [ "zlib" ];
};
zlib-has-meta-pkgConfigModules = testers.hasPkgConfigModules { package = zlib; };
openssl-has-openssl = testers.hasPkgConfigModules {
package = openssl;
moduleNames = [ "openssl" ];
};
openssl-has-all-meta-pkgConfigModules = testers.hasPkgConfigModules { package = openssl; };
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
zlib-does-not-have-ylib =
runCommand "zlib-does-not-have-ylib"
{
failed = testers.testBuildFailure (
testers.hasPkgConfigModules {
package = zlib;
moduleNames = [ "ylib" ];
2024-06-30 08:12:46 +00:00
}
);
2024-05-02 00:46:19 +00:00
}
''
echo 'it logs a relevant error message'
{
grep -F "pkg-config module ylib was not found" $failed/testBuildFailure.log
}
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
echo 'it logs which pkg-config modules are available, to be helpful'
{
# grep -v: the string zlib does also occur in a store path in an earlier message, which isn't particularly helpful
grep -v "checking pkg-config module" < $failed/testBuildFailure.log \
| grep -F "zlib"
}
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
# done
touch $out
'';
}