diff --git a/internal/app/siftool/info_test.go b/internal/app/siftool/info_test.go new file mode 100644 index 00000000..2b54220a --- /dev/null +++ b/internal/app/siftool/info_test.go @@ -0,0 +1,245 @@ +// Copyright (c) 2021, Sylabs Inc. All rights reserved. +// This software is licensed under a 3-clause BSD license. Please consult the +// LICENSE file distributed with the sources of this project regarding your +// rights to use or distribute this software. + +package siftool + +import ( + "bytes" + "errors" + "path/filepath" + "testing" + + "github.com/sebdah/goldie/v2" +) + +var corpus = filepath.Join("..", "..", "..", "pkg", "integrity", "testdata", "images") + +//nolint:dupl +func TestApp_Header(t *testing.T) { + tests := []struct { + name string + path string + wantErr error + }{ + { + name: "Empty", + path: filepath.Join(corpus, "empty.sif"), + }, + { + name: "OneGroup", + path: filepath.Join(corpus, "one-group.sif"), + }, + { + name: "OneGroupSigned", + path: filepath.Join(corpus, "one-group-signed.sif"), + }, + { + name: "OneGroupSignedLegacy", + path: filepath.Join(corpus, "one-group-signed-legacy.sif"), + }, + { + name: "OneGroupSignedLegacyAll", + path: filepath.Join(corpus, "one-group-signed-legacy-all.sif"), + }, + { + name: "OneGroupSignedLegacyGroup", + path: filepath.Join(corpus, "one-group-signed-legacy-group.sif"), + }, + { + name: "TwoGroups", + path: filepath.Join(corpus, "two-groups.sif"), + }, + { + name: "TwoGroupsSigned", + path: filepath.Join(corpus, "two-groups-signed.sif"), + }, + { + name: "TwoGroupsSignedLegacy", + path: filepath.Join(corpus, "two-groups-signed-legacy.sif"), + }, + { + name: "TwoGroupsSignedLegacyAll", + path: filepath.Join(corpus, "two-groups-signed-legacy-all.sif"), + }, + { + name: "TwoGroupsSignedLegacyGroup", + path: filepath.Join(corpus, "two-groups-signed-legacy-group.sif"), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var b bytes.Buffer + + a, err := New(OptAppOutput(&b)) + if err != nil { + t.Fatalf("failed to create app: %v", err) + } + + if got, want := a.Header(tt.path), tt.wantErr; !errors.Is(got, want) { + t.Fatalf("got error %v, want %v", got, want) + } + + g := goldie.New(t, goldie.WithTestNameForDir(true)) + g.Assert(t, tt.name, b.Bytes()) + }) + } +} + +//nolint:dupl +func TestApp_List(t *testing.T) { + tests := []struct { + name string + path string + wantErr error + }{ + { + name: "Empty", + path: filepath.Join(corpus, "empty.sif"), + }, + { + name: "OneGroup", + path: filepath.Join(corpus, "one-group.sif"), + }, + { + name: "OneGroupSigned", + path: filepath.Join(corpus, "one-group-signed.sif"), + }, + { + name: "OneGroupSignedLegacy", + path: filepath.Join(corpus, "one-group-signed-legacy.sif"), + }, + { + name: "OneGroupSignedLegacyAll", + path: filepath.Join(corpus, "one-group-signed-legacy-all.sif"), + }, + { + name: "OneGroupSignedLegacyGroup", + path: filepath.Join(corpus, "one-group-signed-legacy-group.sif"), + }, + { + name: "TwoGroups", + path: filepath.Join(corpus, "two-groups.sif"), + }, + { + name: "TwoGroupsSigned", + path: filepath.Join(corpus, "two-groups-signed.sif"), + }, + { + name: "TwoGroupsSignedLegacy", + path: filepath.Join(corpus, "two-groups-signed-legacy.sif"), + }, + { + name: "TwoGroupsSignedLegacyAll", + path: filepath.Join(corpus, "two-groups-signed-legacy-all.sif"), + }, + { + name: "TwoGroupsSignedLegacyGroup", + path: filepath.Join(corpus, "two-groups-signed-legacy-group.sif"), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var b bytes.Buffer + + a, err := New(OptAppOutput(&b)) + if err != nil { + t.Fatalf("failed to create app: %v", err) + } + + if got, want := a.List(tt.path), tt.wantErr; !errors.Is(got, want) { + t.Fatalf("got error %v, want %v", got, want) + } + + g := goldie.New(t, goldie.WithTestNameForDir(true)) + g.Assert(t, tt.name, b.Bytes()) + }) + } +} + +//nolint:dupl +func TestApp_Info(t *testing.T) { + tests := []struct { + name string + path string + id uint32 + wantErr error + }{ + { + name: "One", + path: filepath.Join(corpus, "one-group-signed.sif"), + id: 1, + }, + { + name: "Two", + path: filepath.Join(corpus, "one-group-signed.sif"), + id: 2, + }, + { + name: "Three", + path: filepath.Join(corpus, "one-group-signed.sif"), + id: 3, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var b bytes.Buffer + + a, err := New(OptAppOutput(&b)) + if err != nil { + t.Fatalf("failed to create app: %v", err) + } + + if got, want := a.Info(tt.path, tt.id), tt.wantErr; !errors.Is(got, want) { + t.Fatalf("got error %v, want %v", got, want) + } + + g := goldie.New(t, goldie.WithTestNameForDir(true)) + g.Assert(t, tt.name, b.Bytes()) + }) + } +} + +//nolint:dupl +func TestApp_Dump(t *testing.T) { + tests := []struct { + name string + path string + id uint32 + wantErr error + }{ + { + name: "One", + path: filepath.Join(corpus, "one-group-signed.sif"), + id: 1, + }, + { + name: "Two", + path: filepath.Join(corpus, "one-group-signed.sif"), + id: 2, + }, + { + name: "Three", + path: filepath.Join(corpus, "one-group-signed.sif"), + id: 3, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var b bytes.Buffer + + a, err := New(OptAppOutput(&b)) + if err != nil { + t.Fatalf("failed to create app: %v", err) + } + + if got, want := a.Dump(tt.path, tt.id), tt.wantErr; !errors.Is(got, want) { + t.Fatalf("got error %v, want %v", got, want) + } + + g := goldie.New(t, goldie.WithTestNameForDir(true)) + g.Assert(t, tt.name, b.Bytes()) + }) + } +} diff --git a/internal/app/siftool/modif_test.go b/internal/app/siftool/modif_test.go new file mode 100644 index 00000000..e5414b50 --- /dev/null +++ b/internal/app/siftool/modif_test.go @@ -0,0 +1,147 @@ +// Copyright (c) 2021, Sylabs Inc. All rights reserved. +// This software is licensed under a 3-clause BSD license. Please consult the +// LICENSE file distributed with the sources of this project regarding your +// rights to use or distribute this software. + +package siftool + +import ( + "bytes" + "errors" + "os" + "testing" + + "github.com/sylabs/sif/v2/pkg/sif" +) + +func TestApp_New(t *testing.T) { + a, err := New() + if err != nil { + t.Fatalf("failed to create app: %v", err) + } + + tf, err := os.CreateTemp("", "sif-test-*") + if err != nil { + t.Fatal(err) + } + defer os.Remove(tf.Name()) + tf.Close() + + if err := a.New(tf.Name()); err != nil { + t.Fatal(err) + } +} + +func TestApp_Add(t *testing.T) { + a, err := New() + if err != nil { + t.Fatalf("failed to create app: %v", err) + } + + tests := []struct { + name string + opts AddOptions + wantErr error + }{ + { + name: "DataPartition", + opts: AddOptions{ + Datatype: sif.DataPartition, + Parttype: sif.PartPrimSys, + Partfs: sif.FsSquash, + Partarch: sif.HdrArch386, + Fp: bytes.NewBuffer([]byte{0xde, 0xad, 0xbe, 0xef}), + }, + }, + { + name: "DataSignature", + opts: AddOptions{ + Datatype: sif.DataSignature, + Signhash: sif.HashSHA256, + Signentity: "12045C8C0B1004D058DE4BEDA20C27EE7FF7BA84", + Fp: bytes.NewBuffer([]byte{0xde, 0xad, 0xbe, 0xef}), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tf, err := os.CreateTemp("", "sif-test-*") + if err != nil { + t.Fatal(err) + } + defer os.Remove(tf.Name()) + tf.Close() + + if err := a.New(tf.Name()); err != nil { + t.Fatal(err) + } + + if got, want := a.Add(tf.Name(), tt.opts), tt.wantErr; !errors.Is(got, want) { + t.Fatalf("got error %v, want %v", got, want) + } + }) + } +} + +func TestApp_Del(t *testing.T) { + a, err := New() + if err != nil { + t.Fatalf("failed to create app: %v", err) + } + + tf, err := os.CreateTemp("", "sif-test-*") + if err != nil { + t.Fatal(err) + } + defer os.Remove(tf.Name()) + tf.Close() + + if err := a.New(tf.Name()); err != nil { + t.Fatal(err) + } + + opts := AddOptions{ + Datatype: sif.DataGeneric, + Fp: bytes.NewBuffer([]byte{0xde, 0xad, 0xbe, 0xef}), + } + if err := a.Add(tf.Name(), opts); err != nil { + t.Fatal(err) + } + + if err := a.Del(tf.Name(), 1); err != nil { + t.Fatal(err) + } +} + +func TestApp_Setprim(t *testing.T) { + a, err := New() + if err != nil { + t.Fatalf("failed to create app: %v", err) + } + + tf, err := os.CreateTemp("", "sif-test-*") + if err != nil { + t.Fatal(err) + } + defer os.Remove(tf.Name()) + tf.Close() + + if err := a.New(tf.Name()); err != nil { + t.Fatal(err) + } + + opts := AddOptions{ + Datatype: sif.DataPartition, + Parttype: sif.PartSystem, + Partfs: sif.FsSquash, + Partarch: sif.HdrArch386, + Fp: bytes.NewBuffer([]byte{0xde, 0xad, 0xbe, 0xef}), + } + if err := a.Add(tf.Name(), opts); err != nil { + t.Fatal(err) + } + + if err := a.Setprim(tf.Name(), 1); err != nil { + t.Fatal(err) + } +} diff --git a/internal/app/siftool/testdata/TestApp_Dump/One.golden b/internal/app/siftool/testdata/TestApp_Dump/One.golden new file mode 100644 index 00000000..1d386480 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Dump/One.golden @@ -0,0 +1 @@ +úÎþí \ No newline at end of file diff --git a/internal/app/siftool/testdata/TestApp_Dump/Three.golden b/internal/app/siftool/testdata/TestApp_Dump/Three.golden new file mode 100644 index 00000000..16df6199 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Dump/Three.golden @@ -0,0 +1,14 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +{"version":1,"header":{"digest":"sha256:2086c56f4fc4b733d256d56b780a16c3c906578ab4a90158306de17798bc3f82"},"objects":[{"relativeId":0,"descriptorDigest":"sha256:72e10abae30a69c4eccae514d3d2217d1a03820767c50273b224b0ed69c3cf89","objectDigest":"sha256:004dfc8da678c309de28b5386a1e9efd57f536b150c40d29b31506aa0fb17ec2"},{"relativeId":1,"descriptorDigest":"sha256:9a2fa8bc044f51d56ee818101828d1f5f9fdd5ed012cad8231aca8551d886d07","objectDigest":"sha256:5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953"}]} +-----BEGIN PGP SIGNATURE----- + +wsBcBAEBCAAQBQJe+oD0CRCiDCfuf/e6hAAAifcIAH0bGbjQMNKQOqkRlvKUEGt/ +ogs1iMAGAvxbfLCfrhxKLdpBaYCHhEnSamtlt40oOJW5GYvnZRK5pG1ULbngDBd3 +I9UFQgEzj6rz5apwEMg9KZbBEZyTADxBCMleQ7AXzqTkhyyrKKcz2uuJi674YNEV +t8fce1QDzdmU112/nObBpS/3hOK16VxkwFZHfhfnLYbz5nm41a6Cc3ZxDxU5ULEW +HgbkPdZ8fz1g/68c/qRXn5td0kVW5ZnmJyDFZwXt5h+/93YNewGIyF2JUwngGe87 +l9jOl7oNSugTwei3tTJmh95zl2zRrQN37CttXP0njTgkm5RKWfPzW6o9FSYg7B8= +=5Vi5 +-----END PGP SIGNATURE----- \ No newline at end of file diff --git a/internal/app/siftool/testdata/TestApp_Dump/Two.golden b/internal/app/siftool/testdata/TestApp_Dump/Two.golden new file mode 100644 index 00000000..7d174b13 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Dump/Two.golden @@ -0,0 +1 @@ +Þ­¾ï \ No newline at end of file diff --git a/internal/app/siftool/testdata/TestApp_Header/Empty.golden b/internal/app/siftool/testdata/TestApp_Header/Empty.golden new file mode 100644 index 00000000..ed6507ef --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/Empty.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: unknown +ID: 3fa802cc-358b-45e3-bcc0-69dc7a45f9f8 +Ctime: 2020-05-22 19:30:59 +0000 UTC +Mtime: 2020-05-22 19:30:59 +0000 UTC +Dfree: 48 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 0 diff --git a/internal/app/siftool/testdata/TestApp_Header/OneGroup.golden b/internal/app/siftool/testdata/TestApp_Header/OneGroup.golden new file mode 100644 index 00000000..64fbeb95 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/OneGroup.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 6ecc76b7-a497-4f7f-9ebd-8da2a04c6be1 +Ctime: 2020-05-22 19:30:59 +0000 UTC +Mtime: 2020-05-22 19:30:59 +0000 UTC +Dfree: 46 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 4KB diff --git a/internal/app/siftool/testdata/TestApp_Header/OneGroupSigned.golden b/internal/app/siftool/testdata/TestApp_Header/OneGroupSigned.golden new file mode 100644 index 00000000..d9ab455b --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/OneGroupSigned.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 73e1c5c3-5c41-41ed-ad7c-2504d669f140 +Ctime: 2020-06-30 00:01:56 +0000 UTC +Mtime: 2020-06-30 00:01:56 +0000 UTC +Dfree: 45 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 8KB diff --git a/internal/app/siftool/testdata/TestApp_Header/OneGroupSignedLegacy.golden b/internal/app/siftool/testdata/TestApp_Header/OneGroupSignedLegacy.golden new file mode 100644 index 00000000..1e11aff6 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/OneGroupSignedLegacy.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 6ecc76b7-a497-4f7f-9ebd-8da2a04c6be1 +Ctime: 2020-05-22 19:30:59 +0000 UTC +Mtime: 2020-06-20 20:16:39 +0000 UTC +Dfree: 45 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 8KB diff --git a/internal/app/siftool/testdata/TestApp_Header/OneGroupSignedLegacyAll.golden b/internal/app/siftool/testdata/TestApp_Header/OneGroupSignedLegacyAll.golden new file mode 100644 index 00000000..6821e21f --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/OneGroupSignedLegacyAll.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 6ecc76b7-a497-4f7f-9ebd-8da2a04c6be1 +Ctime: 2020-05-22 19:30:59 +0000 UTC +Mtime: 2020-06-20 20:17:15 +0000 UTC +Dfree: 44 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 12KB diff --git a/internal/app/siftool/testdata/TestApp_Header/OneGroupSignedLegacyGroup.golden b/internal/app/siftool/testdata/TestApp_Header/OneGroupSignedLegacyGroup.golden new file mode 100644 index 00000000..1cd7b870 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/OneGroupSignedLegacyGroup.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 6ecc76b7-a497-4f7f-9ebd-8da2a04c6be1 +Ctime: 2020-05-22 19:30:59 +0000 UTC +Mtime: 2020-06-20 20:16:55 +0000 UTC +Dfree: 45 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 8KB diff --git a/internal/app/siftool/testdata/TestApp_Header/TwoGroups.golden b/internal/app/siftool/testdata/TestApp_Header/TwoGroups.golden new file mode 100644 index 00000000..394187c1 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/TwoGroups.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 0b19ec2c-0b08-46c9-95ae-fa88cd9e48a1 +Ctime: 2020-05-22 19:30:59 +0000 UTC +Mtime: 2020-05-22 19:30:59 +0000 UTC +Dfree: 45 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 8KB diff --git a/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSigned.golden b/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSigned.golden new file mode 100644 index 00000000..fa14cd02 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSigned.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 610cf3a3-18b0-4622-8b08-772d3510d7b5 +Ctime: 2020-06-30 00:01:56 +0000 UTC +Mtime: 2020-06-30 00:01:56 +0000 UTC +Dfree: 43 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 16KB diff --git a/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSignedLegacy.golden b/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSignedLegacy.golden new file mode 100644 index 00000000..a4e0aa06 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSignedLegacy.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 0b19ec2c-0b08-46c9-95ae-fa88cd9e48a1 +Ctime: 2020-05-22 19:30:59 +0000 UTC +Mtime: 2020-06-20 20:16:44 +0000 UTC +Dfree: 44 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 12KB diff --git a/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSignedLegacyAll.golden b/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSignedLegacyAll.golden new file mode 100644 index 00000000..3cdf05b1 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSignedLegacyAll.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 0b19ec2c-0b08-46c9-95ae-fa88cd9e48a1 +Ctime: 2020-05-22 19:30:59 +0000 UTC +Mtime: 2020-06-20 20:17:19 +0000 UTC +Dfree: 43 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 16KB diff --git a/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSignedLegacyGroup.golden b/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSignedLegacyGroup.golden new file mode 100644 index 00000000..cac483ea --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Header/TwoGroupsSignedLegacyGroup.golden @@ -0,0 +1,14 @@ +Launch: #!/usr/bin/env run-singularity + +Magic: SIF_MAGIC +Version: 01 +Arch: 386 +ID: 0b19ec2c-0b08-46c9-95ae-fa88cd9e48a1 +Ctime: 2020-05-22 19:30:59 +0000 UTC +Mtime: 2020-06-20 20:16:58 +0000 UTC +Dfree: 44 +Dtotal: 48 +Descoff: 4096 +Descrlen: 27KB +Dataoff: 32768 +Datalen: 12KB diff --git a/internal/app/siftool/testdata/TestApp_Info/One.golden b/internal/app/siftool/testdata/TestApp_Info/One.golden new file mode 100644 index 00000000..e16d9ec9 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Info/One.golden @@ -0,0 +1,16 @@ +Descr slot#: 0 + Datatype: FS + ID: 1 + Used: true + Groupid: 1 + Link: NONE + Fileoff: 32768 + Filelen: 4 + Ctime: 2020-06-30 00:01:56 +0000 UTC + Mtime: 2020-06-30 00:01:56 +0000 UTC + UID: 501 + Gid: 20 + Name: . + Fstype: Raw + Parttype: System + Arch: 386 diff --git a/internal/app/siftool/testdata/TestApp_Info/Three.golden b/internal/app/siftool/testdata/TestApp_Info/Three.golden new file mode 100644 index 00000000..c5fbbf50 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Info/Three.golden @@ -0,0 +1,15 @@ +Descr slot#: 2 + Datatype: Signature + ID: 3 + Used: true + Groupid: NONE + Link: 1 (G) + Fileoff: 40960 + Filelen: 1021 + Ctime: 2020-06-30 00:01:56 +0000 UTC + Mtime: 2020-06-30 00:01:56 +0000 UTC + UID: 501 + Gid: 20 + Name: . + Hashtype: SHA256 + Entity: 12045C8C0B1004D058DE4BEDA20C27EE7FF7BA84 diff --git a/internal/app/siftool/testdata/TestApp_Info/Two.golden b/internal/app/siftool/testdata/TestApp_Info/Two.golden new file mode 100644 index 00000000..1224f658 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_Info/Two.golden @@ -0,0 +1,16 @@ +Descr slot#: 1 + Datatype: FS + ID: 2 + Used: true + Groupid: 1 + Link: NONE + Fileoff: 36864 + Filelen: 4 + Ctime: 2020-06-30 00:01:56 +0000 UTC + Mtime: 2020-06-30 00:01:56 +0000 UTC + UID: 501 + Gid: 20 + Name: . + Fstype: Squashfs + Parttype: *System + Arch: 386 diff --git a/internal/app/siftool/testdata/TestApp_List/Empty.golden b/internal/app/siftool/testdata/TestApp_List/Empty.golden new file mode 100644 index 00000000..6ec5e3b9 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/Empty.golden @@ -0,0 +1,7 @@ +Container id: 3fa802cc-358b-45e3-bcc0-69dc7a45f9f8 +Created on: 2020-05-22 19:30:59 +0000 UTC +Modified on: 2020-05-22 19:30:59 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ diff --git a/internal/app/siftool/testdata/TestApp_List/OneGroup.golden b/internal/app/siftool/testdata/TestApp_List/OneGroup.golden new file mode 100644 index 00000000..ef78088e --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/OneGroup.golden @@ -0,0 +1,9 @@ +Container id: 6ecc76b7-a497-4f7f-9ebd-8da2a04c6be1 +Created on: 2020-05-22 19:30:59 +0000 UTC +Modified on: 2020-05-22 19:30:59 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) diff --git a/internal/app/siftool/testdata/TestApp_List/OneGroupSigned.golden b/internal/app/siftool/testdata/TestApp_List/OneGroupSigned.golden new file mode 100644 index 00000000..c61e4e86 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/OneGroupSigned.golden @@ -0,0 +1,10 @@ +Container id: 73e1c5c3-5c41-41ed-ad7c-2504d669f140 +Created on: 2020-06-30 00:01:56 +0000 UTC +Modified on: 2020-06-30 00:01:56 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) +3 |NONE |1 (G) |40960-41981 |Signature (SHA256) diff --git a/internal/app/siftool/testdata/TestApp_List/OneGroupSignedLegacy.golden b/internal/app/siftool/testdata/TestApp_List/OneGroupSignedLegacy.golden new file mode 100644 index 00000000..36015e5a --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/OneGroupSignedLegacy.golden @@ -0,0 +1,10 @@ +Container id: 6ecc76b7-a497-4f7f-9ebd-8da2a04c6be1 +Created on: 2020-05-22 19:30:59 +0000 UTC +Modified on: 2020-06-20 20:16:39 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) +3 |1 |2 |40960-41569 |Signature (SHA384) diff --git a/internal/app/siftool/testdata/TestApp_List/OneGroupSignedLegacyAll.golden b/internal/app/siftool/testdata/TestApp_List/OneGroupSignedLegacyAll.golden new file mode 100644 index 00000000..716ab967 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/OneGroupSignedLegacyAll.golden @@ -0,0 +1,11 @@ +Container id: 6ecc76b7-a497-4f7f-9ebd-8da2a04c6be1 +Created on: 2020-05-22 19:30:59 +0000 UTC +Modified on: 2020-06-20 20:17:15 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) +3 |1 |1 |40960-41569 |Signature (SHA384) +4 |1 |2 |45056-45665 |Signature (SHA384) diff --git a/internal/app/siftool/testdata/TestApp_List/OneGroupSignedLegacyGroup.golden b/internal/app/siftool/testdata/TestApp_List/OneGroupSignedLegacyGroup.golden new file mode 100644 index 00000000..ef9b1f80 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/OneGroupSignedLegacyGroup.golden @@ -0,0 +1,10 @@ +Container id: 6ecc76b7-a497-4f7f-9ebd-8da2a04c6be1 +Created on: 2020-05-22 19:30:59 +0000 UTC +Modified on: 2020-06-20 20:16:55 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) +3 |NONE |1 (G) |40960-41569 |Signature (SHA384) diff --git a/internal/app/siftool/testdata/TestApp_List/TwoGroups.golden b/internal/app/siftool/testdata/TestApp_List/TwoGroups.golden new file mode 100644 index 00000000..92809f4d --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/TwoGroups.golden @@ -0,0 +1,10 @@ +Container id: 0b19ec2c-0b08-46c9-95ae-fa88cd9e48a1 +Created on: 2020-05-22 19:30:59 +0000 UTC +Modified on: 2020-05-22 19:30:59 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) +3 |2 |NONE |40960-40964 |FS (Ext3/System/amd64) diff --git a/internal/app/siftool/testdata/TestApp_List/TwoGroupsSigned.golden b/internal/app/siftool/testdata/TestApp_List/TwoGroupsSigned.golden new file mode 100644 index 00000000..8faa8697 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/TwoGroupsSigned.golden @@ -0,0 +1,12 @@ +Container id: 610cf3a3-18b0-4622-8b08-772d3510d7b5 +Created on: 2020-06-30 00:01:56 +0000 UTC +Modified on: 2020-06-30 00:01:56 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) +3 |2 |NONE |40960-40964 |FS (Ext3/System/amd64) +4 |NONE |1 (G) |45056-46077 |Signature (SHA256) +5 |NONE |2 (G) |49152-49974 |Signature (SHA256) diff --git a/internal/app/siftool/testdata/TestApp_List/TwoGroupsSignedLegacy.golden b/internal/app/siftool/testdata/TestApp_List/TwoGroupsSignedLegacy.golden new file mode 100644 index 00000000..3a613fc9 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/TwoGroupsSignedLegacy.golden @@ -0,0 +1,11 @@ +Container id: 0b19ec2c-0b08-46c9-95ae-fa88cd9e48a1 +Created on: 2020-05-22 19:30:59 +0000 UTC +Modified on: 2020-06-20 20:16:44 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) +3 |2 |NONE |40960-40964 |FS (Ext3/System/amd64) +4 |1 |2 |45056-45665 |Signature (SHA384) diff --git a/internal/app/siftool/testdata/TestApp_List/TwoGroupsSignedLegacyAll.golden b/internal/app/siftool/testdata/TestApp_List/TwoGroupsSignedLegacyAll.golden new file mode 100644 index 00000000..26f55016 --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/TwoGroupsSignedLegacyAll.golden @@ -0,0 +1,12 @@ +Container id: 0b19ec2c-0b08-46c9-95ae-fa88cd9e48a1 +Created on: 2020-05-22 19:30:59 +0000 UTC +Modified on: 2020-06-20 20:17:19 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) +3 |2 |NONE |40960-40964 |FS (Ext3/System/amd64) +4 |1 |1 |45056-45665 |Signature (SHA384) +5 |1 |2 |49152-49761 |Signature (SHA384) diff --git a/internal/app/siftool/testdata/TestApp_List/TwoGroupsSignedLegacyGroup.golden b/internal/app/siftool/testdata/TestApp_List/TwoGroupsSignedLegacyGroup.golden new file mode 100644 index 00000000..d2f3795b --- /dev/null +++ b/internal/app/siftool/testdata/TestApp_List/TwoGroupsSignedLegacyGroup.golden @@ -0,0 +1,11 @@ +Container id: 0b19ec2c-0b08-46c9-95ae-fa88cd9e48a1 +Created on: 2020-05-22 19:30:59 +0000 UTC +Modified on: 2020-06-20 20:16:58 +0000 UTC +---------------------------------------------------- +Descriptor list: +ID |GROUP |LINK |SIF POSITION (start-end) |TYPE +------------------------------------------------------------------------------ +1 |1 |NONE |32768-32772 |FS (Raw/System/386) +2 |1 |NONE |36864-36868 |FS (Squashfs/*System/386) +3 |2 |NONE |40960-40964 |FS (Ext3/System/amd64) +4 |NONE |1 (G) |45056-45665 |Signature (SHA384)