summaryrefslogtreecommitdiff
path: root/test/gen_sifs.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/gen_sifs.go')
-rwxr-xr-xtest/gen_sifs.go35
1 files changed, 30 insertions, 5 deletions
diff --git a/test/gen_sifs.go b/test/gen_sifs.go
index 487ea5b..7395951 100755
--- a/test/gen_sifs.go
+++ b/test/gen_sifs.go
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2021, Sylabs Inc. All rights reserved.
+// Copyright (c) 2020-2022, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
// distributed with the sources of this project regarding your rights to use or distribute this
// software.
@@ -58,6 +58,17 @@ func generateImages() error {
)
}
+ objectSBOM := func() (sif.DescriptorInput, error) {
+ b, err := os.ReadFile(filepath.Join("input", "sbom.cdx.json"))
+ if err != nil {
+ return sif.DescriptorInput{}, err
+ }
+
+ return sif.NewDescriptorInput(sif.DataSBOM, bytes.NewReader(b),
+ sif.OptSBOMMetadata(sif.SBOMFormatCycloneDXJSON),
+ )
+ }
+
partSystem := func() (sif.DescriptorInput, error) {
return sif.NewDescriptorInput(sif.DataPartition,
bytes.NewReader([]byte{0xfa, 0xce, 0xfe, 0xed}),
@@ -66,15 +77,23 @@ func generateImages() error {
}
partPrimSys := func() (sif.DescriptorInput, error) {
- return sif.NewDescriptorInput(sif.DataPartition,
- bytes.NewReader([]byte{0xde, 0xad, 0xbe, 0xef}),
+ b, err := os.ReadFile(filepath.Join("input", "root.squashfs"))
+ if err != nil {
+ return sif.DescriptorInput{}, err
+ }
+
+ return sif.NewDescriptorInput(sif.DataPartition, bytes.NewReader(b),
sif.OptPartitionMetadata(sif.FsSquash, sif.PartPrimSys, "386"),
)
}
partSystemGroup2 := func() (sif.DescriptorInput, error) {
- return sif.NewDescriptorInput(sif.DataPartition,
- bytes.NewReader([]byte{0xba, 0xdd, 0xca, 0xfe}),
+ b, err := os.ReadFile(filepath.Join("input", "root.ext3"))
+ if err != nil {
+ return sif.DescriptorInput{}, err
+ }
+
+ return sif.NewDescriptorInput(sif.DataPartition, bytes.NewReader(b),
sif.OptPartitionMetadata(sif.FsExt3, sif.PartSystem, "amd64"),
sif.OptGroupID(2),
)
@@ -125,6 +144,12 @@ func generateImages() error {
objectCryptoMessage,
},
},
+ {
+ path: "one-object-sbom.sif",
+ diFns: []func() (sif.DescriptorInput, error){
+ objectSBOM,
+ },
+ },
// Images with two partitions in one group.
{