Fix SBOM integration test
Bug: 389985381
Test: build/soong/tests/sbom_test.sh
Change-Id: I506dfd001fddc0478508cf8e262895e5fd7b2d11
diff --git a/tests/sbom_test.sh b/tests/sbom_test.sh
index 0471853..2ef9e37 100755
--- a/tests/sbom_test.sh
+++ b/tests/sbom_test.sh
@@ -83,6 +83,12 @@
dump_erofs=$out_dir/host/linux-x86/bin/dump.erofs
lz4=$out_dir/host/linux-x86/bin/lz4
+ declare -A diff_excludes
+ diff_excludes[system]="\
+ -I /etc/NOTICE.xml.gz \
+ -I /odm_dlkm/etc \
+ -I /vendor_dlkm/etc"
+
# Example output of dump.erofs is as below, and the data used in the test start
# at line 11. Column 1 is inode id, column 2 is inode type and column 3 is name.
# Each line is captured in variable "entry", awk is used to get type and name.
@@ -155,7 +161,11 @@
sort -n -o "$files_in_soong_spdx_file" "$files_in_soong_spdx_file"
echo ============ Diffing files in $f and SBOM created by Soong
- diff_files "$file_list_file" "$files_in_soong_spdx_file" "$partition_name" ""
+ exclude=
+ if [ -v 'diff_excludes[$partition_name]' ]; then
+ exclude=${diff_excludes[$partition_name]}
+ fi
+ diff_files "$file_list_file" "$files_in_soong_spdx_file" "$partition_name" "$exclude"
done
RAMDISK_IMAGES="$product_out/ramdisk.img"
@@ -230,10 +240,10 @@
exit 1
fi
- # PRODUCT and 7 prebuilt packages have "PackageLicenseDeclared: NOASSERTION"
+ # PRODUCT and 6 prebuilt packages have "PackageLicenseDeclared: NOASSERTION"
# All other packages have declared licenses
num_of_packages_with_noassertion_license=$(grep 'PackageLicenseDeclared: NOASSERTION' $sbom_file | wc -l)
- if [ $num_of_packages_with_noassertion_license = 15 ]
+ if [ $num_of_packages_with_noassertion_license = 13 ]
then
echo "Number of packages with NOASSERTION license is correct."
else