mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2025-12-26 14:18:36 +00:00
To use for start for the fuzzer.
Tests have been generated with a patch like:
diff --git a/tests/test-quic.c b/tests/test-quic.c
--- a/tests/test-quic.c
+++ b/tests/test-quic.c
@@ -372,8 +372,8 @@ static void pixbuf_compare(GdkPixbuf *pixbuf_a, GdkPixbuf *pixbuf_b)
static GdkPixbuf *pixbuf_new_random(int alpha)
{
gboolean has_alpha = alpha >= 0 ? alpha : g_random_boolean();
- gint width = g_random_int_range(100, 2000);
- gint height = g_random_int_range(100, 500);
+ gint width = g_random_int_range(10, 100);
+ gint height = g_random_int_range(10, 100);
GdkPixbuf *random_pixbuf;
guint i, size;
guint8 *pixels;
@@ -401,6 +401,12 @@ static void test_pixbuf(GdkPixbuf *pixbuf)
compressed_data = quic_encode_from_pixbuf(pixbuf, imgbuf);
uncompressed_pixbuf = quic_decode_to_pixbuf(compressed_data);
+ {
+ static int num = 0;
+ char fn[256];
+ sprintf(fn, "test%d.quic", ++num);
+ g_assert(g_file_set_contents(fn, (void *) compressed_data->data, compressed_data->len, NULL));
+ }
image_buf_free(imgbuf, uncompressed_pixbuf);
//g_assert(memcmp(gdk_pixbuf_get_pixels(pixbuf), gdk_pixbuf_get_pixels(uncompressed_pixbuf), gdk_pixbuf_get_byte_length(uncompressed_pixbuf)));
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
|
||
|---|---|---|
| .. | ||
| fuzzer-quic-testcases | ||
| helper-fuzzer-demarshallers.c | ||
| Makefile.am | ||
| meson.build | ||
| test-dummy-recorder.c | ||
| test-logging.c | ||
| test-marshallers.c | ||
| test-marshallers.h | ||
| test-marshallers.proto | ||
| test-quic.c | ||
| test-region.c | ||
| test-ssl-verify.c | ||
| test-utils.c | ||