From 844c809698635cf44658fcbfb5da6976890185b9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 9 Jun 2009 12:45:53 +0100 Subject: [PATCH] [boilerplate] Print out known targets on error. Improve the 'Cannot find target ...' error message for an incorrect CAIRO_TEST_TARGET by actually listing the targets that have been compiled into the test suite. --- boilerplate/cairo-boilerplate.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index fb8897e23..31df7047e 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -781,7 +781,20 @@ cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets } if (!found) { - fprintf (stderr, "Cannot find target '%.*s'\n", (int)(end - tname), tname); + fprintf (stderr, "Cannot find target '%.*s'.\n", + (int)(end - tname), tname); + fprintf (stderr, "Known targets:"); + for (i = 0; i < sizeof (targets) / sizeof (targets[0]); i++) { + if (i != 0) { + if (strcmp (targets[i].name, targets[i-1].name) == 0) { + /* filter out repeats that differ in content */ + continue; + } + fprintf (stderr, ","); + } + fprintf (stderr, " %s", targets[i].name); + } + fprintf (stderr, "\n"); exit(-1); }