From 791d18fa26e3c5b62656e16b65aac5b748fcf8fc Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 27 Aug 2025 12:04:13 +0200 Subject: 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). --- prog/encoding_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'prog/encoding_test.go') 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)="<>") +`, + string(p.Serialize(SkipImages))) +} -- cgit mrf-deployment