From 38685b314bc378f01ef6c71554886be3b2fa019f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 4 Feb 2015 13:29:43 +1000 Subject: [PATCH] tests: test flags combinations. --- tests/test_virgl_resource.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/test_virgl_resource.c b/tests/test_virgl_resource.c index ff5f680..1af5480 100644 --- a/tests/test_virgl_resource.c +++ b/tests/test_virgl_resource.c @@ -32,6 +32,7 @@ #include #include #include +#include "virgl_hw.h" #include "testvirgl.h" #include "pipe/p_defines.h" @@ -59,6 +60,20 @@ struct res_test { .flags = 0 }, \ .retval = (tretval)} +#define TEST_F(thandle, ttarget, tformat, tbind, twidth, theight, tdepth, tarray_size, tnr_samples, tflags, tretval) \ + { .args = { .handle = (thandle), \ + .target = (ttarget), \ + .format = (tformat), \ + .bind = (tbind), \ + .width = (twidth), \ + .height = (theight), \ + .depth = (tdepth), \ + .array_size = (tarray_size), \ + .nr_samples = (tnr_samples), \ + .flags = (tflags) }, \ + .retval = (tretval)} + + static struct res_test testlist[] = { /* illegal target - FAIL */ @@ -67,6 +82,17 @@ static struct res_test testlist[] = { /* illegal format - FAIL */ TEST(1, PIPE_BUFFER, PIPE_FORMAT_COUNT + 1, 0, 50, 1, 1, 1, 0, EINVAL), + /* legal flags - PASS */ + TEST_F(1, PIPE_TEXTURE_2D, PIPE_FORMAT_B8G8R8X8_UNORM, PIPE_BIND_SAMPLER_VIEW, 50, 1, 1, 1, 0, VIRGL_RESOURCE_Y_0_TOP, 0), + /* legal flags - PASS */ + TEST_F(1, PIPE_TEXTURE_RECT, PIPE_FORMAT_B8G8R8X8_UNORM, PIPE_BIND_SAMPLER_VIEW, 50, 1, 1, 1, 0, VIRGL_RESOURCE_Y_0_TOP, 0), + /* illegal flags - FAIL */ + TEST_F(1, PIPE_TEXTURE_2D, PIPE_FORMAT_B8G8R8X8_UNORM, PIPE_BIND_SAMPLER_VIEW, 50, 1, 1, 1, 0, 0xF, EINVAL), + /* illegal flags - FAIL */ + TEST_F(1, PIPE_TEXTURE_1D, PIPE_FORMAT_B8G8R8X8_UNORM, PIPE_BIND_SAMPLER_VIEW, 50, 1, 1, 1, 0, VIRGL_RESOURCE_Y_0_TOP, EINVAL), + /* illegal flags - FAIL */ + TEST_F(1, PIPE_TEXTURE_3D, PIPE_FORMAT_B8G8R8X8_UNORM, PIPE_BIND_SAMPLER_VIEW, 50, 1, 1, 1, 0, VIRGL_RESOURCE_Y_0_TOP, EINVAL), + /* buffer test - PASS */ TEST(1, PIPE_BUFFER, PIPE_FORMAT_R8_UNORM, 0, 50, 1, 1, 1, 0, 0), /* buffer test with height - FAIL */