diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-12-17 11:59:24 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-12-22 10:11:08 +0100 |
| commit | 8482d3c1035095c89d112c75bfcc2e4095b486bf (patch) | |
| tree | f2cc2b32e55fd61cbcd03d1b27693fe7c972f07b /pkg/ipc | |
| parent | 412eecf40d514f89060844dc8631f60b80d7bfd2 (diff) | |
pkg/image: factor out from prog
Move image compression-related function to a separate package.
In preperation for subsequent changes that make decompression
more complex. Prog package is already large and complex.
Also makes running compression tests/benchmarks much faster.
Diffstat (limited to 'pkg/ipc')
| -rw-r--r-- | pkg/ipc/ipc_test.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/ipc/ipc_test.go b/pkg/ipc/ipc_test.go index c1d3af69a..a3ab140f1 100644 --- a/pkg/ipc/ipc_test.go +++ b/pkg/ipc/ipc_test.go @@ -13,6 +13,7 @@ import ( "time" "github.com/google/syzkaller/pkg/csource" + "github.com/google/syzkaller/pkg/image" . "github.com/google/syzkaller/pkg/ipc" "github.com/google/syzkaller/pkg/ipc/ipcconfig" "github.com/google/syzkaller/pkg/osutil" @@ -210,9 +211,9 @@ func TestZlib(t *testing.T) { r := rand.New(testutil.RandSource(t)) for i := 0; i < 10; i++ { data := testutil.RandMountImage(r) - compressed := prog.Compress(data) + compressed := image.Compress(data) text := fmt.Sprintf(`syz_compare_zlib(&(0x7f0000000000)="$%s", AUTO, &(0x7f0000800000)="$%s", AUTO)`, - prog.EncodeB64(data), prog.EncodeB64(compressed)) + image.EncodeB64(data), image.EncodeB64(compressed)) p, err := target.Deserialize([]byte(text), prog.Strict) if err != nil { t.Fatalf("failed to deserialize empty program: %v", err) |
