Commit 07be8fec authored by Matt Roper's avatar Matt Roper Committed by Daniel Vetter

igt.cocci: Replace igt_assert() with igt_assert_CMP() where possible

The integer comparison macros give us better error output by including
the actual values that failed the comparison.
Signed-off-by: Matt Roper's avatarMatt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@intel.com>
parent 14a3d88a
...@@ -141,3 +141,35 @@ a = drm_open_any(); ...@@ -141,3 +141,35 @@ a = drm_open_any();
- return ...; - return ...;
- } - }
) )
// Use comparison macros instead of raw igt_assert when possible
@@
typedef uint32_t;
uint32_t E1, E2;
int E3, E4;
@@
(
- igt_assert(E1 == E2);
+ igt_assert_eq_u32(E1, E2);
|
- igt_assert(E1 != E2);
+ igt_assert_neq_u32(E1, E2);
|
- igt_assert(E1 <= E2);
+ igt_assert_lte_u32(E1, E2);
|
- igt_assert(E1 < E2);
+ igt_assert_lt_u32(E1, E2);
|
- igt_assert(E3 == E4);
+ igt_assert_eq(E3, E4);
|
- igt_assert(E3 != E4);
+ igt_assert_neq(E3, E4);
|
- igt_assert(E3 <= E4);
+ igt_assert_lte(E3, E4);
|
- igt_assert(E3 < E4);
+ igt_assert_lt(E3, E4);
)
...@@ -79,14 +79,15 @@ static void test_sysfs_error_exists(void) ...@@ -79,14 +79,15 @@ static void test_sysfs_error_exists(void)
{ {
char tmp[1024]; char tmp[1024];
igt_assert(read_sysfs(tmp, sizeof(tmp), "error") > 0); igt_assert_lt(0, read_sysfs(tmp, sizeof(tmp), "error"));
} }
static void test_debugfs_error_state_exists(void) static void test_debugfs_error_state_exists(void)
{ {
int fd; int fd;
igt_assert((fd = igt_debugfs_open("i915_error_state", O_RDONLY)) >= 0); igt_assert_lte(0,
(fd = igt_debugfs_open("i915_error_state", O_RDONLY)));
close (fd); close (fd);
} }
...@@ -95,7 +96,7 @@ static void test_debugfs_ring_stop_exists(void) ...@@ -95,7 +96,7 @@ static void test_debugfs_ring_stop_exists(void)
{ {
int fd; int fd;
igt_assert((fd = igt_debugfs_open("i915_ring_stop", O_RDONLY)) >= 0); igt_assert_lte(0, (fd = igt_debugfs_open("i915_ring_stop", O_RDONLY)));
close(fd); close(fd);
} }
...@@ -105,10 +106,10 @@ static void read_dfs(const char *fname, char *d, int maxlen) ...@@ -105,10 +106,10 @@ static void read_dfs(const char *fname, char *d, int maxlen)
int fd; int fd;
int l; int l;
igt_assert((fd = igt_debugfs_open(fname, O_RDONLY)) >= 0); igt_assert_lte(0, (fd = igt_debugfs_open(fname, O_RDONLY)));
igt_assert((l = read(fd, d, maxlen-1)) > 0); igt_assert_lt(0, (l = read(fd, d, maxlen - 1)));
igt_assert(l < maxlen); igt_assert_lt(l, maxlen);
d[l] = 0; d[l] = 0;
close(fd); close(fd);
...@@ -210,7 +211,8 @@ static void clear_error_state(void) ...@@ -210,7 +211,8 @@ static void clear_error_state(void)
int fd; int fd;
const char *b = "1"; const char *b = "1";
igt_assert((fd = igt_debugfs_open("i915_error_state", O_WRONLY)) >= 0); igt_assert_lte(0,
(fd = igt_debugfs_open("i915_error_state", O_WRONLY)));
igt_assert(write(fd, b, 1) == 1); igt_assert(write(fd, b, 1) == 1);
close(fd); close(fd);
} }
...@@ -244,7 +246,7 @@ static void check_error_state(const int gen, ...@@ -244,7 +246,7 @@ static void check_error_state(const int gen,
bool bb_ok = false, req_ok = false, ringbuf_ok = false; bool bb_ok = false, req_ok = false, ringbuf_ok = false;
debug_fd = igt_debugfs_open("i915_error_state", O_RDONLY); debug_fd = igt_debugfs_open("i915_error_state", O_RDONLY);
igt_assert(debug_fd >= 0); igt_assert_lte(0, debug_fd);
file = fdopen(debug_fd, "r"); file = fdopen(debug_fd, "r");
while (getline(&line, &line_size, file) > 0) { while (getline(&line, &line_size, file) > 0) {
...@@ -287,7 +289,7 @@ static void check_error_state(const int gen, ...@@ -287,7 +289,7 @@ static void check_error_state(const int gen,
req_matched = sscanf(dashes, "--- %d requests\n", &requests); req_matched = sscanf(dashes, "--- %d requests\n", &requests);
if (req_matched == 1) { if (req_matched == 1) {
igt_assert(strstr(ring_name, expected_ring_name)); igt_assert(strstr(ring_name, expected_ring_name));
igt_assert(requests > 0); igt_assert_lt(0, requests);
for (i = 0; i < requests; i++) { for (i = 0; i < requests; i++) {
uint32_t seqno; uint32_t seqno;
...@@ -296,7 +298,7 @@ static void check_error_state(const int gen, ...@@ -296,7 +298,7 @@ static void check_error_state(const int gen,
igt_assert(getline(&line, &line_size, file) > 0); igt_assert(getline(&line, &line_size, file) > 0);
items = sscanf(line, " seqno 0x%08x, emitted %ld, tail 0x%08x\n", items = sscanf(line, " seqno 0x%08x, emitted %ld, tail 0x%08x\n",
&seqno, &jiffies, &tail); &seqno, &jiffies, &tail);
igt_assert(items == 3); igt_assert_eq(items, 3);
} }
req_ok = true; req_ok = true;
continue; continue;
...@@ -315,12 +317,12 @@ static void check_error_state(const int gen, ...@@ -315,12 +317,12 @@ static void check_error_state(const int gen,
igt_assert(getline(&line, &line_size, file) > 0); igt_assert(getline(&line, &line_size, file) > 0);
items = sscanf(line, "%08x : %08x\n", items = sscanf(line, "%08x : %08x\n",
&offset, &command); &offset, &command);
igt_assert(items == 2); igt_assert_eq(items, 2);
if ((command & 0x1F800000) == MI_BATCH_BUFFER_START) { if ((command & 0x1F800000) == MI_BATCH_BUFFER_START) {
igt_assert(getline(&line, &line_size, file) > 0); igt_assert(getline(&line, &line_size, file) > 0);
items = sscanf(line, "%08x : %08x\n", items = sscanf(line, "%08x : %08x\n",
&offset, &expected_addr); &offset, &expected_addr);
igt_assert(items == 2); igt_assert_eq(items, 2);
i++; i++;
} }
} }
......
...@@ -165,7 +165,7 @@ test_forcewake(bool hibernate) ...@@ -165,7 +165,7 @@ test_forcewake(bool hibernate)
int fw_fd; int fw_fd;
fw_fd = igt_open_forcewake_handle(); fw_fd = igt_open_forcewake_handle();
igt_assert(fw_fd >= 0); igt_assert_lte(0, fw_fd);
if (hibernate) if (hibernate)
igt_system_hibernate_autoresume(); igt_system_hibernate_autoresume();
......
...@@ -89,7 +89,7 @@ static int minor_evictions(int fd, struct igt_eviction_test_ops *ops, ...@@ -89,7 +89,7 @@ static int minor_evictions(int fd, struct igt_eviction_test_ops *ops,
for (n = 0; n < nr_surfaces; n++, m += 7) for (n = 0; n < nr_surfaces; n++, m += 7)
sel[n] = bo[m%total_surfaces]; sel[n] = bo[m%total_surfaces];
ret = ops->copy(fd, sel[0], sel[1], sel, nr_surfaces); ret = ops->copy(fd, sel[0], sel[1], sel, nr_surfaces);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
} }
ret = ops->copy(fd, bo[0], bo[0], bo, total_surfaces); ret = ops->copy(fd, bo[0], bo[0], bo, total_surfaces);
igt_assert(ret == ENOSPC); igt_assert(ret == ENOSPC);
...@@ -120,7 +120,7 @@ static int major_evictions(int fd, struct igt_eviction_test_ops *ops, ...@@ -120,7 +120,7 @@ static int major_evictions(int fd, struct igt_eviction_test_ops *ops,
for (loop = 0, m = 0; loop < 100; loop++, m += 17) { for (loop = 0, m = 0; loop < 100; loop++, m += 17) {
n = m % nr_surfaces; n = m % nr_surfaces;
ret = ops->copy(fd, bo[n], bo[n], &bo[n], 1); ret = ops->copy(fd, bo[n], bo[n], &bo[n], 1);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
} }
for (n = 0; n < nr_surfaces; n++) for (n = 0; n < nr_surfaces; n++)
...@@ -156,7 +156,7 @@ static int swapping_evictions(int fd, struct igt_eviction_test_ops *ops, ...@@ -156,7 +156,7 @@ static int swapping_evictions(int fd, struct igt_eviction_test_ops *ops,
for (pass = 0; pass < 100; pass++) { for (pass = 0; pass < 100; pass++) {
ret = ops->copy(fd, bo[0], bo[1], bo, working_surfaces); ret = ops->copy(fd, bo[0], bo[1], bo, working_surfaces);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
} }
} }
...@@ -186,7 +186,7 @@ static int forking_evictions(int fd, struct igt_eviction_test_ops *ops, ...@@ -186,7 +186,7 @@ static int forking_evictions(int fd, struct igt_eviction_test_ops *ops,
} else } else
bo_count = working_surfaces; bo_count = working_surfaces;
igt_assert(working_surfaces <= bo_count); igt_assert_lte(working_surfaces, bo_count);
intel_require_memory(bo_count, surface_size, CHECK_RAM | CHECK_SWAP); intel_require_memory(bo_count, surface_size, CHECK_RAM | CHECK_SWAP);
bo = malloc(bo_count*sizeof(*bo)); bo = malloc(bo_count*sizeof(*bo));
...@@ -223,7 +223,7 @@ static int forking_evictions(int fd, struct igt_eviction_test_ops *ops, ...@@ -223,7 +223,7 @@ static int forking_evictions(int fd, struct igt_eviction_test_ops *ops,
for (pass = 0; pass < num_passes; pass++) { for (pass = 0; pass < num_passes; pass++) {
ret = ops->copy(realfd, bo[0], bo[1], bo, working_surfaces); ret = ops->copy(realfd, bo[0], bo[1], bo, working_surfaces);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
for (l = 0; l < working_surfaces && for (l = 0; l < working_surfaces &&
(flags & FORKING_EVICTIONS_MEMORY_PRESSURE); (flags & FORKING_EVICTIONS_MEMORY_PRESSURE);
......
...@@ -140,7 +140,7 @@ static void run(int child) ...@@ -140,7 +140,7 @@ static void run(int child)
int fd; int fd;
fd = open(device, O_RDWR); fd = open(device, O_RDWR);
igt_assert(fd != -1); igt_assert_neq(fd, -1);
handle = load(fd); handle = load(fd);
if ((child & 63) == 63) if ((child & 63) == 63)
......
...@@ -90,7 +90,7 @@ static void exec(int fd, uint32_t handle) ...@@ -90,7 +90,7 @@ static void exec(int fd, uint32_t handle)
DRM_IOCTL_I915_GEM_EXECBUFFER2, DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf); &execbuf);
gem_sync(fd, handle); gem_sync(fd, handle);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
} }
igt_simple_main igt_simple_main
......
...@@ -130,7 +130,8 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name) ...@@ -130,7 +130,8 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)
gem_close(fd, handle); gem_close(fd, handle);
} }
igt_assert(exec(fd, handle_new, split, &gtt_offset_new, 0) == 0); igt_assert_eq(exec(fd, handle_new, split, &gtt_offset_new, 0),
0);
if (split > 0) { if (split > 0) {
/* Check that we've managed to collide in the tlb. */ /* Check that we've managed to collide in the tlb. */
......
...@@ -85,7 +85,7 @@ static void *work(void *arg) ...@@ -85,7 +85,7 @@ static void *work(void *arg)
else else
td_fd = fd; td_fd = fd;
igt_assert(td_fd >= 0); igt_assert_lte(0, td_fd);
bufmgr = drm_intel_bufmgr_gem_init(td_fd, 4096); bufmgr = drm_intel_bufmgr_gem_init(td_fd, 4096);
batch = intel_batchbuffer_alloc(bufmgr, devid); batch = intel_batchbuffer_alloc(bufmgr, devid);
...@@ -105,7 +105,7 @@ static void *work(void *arg) ...@@ -105,7 +105,7 @@ static void *work(void *arg)
} else { } else {
int ret; int ret;
ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer); ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
intel_batchbuffer_flush_with_context(batch, context); intel_batchbuffer_flush_with_context(batch, context);
} }
} }
......
...@@ -127,7 +127,7 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo, int alignme ...@@ -127,7 +127,7 @@ copy(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int n_bo, int alignme
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
if (ret) if (ret)
ret = errno; ret = errno;
igt_assert(ret == error); igt_assert_eq(ret, error);
gem_close(fd, handle); gem_close(fd, handle);
free(obj); free(obj);
......
...@@ -75,7 +75,7 @@ run_batch(void) ...@@ -75,7 +75,7 @@ run_batch(void)
used = batch->ptr - batch->buffer; used = batch->ptr - batch->buffer;
ret = drm_intel_bo_subdata(batch->bo, 0, used, batch->buffer); ret = drm_intel_bo_subdata(batch->bo, 0, used, batch->buffer);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
batch->ptr = NULL; batch->ptr = NULL;
......
...@@ -60,7 +60,7 @@ static int gem_linear_blt(int fd, ...@@ -60,7 +60,7 @@ static int gem_linear_blt(int fd,
uint32_t *b = batch; uint32_t *b = batch;
int height = length / (16 * 1024); int height = length / (16 * 1024);
igt_assert(height <= 1<<16); igt_assert_lte(height, 1 << 16);
if (height) { if (height) {
int i = 0; int i = 0;
...@@ -180,7 +180,7 @@ static uint32_t dumb_create(int fd) ...@@ -180,7 +180,7 @@ static uint32_t dumb_create(int fd)
arg.height = 32; arg.height = 32;
ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg); ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
igt_assert(arg.size >= 4096); igt_assert(arg.size >= 4096);
return arg.handle; return arg.handle;
......
...@@ -70,7 +70,7 @@ static int gem_linear_blt(uint32_t *batch, ...@@ -70,7 +70,7 @@ static int gem_linear_blt(uint32_t *batch,
uint32_t *b = batch; uint32_t *b = batch;
int height = length / (16 * 1024); int height = length / (16 * 1024);
igt_assert(height <= 1<<16); igt_assert_lte(height, 1 << 16);
if (height) { if (height) {
int i = 0; int i = 0;
......
...@@ -97,7 +97,7 @@ static void loop(int fd, uint32_t handle, unsigned ring_id, const char *ring_nam ...@@ -97,7 +97,7 @@ static void loop(int fd, uint32_t handle, unsigned ring_id, const char *ring_nam
struct timeval start, end; struct timeval start, end;
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
igt_assert(exec(fd, handle, count, ring_id) == 0); igt_assert_eq(exec(fd, handle, count, ring_id), 0);
gettimeofday(&end, NULL); gettimeofday(&end, NULL);
igt_info("Time to exec x %d: %7.3fµs (ring=%s)\n", igt_info("Time to exec x %d: %7.3fµs (ring=%s)\n",
count, elapsed(&start, &end, count), ring_name); count, elapsed(&start, &end, count), ring_name);
......
...@@ -114,7 +114,7 @@ _bo_write_verify(struct test *t) ...@@ -114,7 +114,7 @@ _bo_write_verify(struct test *t)
const char *tile_str[] = { "none", "x", "y" }; const char *tile_str[] = { "none", "x", "y" };
igt_assert(t->tiling >= 0 && t->tiling <= I915_TILING_Y); igt_assert(t->tiling >= 0 && t->tiling <= I915_TILING_Y);
igt_assert(t->num_surfaces > 0); igt_assert_lt(0, t->num_surfaces);
s = calloc(sizeof(*s), t->num_surfaces); s = calloc(sizeof(*s), t->num_surfaces);
igt_assert(s); igt_assert(s);
...@@ -171,7 +171,7 @@ static int run_test(int threads_per_fence, void *f, int tiling, ...@@ -171,7 +171,7 @@ static int run_test(int threads_per_fence, void *f, int tiling,
t.num_surfaces = surfaces_per_thread; t.num_surfaces = surfaces_per_thread;
num_fences = gem_available_fences(t.fd); num_fences = gem_available_fences(t.fd);
igt_assert(num_fences > 0); igt_assert_lt(0, num_fences);
num_threads = threads_per_fence * num_fences; num_threads = threads_per_fence * num_fences;
......
...@@ -50,15 +50,15 @@ test_flink(int fd) ...@@ -50,15 +50,15 @@ test_flink(int fd)
memset(&create, 0, sizeof(create)); memset(&create, 0, sizeof(create));
create.size = 16 * 1024; create.size = 16 * 1024;
ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
flink.handle = create.handle; flink.handle = create.handle;
ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
open_struct.name = flink.name; open_struct.name = flink.name;
ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
igt_assert(open_struct.handle != 0); igt_assert(open_struct.handle != 0);
} }
...@@ -75,15 +75,15 @@ test_double_flink(int fd) ...@@ -75,15 +75,15 @@ test_double_flink(int fd)
memset(&create, 0, sizeof(create)); memset(&create, 0, sizeof(create));
create.size = 16 * 1024; create.size = 16 * 1024;
ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
flink.handle = create.handle; flink.handle = create.handle;
ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
flink2.handle = create.handle; flink2.handle = create.handle;
ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink2); ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink2);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
igt_assert(flink2.name == flink.name); igt_assert(flink2.name == flink.name);
} }
...@@ -129,15 +129,15 @@ test_flink_lifetime(int fd) ...@@ -129,15 +129,15 @@ test_flink_lifetime(int fd)
memset(&create, 0, sizeof(create)); memset(&create, 0, sizeof(create));
create.size = 16 * 1024; create.size = 16 * 1024;
ret = ioctl(fd2, DRM_IOCTL_I915_GEM_CREATE, &create); ret = ioctl(fd2, DRM_IOCTL_I915_GEM_CREATE, &create);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
flink.handle = create.handle; flink.handle = create.handle;
ret = ioctl(fd2, DRM_IOCTL_GEM_FLINK, &flink); ret = ioctl(fd2, DRM_IOCTL_GEM_FLINK, &flink);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
open_struct.name = flink.name; open_struct.name = flink.name;
ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
igt_assert(open_struct.handle != 0); igt_assert(open_struct.handle != 0);
close(fd2); close(fd2);
...@@ -145,7 +145,7 @@ test_flink_lifetime(int fd) ...@@ -145,7 +145,7 @@ test_flink_lifetime(int fd)
open_struct.name = flink.name; open_struct.name = flink.name;
ret = ioctl(fd2, DRM_IOCTL_GEM_OPEN, &open_struct); ret = ioctl(fd2, DRM_IOCTL_GEM_OPEN, &open_struct);
igt_assert(ret == 0); igt_assert_eq(ret, 0);
igt_assert(open_struct.handle != 0); igt_assert(open_struct.handle != 0);
} }
......
...@@ -61,7 +61,7 @@ static int get_object_count(void) ...@@ -61,7 +61,7 @@ static int get_object_count(void)
file = igt_debugfs_fopen("i915_gem_objects", "r"); file = igt_debugfs_fopen("i915_gem_objects", "r");
scanned = fscanf(file, "%i objects", &ret); scanned = fscanf(file, "%i objects", &ret);
igt_assert(scanned == 1); igt_assert_eq(scanned, 1);
return ret; return ret;
} }
...@@ -107,7 +107,7 @@ static void test_flink_name(void) ...@@ -107,7 +107,7 @@ static void test_flink_name(void)
for (i = 0; i < num_threads; i++) { for (i = 0; i < num_threads; i++) {
r = pthread_create(&threads[i], NULL, r = pthread_create(&threads[i], NULL,
thread_fn_flink_name, NULL); thread_fn_flink_name, NULL);
igt_assert(r == 0); igt_assert_eq(r, 0);
} }
for (i = 0; i < 1000000; i++) { for (i = 0; i < 1000000; i++) {
...@@ -176,7 +176,7 @@ static void test_flink_close(void) ...@@ -176,7 +176,7 @@ static void test_flink_close(void)
for (i = 0; i < num_threads; i++) { for (i = 0; i < num_threads; i++) {
r = pthread_create(&threads[i], NULL, r = pthread_create(&threads[i], NULL,
thread_fn_flink_close, NULL); thread_fn_flink_close, NULL);
igt_assert(r == 0); igt_assert_eq(r, 0);
} }
sleep(5); sleep(5);
...@@ -196,7 +196,7 @@ static void test_flink_close(void) ...@@ -196,7 +196,7 @@ static void test_flink_close(void)
close(fake); close(fake);
igt_assert(obj_count == 0); igt_assert_eq(obj_count, 0);
} }
igt_main igt_main
......
...@@ -149,7 +149,7 @@ static void run(data_t *data, int child) ...@@ -149,7 +149,7 @@ static void run(data_t *data, int child)
x = ptr[rand() % (size / 4)]; x = ptr[rand() % (size / 4)];
munmap(ptr, size); munmap(ptr, size);
igt_assert(x == canary); igt_assert_eq_u32(x, canary);
} }
igt_simple_main igt_simple_main
......
...@@ -153,7 +153,7 @@ copy(int fd, uint32_t dst, uint32_t src) ...@@ -153,7 +153,7 @@ copy(int fd, uint32_t dst, uint32_t src)
drmCommandNone(fd, DRM_I915_GEM_THROTTLE); drmCommandNone(fd, DRM_I915_GEM_THROTTLE);
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec);
} }
igt_assert(ret == 0); igt_assert_eq(ret, 0);
gem_close(fd, handle); gem_close(fd, handle);
} }
......
...@@ -105,7 +105,7 @@ static drm_intel_bo *create_special_bo(void) ...@@ -105,7 +105,7 @@ static drm_intel_bo *create_special_bo(void)
BATCH(CMD_POLY_STIPPLE_OFFSET << 16); BATCH(CMD_POLY_STIPPLE_OFFSET << 16);
BATCH(0); BATCH(0);
} }
igt_assert(len % 2 == 0); igt_assert_eq(len % 2, 0);
BATCH(MI_NOOP); BATCH(MI_NOOP);
BATCH(MI_BATCH_BUFFER_END); BATCH(MI_BATCH_BUFFER_END);
......
...@@ -100,7 +100,7 @@ static void create_special_bo(void) ...@@ -100,7 +100,7 @@ static void create_special_bo(void)
BATCH(CMD_POLY_STIPPLE_OFFSET << 16); BATCH(CMD_POLY_STIPPLE_OFFSET << 16);
BATCH(0); BATCH(0);
} }
igt_assert(len % 2 == 0); igt_assert_eq(len % 2, 0);
BATCH(MI_NOOP); BATCH(MI_NOOP);
BATCH(MI_BATCH_BUFFER_END); BATCH(MI_BATCH_BUFFER_END);
......
...@@ -243,7 +243,7 @@ static int inject_hang_ring(int fd, int ctx, int ring, bool ignore_ban_error) ...@@ -243,7 +243,7 @@ static int inject_hang_ring(int fd, int ctx, int ring, bool ignore_ban_error)
i915_execbuffer2_set_context_id(execbuf, ctx); i915_execbuffer2_set_context_id(execbuf, ctx);
execbuf.rsvd2 = 0; execbuf.rsvd2 = 0;
igt_assert(gem_exec(fd, &execbuf) == 0); igt_assert_eq(gem_exec(fd, &execbuf), 0);
gtt_off = exec.offset; gtt_off = exec.offset;
...@@ -284,7 +284,7 @@ static int inject_hang_ring(int fd, int ctx, int ring, bool ignore_ban_error) ...@@ -284,7 +284,7 @@ static int inject_hang_ring(int fd, int ctx, int ring, bool ignore_ban_error)
i915_execbuffer2_set_context_id(execbuf, ctx); i915_execbuffer2_set_context_id(execbuf, ctx);
execbuf.rsvd2 = 0; execbuf.rsvd2 = 0;
igt_assert(gem_exec(fd, &execbuf) == 0); igt_assert_eq(gem_exec(fd, &execbuf), 0);
igt_assert(gtt_off == exec.offset); igt_assert(gtt_off == exec.offset);
...@@ -342,8 +342,8 @@ static void test_rs(int num_fds, int hang_index, int rs_assumed_no_hang) ...@@ -342,8 +342,8 @@ static void test_rs(int num_fds, int hang_index, int rs_assumed_no_hang)
int fd[MAX_FD]; int fd[MAX_FD];
int h[MAX_FD]; int h[MAX_FD];
igt_assert (num_fds <= MAX_FD); igt_assert_lte(num_fds, MAX_FD);
igt_assert (hang_index < MAX_FD); igt_assert_lt(hang_index, MAX_FD);
for (i = 0; i < num_fds; i++) { for (i = 0; i < num_fds; i++) {
fd[i] = drm_open_any(); fd[i] = drm_open_any();
...@@ -391,11 +391,11 @@ static void test_rs_ctx(int num_fds, int num_ctx, int hang_index, ...@@ -391,11 +391,11 @@ static void test_rs_ctx(int num_fds, int num_ctx, int hang_index,
int h[MAX_FD][MAX_CTX]; int h[MAX_FD][MAX_CTX];
int ctx[MAX_FD][MAX_CTX]; int ctx[MAX_FD][MAX_CTX];
igt_assert (num_fds <= MAX_FD); igt_assert_lte(num_fds, MAX_FD);
igt_assert (hang_index < MAX_FD); igt_assert_lt(hang_index, MAX_FD);
igt_assert (num_ctx <= MAX_CTX); igt_assert_lte(num_ctx, MAX_CTX);
igt_assert (hang_context