tests: Fix color value test for big/low endian

On big endian the byte ordering is reverse, and so should be the
uint32_t test value.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
macos/master
Gert Wollny 5 years ago committed by Gert Wollny
parent 08820cb0fb
commit 5b3ad5c515
  1. 16
      tests/test_virgl_cmd.c

@ -67,6 +67,12 @@ START_TEST(virgl_test_overlap_obj_id)
} }
END_TEST END_TEST
#ifdef PIPE_ARCH_LITTLE_ENDIAN
static const uint32_t test_green = 0xff00ff00;
#else
static const uint32_t test_green = 0x00ff00ff;
#endif
/* create a resource - clear it to a color, do a transfer */ /* create a resource - clear it to a color, do a transfer */
START_TEST(virgl_test_clear) START_TEST(virgl_test_clear)
{ {
@ -127,7 +133,7 @@ START_TEST(virgl_test_clear)
/* check the returned values */ /* check the returned values */
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
uint32_t *ptr = res.iovs[0].iov_base; uint32_t *ptr = res.iovs[0].iov_base;
ck_assert_int_eq(ptr[i], 0xff00ff00); ck_assert_int_eq(ptr[i], test_green);
} }
/* cleanup */ /* cleanup */
@ -216,7 +222,7 @@ START_TEST(virgl_test_blit_simple)
/* check the returned values */ /* check the returned values */
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
uint32_t *ptr = res2.iovs[0].iov_base; uint32_t *ptr = res2.iovs[0].iov_base;
ck_assert_int_eq(ptr[i], 0xff00ff00); ck_assert_int_eq(ptr[i], test_green);
} }
/* cleanup */ /* cleanup */
@ -460,7 +466,7 @@ START_TEST(virgl_test_render_simple)
uint32_t *ptr = res.iovs[0].iov_base; uint32_t *ptr = res.iovs[0].iov_base;
for (h = 0; h < th; h++) { for (h = 0; h < th; h++) {
for (w = 0; w < tw; w++) { for (w = 0; w < tw; w++) {
if (ptr[h * tw + w] != 0xff00ff00) if (ptr[h * tw + w] != test_green)
all_cleared = false; all_cleared = false;
} }
} }
@ -724,7 +730,7 @@ START_TEST(virgl_test_render_geom_simple)
uint32_t *ptr = res.iovs[0].iov_base; uint32_t *ptr = res.iovs[0].iov_base;
for (h = 0; h < th; h++) { for (h = 0; h < th; h++) {
for (w = 0; w < tw; w++) { for (w = 0; w < tw; w++) {
if (ptr[h * tw + w] != 0xff00ff00) if (ptr[h * tw + w] != test_green)
all_cleared = false; all_cleared = false;
} }
} }
@ -969,7 +975,7 @@ START_TEST(virgl_test_render_xfb)
uint32_t *ptr = res.iovs[0].iov_base; uint32_t *ptr = res.iovs[0].iov_base;
for (h = 0; h < th; h++) { for (h = 0; h < th; h++) {
for (w = 0; w < tw; w++) { for (w = 0; w < tw; w++) {
if (ptr[h * tw + w] != 0xff00ff00) if (ptr[h * tw + w] != test_green)
all_cleared = false; all_cleared = false;
} }
} }

Loading…
Cancel
Save