All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@gmail.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t] tests: Forbid to run the blit tests with count of 1
Date: Tue, 12 Feb 2013 14:24:40 +0000	[thread overview]
Message-ID: <1360679080-2499-1-git-send-email-damien.lespiau@gmail.com> (raw)

From: Damien Lespiau <damien.lespiau@intel.com>

Invoking say,

  sudo ./tests/gem_render_linear_blits 1

does not make a lot of sense as we're creating a single bo. The test
does not yell at you and passes, even if the rendercopy function does
not do anything. This makes it quite harmful when trying to debug
rendercopy without realizing that count is the number of allocated bos
and must be >= 2.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 tests/gem_linear_blits.c        | 4 ++++
 tests/gem_render_linear_blits.c | 5 +++++
 tests/gem_render_tiled_blits.c  | 5 +++++
 tests/gem_tiled_blits.c         | 3 +++
 4 files changed, 17 insertions(+)

diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c
index fe15f1d..ec2dc56 100644
--- a/tests/gem_linear_blits.c
+++ b/tests/gem_linear_blits.c
@@ -189,6 +189,10 @@ int main(int argc, char **argv)
 		count = atoi(argv[1]);
 	if (count == 0)
 		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
+	else if (count < 2) {
+		fprintf(stderr, "count must be >= 2\n");
+		return 1;
+	}
 
 	if (count > intel_get_total_ram_mb() * 9 / 10) {
 		count = intel_get_total_ram_mb() * 9 / 10;
diff --git a/tests/gem_render_linear_blits.c b/tests/gem_render_linear_blits.c
index 8ba24a3..a7e0189 100644
--- a/tests/gem_render_linear_blits.c
+++ b/tests/gem_render_linear_blits.c
@@ -85,6 +85,11 @@ int main(int argc, char **argv)
 		count = atoi(argv[1]);
 	if (count == 0)
 		count = 3 * gem_aperture_size(fd) / SIZE / 2;
+	else if (count < 2) {
+		fprintf(stderr, "count must be >= 2\n");
+		return 1;
+	}
+
 	printf("Using %d 1MiB buffers\n", count);
 
 	bo = malloc(sizeof(*bo)*count);
diff --git a/tests/gem_render_tiled_blits.c b/tests/gem_render_tiled_blits.c
index 31b2ee1..626e652 100644
--- a/tests/gem_render_tiled_blits.c
+++ b/tests/gem_render_tiled_blits.c
@@ -88,6 +88,11 @@ int main(int argc, char **argv)
 		count = atoi(argv[1]);
 	if (count == 0)
 		count = 3 * gem_aperture_size(fd) / SIZE / 2;
+	else if (count < 2) {
+		fprintf(stderr, "count must be >= 2\n");
+		return 1;
+	}
+
 	printf("Using %d 1MiB buffers\n", count);
 
 	buf = malloc(sizeof(*buf)*count);
diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c
index a6d5555..bb43976 100644
--- a/tests/gem_tiled_blits.c
+++ b/tests/gem_tiled_blits.c
@@ -132,6 +132,9 @@ int main(int argc, char **argv)
 	if (count == 0) {
 		count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
 		count += (count & 1) == 0;
+	} else if (count < 2) {
+		fprintf(stderr, "count must be >= 2\n");
+		return 1;
 	}
 
 	if (count > intel_get_total_ram_mb() * 9 / 10) {
-- 
1.7.11.7

                 reply	other threads:[~2013-02-12 14:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360679080-2499-1-git-send-email-damien.lespiau@gmail.com \
    --to=damien.lespiau@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.