tests|lib: remove assert.h includes

Only the igt core and non-test tools should have asserts to catch
internal errors, tests and helper libraries should all user igt_asert
instead.

Fix things up where assert instead of igt_assert was used.

One tiny step towards header sanity.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter
2014-03-22 19:27:04 +01:00
parent bff22f7317
commit 0e22f14ed6
22 changed files with 47 additions and 61 deletions
+1 -1
View File
@@ -396,7 +396,7 @@ void igt_init_aperture_trashers(drm_intel_bufmgr *bufmgr)
num_trash_bos = gem_mappable_aperture_size() / (1024*1024);
trash_bos = malloc(num_trash_bos * sizeof(drm_intel_bo *));
assert(trash_bos);
igt_assert(trash_bos);
for (i = 0; i < num_trash_bos; i++)
trash_bos[i] = drm_intel_bo_alloc(bufmgr, "trash bo", 1024*1024, 4096);
-1
View File
@@ -31,7 +31,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
#include <setjmp.h>
+1
View File
@@ -32,6 +32,7 @@
#include <libgen.h>
#endif
#include <stdio.h>
#include <assert.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+3 -3
View File
@@ -146,7 +146,7 @@ int kmstest_cairo_printf_line(cairo_t *cr, enum kmstest_text_align align,
va_start(ap, fmt);
ret = vasprintf(&text, fmt, ap);
assert(ret >= 0);
igt_assert(ret >= 0);
va_end(ap);
cairo_text_extents(cr, text, &extents);
@@ -221,7 +221,7 @@ void kmstest_paint_test_pattern(cairo_t *cr, int width, int height)
paint_marker(cr, 0, height);
paint_marker(cr, width, height);
assert(!cairo_status(cr));
igt_assert(!cairo_status(cr));
}
void kmstest_paint_image(cairo_t *cr, const char *filename,
@@ -232,7 +232,7 @@ void kmstest_paint_image(cairo_t *cr, const char *filename,
double scale_x, scale_y;
image = cairo_image_surface_create_from_png(filename);
assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS);
igt_assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS);
img_width = cairo_image_surface_get_width(image);
img_height = cairo_image_surface_get_height(image);
+5 -5
View File
@@ -1,9 +1,9 @@
#ifndef INTEL_BATCHBUFFER_H
#define INTEL_BATCHBUFFER_H
#include <assert.h>
#include <stdint.h>
#include "intel_bufmgr.h"
#include "igt_core.h"
#define BATCH_SZ 4096
#define BATCH_RESERVED 16
@@ -58,7 +58,7 @@ intel_batchbuffer_space(struct intel_batchbuffer *batch)
static inline void
intel_batchbuffer_emit_dword(struct intel_batchbuffer *batch, uint32_t dword)
{
assert(intel_batchbuffer_space(batch) >= 4);
igt_assert(intel_batchbuffer_space(batch) >= 4);
*(uint32_t *) (batch->ptr) = dword;
batch->ptr += 4;
}
@@ -67,7 +67,7 @@ static inline void
intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
unsigned int sz)
{
assert(sz < BATCH_SZ - BATCH_RESERVED);
igt_assert(sz < BATCH_SZ - BATCH_RESERVED);
if (intel_batchbuffer_space(batch) < sz)
intel_batchbuffer_flush(batch);
}
@@ -110,7 +110,7 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
* scope.
*/
#define OUT_RELOC_FENCED(buf, read_domains, write_domain, delta) do { \
assert((delta) >= 0); \
igt_assert((delta) >= 0); \
intel_batchbuffer_emit_reloc(batch, buf, delta, \
read_domains, write_domain, 1); \
} while (0)
@@ -128,7 +128,7 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
* scope.
*/
#define OUT_RELOC(buf, read_domains, write_domain, delta) do { \
assert((delta) >= 0); \
igt_assert((delta) >= 0); \
intel_batchbuffer_emit_reloc(batch, buf, delta, \
read_domains, write_domain, 0); \
} while (0)
+1 -1
View File
@@ -808,7 +808,7 @@ void gem_require_ring(int fd, int ring_id)
return;
#endif
default:
assert(0);
igt_assert(0);
return;
}
}
-1
View File
@@ -5,7 +5,6 @@
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>