summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-03-22 19:27:04 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-03-22 19:39:46 +0100
commit0e22f14ed642af94db5f0dd7461920274be3361a (patch)
tree9330d305d9138437634c84721e30671aa4ecd9db /tests
parentbff22f7317a39605d53cf142e2c0f5c424d9c12c (diff)
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/drv_suspend.c4
-rw-r--r--tests/gem_ctx_basic.c2
-rw-r--r--tests/gem_fence_thrash.c32
-rw-r--r--tests/gem_media_fill.c2
-rw-r--r--tests/gem_render_copy.c2
-rw-r--r--tests/gem_render_linear_blits.c2
-rw-r--r--tests/gem_render_tiled_blits.c2
-rw-r--r--tests/gem_storedw_batches_loop.c2
-rw-r--r--tests/gem_stress.c2
-rw-r--r--tests/gem_wait_render_timeout.c2
-rw-r--r--tests/igt_simulation.c1
-rw-r--r--tests/kms_setmode.c25
-rw-r--r--tests/pm_rps.c2
-rw-r--r--tests/testdisplay.c4
14 files changed, 35 insertions, 49 deletions
diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c
index 400c34b9..ff8a348b 100644
--- a/tests/drv_suspend.c
+++ b/tests/drv_suspend.c
@@ -109,7 +109,7 @@ test_debugfs_reader(void)
snprintf(tmp, sizeof(tmp) - 1,
"while true; do find %s/%i/ -type f | xargs cat > /dev/null 2>&1; done",
dfs_base, drm_get_card());
- assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1);
+ igt_assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1);
}
sleep(1);
@@ -134,7 +134,7 @@ test_sysfs_reader(void)
snprintf(tmp, sizeof(tmp) - 1,
"while true; do find %s%i*/ -type f | xargs cat > /dev/null 2>&1; done",
dfs_base, drm_get_card());
- assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1);
+ igt_assert(execl("/bin/sh", "sh", "-c", tmp, (char *) NULL) != -1);
}
sleep(1);
diff --git a/tests/gem_ctx_basic.c b/tests/gem_ctx_basic.c
index 3bfbe616..4340000e 100644
--- a/tests/gem_ctx_basic.c
+++ b/tests/gem_ctx_basic.c
@@ -30,12 +30,10 @@
*/
#include <pthread.h>
-#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index bff73ddd..86ee5bec 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -113,8 +113,8 @@ _bo_write_verify(struct test *t)
unsigned int dwords = OBJECT_SIZE >> 2;
const char *tile_str[] = { "none", "x", "y" };
- assert (t->tiling >= 0 && t->tiling <= I915_TILING_Y);
- assert (t->num_surfaces > 0);
+ igt_assert(t->tiling >= 0 && t->tiling <= I915_TILING_Y);
+ igt_assert(t->num_surfaces > 0);
s = calloc(sizeof(*s), t->num_surfaces);
igt_assert(s);
@@ -171,7 +171,7 @@ static int run_test(int threads_per_fence, void *f, int tiling,
t.num_surfaces = surfaces_per_thread;
num_fences = gem_available_fences(t.fd);
- assert (num_fences > 0);
+ igt_assert(num_fences > 0);
num_threads = threads_per_fence * num_fences;
@@ -181,7 +181,7 @@ static int run_test(int threads_per_fence, void *f, int tiling,
if (threads_per_fence) {
threads = calloc(sizeof(*threads), num_threads);
- assert (threads != NULL);
+ igt_assert(threads != NULL);
for (n = 0; n < num_threads; n++)
pthread_create (&threads[n], NULL, f, &t);
@@ -203,29 +203,29 @@ igt_main
igt_skip_on_simulation();
igt_subtest("bo-write-verify-none")
- assert (run_test(0, bo_write_verify, I915_TILING_NONE, 80) == 0);
+ igt_assert(run_test(0, bo_write_verify, I915_TILING_NONE, 80) == 0);
igt_subtest("bo-write-verify-x")
- assert (run_test(0, bo_write_verify, I915_TILING_X, 80) == 0);
+ igt_assert(run_test(0, bo_write_verify, I915_TILING_X, 80) == 0);
igt_subtest("bo-write-verify-y")
- assert (run_test(0, bo_write_verify, I915_TILING_Y, 80) == 0);
+ igt_assert(run_test(0, bo_write_verify, I915_TILING_Y, 80) == 0);
igt_subtest("bo-write-verify-threaded-none")
- assert (run_test(5, bo_write_verify, I915_TILING_NONE, 2) == 0);
+ igt_assert(run_test(5, bo_write_verify, I915_TILING_NONE, 2) == 0);
igt_subtest("bo-write-verify-threaded-x") {
- assert (run_test(2, bo_write_verify, I915_TILING_X, 2) == 0);
- assert (run_test(5, bo_write_verify, I915_TILING_X, 2) == 0);
- assert (run_test(10, bo_write_verify, I915_TILING_X, 2) == 0);
- assert (run_test(20, bo_write_verify, I915_TILING_X, 2) == 0);
+ igt_assert(run_test(2, bo_write_verify, I915_TILING_X, 2) == 0);
+ igt_assert(run_test(5, bo_write_verify, I915_TILING_X, 2) == 0);
+ igt_assert(run_test(10, bo_write_verify, I915_TILING_X, 2) == 0);
+ igt_assert(run_test(20, bo_write_verify, I915_TILING_X, 2) == 0);
}
igt_subtest("bo-write-verify-threaded-y") {
- assert (run_test(2, bo_write_verify, I915_TILING_Y, 2) == 0);
- assert (run_test(5, bo_write_verify, I915_TILING_Y, 2) == 0);
- assert (run_test(10, bo_write_verify, I915_TILING_Y, 2) == 0);
- assert (run_test(20, bo_write_verify, I915_TILING_Y, 2) == 0);
+ igt_assert(run_test(2, bo_write_verify, I915_TILING_Y, 2) == 0);
+ igt_assert(run_test(5, bo_write_verify, I915_TILING_Y, 2) == 0);
+ igt_assert(run_test(10, bo_write_verify, I915_TILING_Y, 2) == 0);
+ igt_assert(run_test(20, bo_write_verify, I915_TILING_Y, 2) == 0);
}
igt_subtest("bo-copy")
diff --git a/tests/gem_media_fill.c b/tests/gem_media_fill.c
index ef73ed68..220f8629 100644
--- a/tests/gem_media_fill.c
+++ b/tests/gem_media_fill.c
@@ -32,12 +32,10 @@
#include <stdbool.h>
#include <unistd.h>
-#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index 2e029ebd..ad48bfc2 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -32,12 +32,10 @@
#include <stdbool.h>
#include <unistd.h>
#include <cairo.h>
-#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index b32a4cbb..92c5bf6a 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -37,12 +37,10 @@
#include "config.h"
#endif
-#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
diff --git a/tests/gem_render_tiled_blits.c b/tests/gem_render_tiled_blits.c
index 2456c2fb..5233b231 100644
--- a/tests/gem_render_tiled_blits.c
+++ b/tests/gem_render_tiled_blits.c
@@ -33,12 +33,10 @@
* The goal is to simply ensure the basics work.
*/
-#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
diff --git a/tests/gem_storedw_batches_loop.c b/tests/gem_storedw_batches_loop.c
index 96b5a4df..85d6f6c0 100644
--- a/tests/gem_storedw_batches_loop.c
+++ b/tests/gem_storedw_batches_loop.c
@@ -83,7 +83,7 @@ store_dword_loop(int divider, unsigned flags)
cmd_address_offset = j * 4;
buf[j++] = target_bo->offset;
}
- assert(j > 0);
+ igt_assert(j > 0);
buf[j++] = 0x42000000 + val;
igt_assert(drm_intel_bo_references(cmd_bo, target_bo) == 0);
diff --git a/tests/gem_stress.c b/tests/gem_stress.c
index a994f7f9..3a94fb1a 100644
--- a/tests/gem_stress.c
+++ b/tests/gem_stress.c
@@ -49,12 +49,10 @@
* In short: designed for maximum evilness.
*/
-#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
diff --git a/tests/gem_wait_render_timeout.c b/tests/gem_wait_render_timeout.c
index 1c6aa7d1..07481049 100644
--- a/tests/gem_wait_render_timeout.c
+++ b/tests/gem_wait_render_timeout.c
@@ -27,12 +27,10 @@
#include <stdio.h>
#include <time.h>
-#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
diff --git a/tests/igt_simulation.c b/tests/igt_simulation.c
index b9c6241d..f4007b80 100644
--- a/tests/igt_simulation.c
+++ b/tests/igt_simulation.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/types.h>
+#include <assert.h>
#include "drmtest.h"
#include "igt_core.h"
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 593bc772..4c1a5676 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -24,7 +24,6 @@
#include "config.h"
#endif
-#include <assert.h>
#include <cairo.h>
#include <errno.h>
#include <stdint.h>
@@ -193,7 +192,7 @@ static void create_fb_for_crtc(struct crtc_config *crtc,
fb_id = kmstest_create_fb(drm_fd, crtc->mode.hdisplay,
crtc->mode.vdisplay, bpp, depth,
enable_tiling, fb_info);
- assert(fb_id > 0);
+ igt_assert(fb_id > 0);
}
static void get_mode_for_crtc(struct crtc_config *crtc,
@@ -239,7 +238,7 @@ static int get_encoder_idx(drmModeRes *resources, drmModeEncoder *encoder)
for (i = 0; i < resources->count_encoders; i++)
if (resources->encoders[i] == encoder->encoder_id)
return i;
- assert(0);
+ igt_assert(0);
}
static void get_crtc_config_str(struct crtc_config *crtc, char *buf,
@@ -304,7 +303,7 @@ static void setup_crtcs(drmModeRes *resources, struct connector_config *cconf,
crtc->cconfs = malloc(sizeof(*crtc->cconfs) *
crtc->connector_count);
- assert(crtc->cconfs);
+ igt_assert(crtc->cconfs);
encoder_mask = 0;
for (j = 0; j < crtc->connector_count; j++) {
@@ -318,7 +317,7 @@ static void setup_crtcs(drmModeRes *resources, struct connector_config *cconf,
igt_assert(connector->count_encoders == 1);
encoder = drmModeGetEncoder(drm_fd,
connector->encoders[0]);
- assert(encoder);
+ igt_assert(encoder);
config_valid &= !!(encoder->possible_crtcs &
(1 << crtc->crtc_idx));
@@ -371,7 +370,7 @@ static uint32_t *get_connector_ids(struct crtc_config *crtc)
int i;
ids = malloc(sizeof(*ids) * crtc->connector_count);
- assert(ids);
+ igt_assert(ids);
for (i = 0; i < crtc->connector_count; i++)
ids[i] = crtc->cconfs[i].connector->connector_id;
@@ -502,7 +501,7 @@ static int get_one_connector(drmModeRes *resources, int connector_id,
drmModeModeInfo mode;
connector = drmModeGetConnector(drm_fd, connector_id);
- assert(connector);
+ igt_assert(connector);
cconf->connector = connector;
cconf->connected = connector->connection == DRM_MODE_CONNECTED;
@@ -543,7 +542,7 @@ static int get_connectors(drmModeRes *resources, int *connector_idxs,
int connector_id;
connector_idx = connector_idxs[i];
- assert(connector_idx < resources->count_connectors);
+ igt_assert(connector_idx < resources->count_connectors);
connector_id = resources->connectors[connector_idx];
if (get_one_connector(resources, connector_id, &cconfs[i]) < 0)
@@ -589,7 +588,7 @@ static void iterate_combinations(int n, int k, bool allow_repetitions,
int v;
if (!k) {
- assert(set->count < ARRAY_SIZE(set->items));
+ igt_assert(set->count < ARRAY_SIZE(set->items));
set->items[set->count++] = *comb;
return;
}
@@ -608,7 +607,7 @@ static void get_combinations(int n, int k, bool allow_repetitions,
{
struct combination comb;
- assert(k <= ARRAY_SIZE(set->items[0].elems));
+ igt_assert(k <= ARRAY_SIZE(set->items[0].elems));
set->count = 0;
iterate_combinations(n, k, allow_repetitions, 0, 0, &comb, set);
}
@@ -634,7 +633,7 @@ static void test_combinations(const struct test_config *tconf,
int j;
cconfs = malloc(sizeof(*cconfs) * connector_count);
- assert(cconfs);
+ igt_assert(cconfs);
connector_idxs = &connector_combs.items[i].elems[0];
ret = get_connectors(tconf->resources, connector_idxs,
@@ -678,7 +677,7 @@ static int opt_handler(int opt, int opt_index)
filter_test_id = atoi(optarg);
break;
default:
- assert(0);
+ igt_assert(0);
}
return 0;
@@ -723,7 +722,7 @@ int main(int argc, char **argv)
igt_set_vt_graphics_mode();
drm_resources = drmModeGetResources(drm_fd);
- assert(drm_resources);
+ igt_assert(drm_resources);
}
for (i = 0; i < ARRAY_SIZE(tests); i++) {
diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 2f321840..038987c0 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -197,7 +197,7 @@ static void emit_store_dword_imm(uint32_t val)
#define LOAD_HELPER_BO_SIZE (16*1024*1024)
static void load_helper_set_load(enum load load)
{
- assert(lh.igt_proc.running);
+ igt_assert(lh.igt_proc.running);
if (lh.load == load)
return;
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index e667ab95..d0cd5123 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -504,7 +504,7 @@ static void stereo_fb_layout_from_mode(struct stereo_fb_layout *layout,
break;
}
default:
- assert(0);
+ igt_assert(0);
}
}
@@ -520,7 +520,7 @@ static const char *stereo_mode_str(drmModeModeInfo *mode)
case DRM_MODE_FLAG_3D_FRAME_PACKING:
return "FP";
default:
- assert(0);
+ igt_assert(0);
}
}