cdxgen: add passthru tests

This commit is contained in:
eljamm
2026-08-31 17:19:24 +02:00
parent 81ae260aa0
commit 55ab7c1d82

View File

@@ -8,6 +8,10 @@
fetchPnpmDeps,
pnpmConfigHook,
stdenv,
# tests
runCommand,
testers,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "cdxgen";
@@ -55,6 +59,24 @@ stdenv.mkDerivation (finalAttrs: {
find $out -xtype l -print -delete
'';
passthru.tests = {
version = testers.testVersion {
package = finalAttrs.finalPackage;
};
sbom =
runCommand "${finalAttrs.pname}-${finalAttrs.version}-test-sbom"
{
nativeBuildInputs = [ finalAttrs.finalPackage ];
}
''
pushd ${finalAttrs.src}/test/repotests/npm-smoke
cdxgen -t npm -o $out/bom.json .
grep -q '"bomFormat"' "$out/bom.json"
popd
'';
};
meta = {
description = "Creates CycloneDX Software Bill-of-Materials (SBOM) for your projects from source and container images";
mainProgram = "cdxgen";