2023-02-02 18:25:31 +00:00
|
|
|
# cd nixpkgs
|
|
|
|
# nix-build -A tests.testers.hasPkgConfigModule
|
2023-08-10 07:59:29 +00:00
|
|
|
{ lib, testers, zlib, openssl, runCommand }:
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
lib.recurseIntoAttrs {
|
|
|
|
|
2023-08-10 07:59:29 +00:00
|
|
|
zlib-has-zlib = testers.hasPkgConfigModules {
|
2023-02-02 18:25:31 +00:00
|
|
|
package = zlib;
|
2023-08-10 07:59:29 +00:00
|
|
|
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;
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
zlib-does-not-have-ylib = runCommand "zlib-does-not-have-ylib" {
|
|
|
|
failed = testers.testBuildFailure (
|
2023-08-10 07:59:29 +00:00
|
|
|
testers.hasPkgConfigModules {
|
2023-02-02 18:25:31 +00:00
|
|
|
package = zlib;
|
2023-08-10 07:59:29 +00:00
|
|
|
moduleNames = [ "ylib" ];
|
2023-02-02 18:25:31 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
} ''
|
|
|
|
echo 'it logs a relevant error message'
|
|
|
|
{
|
|
|
|
grep -F "pkg-config module ylib was not found" $failed/testBuildFailure.log
|
|
|
|
}
|
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
|
|
|
# done
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
}
|