aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encoding_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-08-27 12:04:13 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-11-03 15:02:52 +0000
commit791d18fa26e3c5b62656e16b65aac5b748fcf8fc (patch)
treee8c7f749fcab1269c68d6be9fdd034fdae387a7f /prog/encoding_test.go
parente6c64ba827e8dc077b172b714151ef9e21b6f3ef (diff)
prog: take multiple serialization flags
Refactor Prog.Serialize() to accept a variadic list of flags. For now, two are supported: 1) Verbose (equal to SerializeVerbose()). 2) SkipImages (don't serialize fs images).
Diffstat (limited to 'prog/encoding_test.go')
-rw-r--r--prog/encoding_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/prog/encoding_test.go b/prog/encoding_test.go
index a577c5be5..130740df7 100644
--- a/prog/encoding_test.go
+++ b/prog/encoding_test.go
@@ -12,6 +12,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
)
func setToArray(s map[string]struct{}) []string {
@@ -570,3 +571,15 @@ func TestHasNext(t *testing.T) {
}
}
}
+
+// nolint: lll
+func TestDeserializeSkipImage(t *testing.T) {
+ target := initTargetTest(t, "linux", "amd64")
+ p, err := target.Deserialize([]byte(`
+syz_mount_image$ext4(&(0x7f0000000080)='ext4\x00', &(0x7f00000000c0)='./file0\x00', 0x0, &(0x7f0000000100), 0x1, 0x71, &(0x7f0000000140)="$eJzszrENAVAUBdDrLyASnUIYwA5GESWdiljJDiYwgg0UWs1XfArfABI5J3kvue827/I4Tc6zpA6T2tntD5vVtu3wl0qSUZJxkum85duydYNXf70f1+/59b8AAAAAAAAAwLeSRZ8/Ds8AAAD//9ZiI98=")
+`), Strict)
+ require.NoError(t, err)
+ assert.Equal(t, `syz_mount_image$ext4(&(0x7f0000000080)='ext4\x00', &(0x7f00000000c0)='./file0\x00', 0x0, &(0x7f0000000100), 0x1, 0x71, &(0x7f0000000140)="<<IMAGE>>")
+`,
+ string(p.Serialize(SkipImages)))
+}