tests/kms_flip: Use asserts

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2014-05-14 11:52:35 +02:00
parent 0b3407f528
commit 5597a1f418

View File

@ -534,54 +534,46 @@ static void check_state(struct test_output *o, struct event_state *es)
double usec_interflip; double usec_interflip;
timersub(&es->current_ts, &es->current_received_ts, &diff); timersub(&es->current_ts, &es->current_received_ts, &diff);
if ((!analog_tv_connector(o)) && if (!analog_tv_connector(o)) {
(diff.tv_sec > 0 || (diff.tv_sec == 0 && diff.tv_usec > 2000))) { igt_assert_f(diff.tv_sec <= 0 && (diff.tv_sec == 0 && diff.tv_usec <= 2000),
fprintf(stderr, "%s ts delayed for too long: %is, %iusec\n", "%s ts delayed for too long: %is, %iusec\n",
es->name, (int)diff.tv_sec, (int)diff.tv_usec); es->name, (int)diff.tv_sec, (int)diff.tv_usec);
igt_fail(5);
} }
if (es->count == 0) if (es->count == 0)
return; return;
if (!timercmp(&es->last_received_ts, &es->current_ts, <)) { timersub(&es->current_ts, &es->last_received_ts, &diff);
fprintf(stderr, "%s ts before the %s was issued!\n", igt_assert_f(timercmp(&es->last_received_ts, &es->current_ts, <),
es->name, es->name); "%s ts before the %s was issued!\n"
"timerdiff %is, %ius\n",
timersub(&es->current_ts, &es->last_received_ts, &diff); es->name, es->name,
fprintf(stderr, "timerdiff %is, %ius\n", (int) diff.tv_sec, (int) diff.tv_usec);
(int) diff.tv_sec, (int) diff.tv_usec);
igt_fail(6);
}
/* This bounding matches the one in DRM_IOCTL_WAIT_VBLANK. */ /* This bounding matches the one in DRM_IOCTL_WAIT_VBLANK. */
if (!(o->flags & (TEST_DPMS | TEST_MODESET))) { if (!(o->flags & (TEST_DPMS | TEST_MODESET))) {
/* check only valid if no modeset happens in between, that /* check only valid if no modeset happens in between, that
* increments by (1 << 23) on each step. */ * increments by (1 << 23) on each step. */
if (es->current_seq - (es->last_seq + o->seq_step) > 1UL << 23) {
fprintf(stderr, "unexpected %s seq %u, should be >= %u\n", igt_assert_f(es->current_seq - (es->last_seq + o->seq_step) <= 1UL << 23,
es->name, es->current_seq, es->last_seq + o->seq_step); "unexpected %s seq %u, should be >= %u\n",
igt_fail(10); es->name, es->current_seq, es->last_seq + o->seq_step);
}
} }
if ((o->flags & TEST_CHECK_TS) && (!analog_tv_connector(o))) { if ((o->flags & TEST_CHECK_TS) && (!analog_tv_connector(o))) {
timersub(&es->current_ts, &es->last_ts, &diff); timersub(&es->current_ts, &es->last_ts, &diff);
usec_interflip = (double)o->seq_step * frame_time(o); usec_interflip = (double)o->seq_step * frame_time(o);
if (fabs((((double) diff.tv_usec) - usec_interflip) /
usec_interflip) > 0.005) {
fprintf(stderr, "inter-%s ts jitter: %is, %ius\n",
es->name,
(int) diff.tv_sec, (int) diff.tv_usec);
igt_fail(9);
}
if (es->current_seq != es->last_seq + o->seq_step) { igt_assert_f(fabs((((double) diff.tv_usec) - usec_interflip) /
fprintf(stderr, "unexpected %s seq %u, expected %u\n", usec_interflip) <= 0.005,
es->name, es->current_seq, "inter-%s ts jitter: %is, %ius\n",
es->last_seq + o->seq_step); es->name, (int) diff.tv_sec, (int) diff.tv_usec);
igt_fail(9);
} igt_assert_f(es->current_seq == es->last_seq + o->seq_step,
"unexpected %s seq %u, expected %u\n",
es->name, es->current_seq,
es->last_seq + o->seq_step);
} }
} }