[cairo-commit] 2 commits - perf/cairo-perf.c perf/Makefile.am test/cairo-test.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Apr 18 16:09:42 PDT 2007


 perf/Makefile.am  |   26 +++++++++++++++++---------
 perf/cairo-perf.c |    8 ++++++--
 test/cairo-test.c |    5 +++++
 3 files changed, 28 insertions(+), 11 deletions(-)

New commits:
diff-tree b9026d0b137520247b4a93287bd518fc79774e93 (from 9f3e0694e644d2279c7f4835f8035d4ecccb5711)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Apr 18 19:09:53 2007 -0400

    [perf] Make targets more consistent with the test suite
    That is:
    1) no VALGRING vs VG abbreviations
    2) setting TARGETS and ITERS on the make command line works now

diff --git a/perf/Makefile.am b/perf/Makefile.am
index 8007cab..8e7d513 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -57,20 +57,28 @@ $(top_builddir)/boilerplate/libcairoboil
 $(top_builddir)/src/libcairo.la:
 	cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libcairo.la
 
+
+# Do a funny transition of CAIRO_TEST_TARGET through TARGETS such that
+# one can limit tested targets both through CAIRO_TEST_TARGET env var
+# and TARGETS make var on the command line.
+TARGETS = $(CAIRO_TEST_TARGET)
+ITERS = $(CAIRO_PERF_ITERATIONS)
+CAIRO_PERF_ENVIRONMENT = CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_PERF_ITERATIONS="$(ITERS)"
+
 perf: cairo-perf FORCE
-	./cairo-perf
+	$(CAIRO_PERF_ENVIRONMENT) ./cairo-perf
 
 html: index.html
 
 index.html: cairo-perf
-	./cairo-perf-diff -h HEAD > $@
+	$(CAIRO_PERF_ENVIRONMENT) ./cairo-perf-diff -h HEAD > $@
 
-EXTRA_VG_FLAGS = $(CAIRO_EXTRA_VALGRIND_FLAGS)
-VG_MEMCHECK_FLAGS = \
+EXTRA_VALGRIND_FLAGS = $(CAIRO_EXTRA_VALGRIND_FLAGS)
+VALGRIND_MEMCHECK_FLAGS = \
 	--tool=memcheck \
 	--suppressions=$(top_srcdir)/test/.valgrind-suppressions \
 	--leak-check=yes --show-reachable=yes
-VG_CALLGRIND_FLAGS = \
+VALGRIND_CALLGRIND_FLAGS = \
 	--tool=callgrind
 CLEANFILES = \
 	valgrind-log \
@@ -78,12 +86,12 @@ CLEANFILES = \
 
 perf-valgrind: cairo-perf FORCE
 	$(top_srcdir)/libtool --mode=execute \
-		valgrind $(VG_MEMCHECK_FLAGS) $(EXTRA_VG_FLAGS) \
-		./cairo-perf 2>&1 | tee valgrind-log
+		valgrind $(VALGRIND_MEMCHECK_FLAGS) $(EXTRA_VALGRIND_FLAGS) \
+		$(CAIRO_PERF_ENVIRONMENT) ./cairo-perf 2>&1 | tee valgrind-log
 perf-callgrind: cairo-perf FORCE
 	$(top_srcdir)/libtool --mode=execute \
-		valgrind $(VG_CALLGRIND_FLAGS) $(EXTRA_VG_FLAGS) \
-		./cairo-perf
+		valgrind $(VALGRIND_CALLGRIND_FLAGS) $(EXTRA_VALGRIND_FLAGS) \
+		$(CAIRO_PERF_ENVIRONMENT) ./cairo-perf
 
 FORCE:
 
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 52e3405..6c66487 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -216,10 +216,11 @@ static void
 parse_options (cairo_perf_t *perf, int argc, char *argv[])
 {
     int c;
+    const char *iters;
     char *end;
 
-    if (getenv("CAIRO_PERF_ITERATIONS"))
-	perf->iterations = strtol(getenv("CAIRO_PERF_ITERATIONS"), NULL, 0);
+    if ((iters = getenv("CAIRO_PERF_ITERATIONS")) && *iters)
+	perf->iterations = strtol(iters, NULL, 0);
     else
 	perf->iterations = CAIRO_PERF_ITERATIONS_DEFAULT;
     perf->exact_iterations = 0;
@@ -323,6 +324,9 @@ main (int argc, char *argv[])
             stderr);
     }
 
+    if (!*cairo_test_target)
+	cairo_test_target = NULL;
+
     for (i = 0; targets[i].name; i++) {
 	perf.target = target = &targets[i];
 	perf.test_number = 0;
diff-tree 9f3e0694e644d2279c7f4835f8035d4ecccb5711 (from 52d4e0f3191440e8ebe366b593c2e9c955328258)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Apr 18 19:08:54 2007 -0400

    [test] Allow bypassing all test targets by setting CAIRO_TEST_TARGET=" "

diff --git a/test/cairo-test.c b/test/cairo-test.c
index f3cf9e9..c74e66e 100755
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -422,6 +422,11 @@ cairo_test_expecting (cairo_test_t *test
 	    if (!end)
 	        end = tname + strlen (tname);
 
+	    if (end == tname) {
+		tname = end + 1;
+		continue;
+	    }
+
 	    for (i = 0; targets[i].name != NULL; i++) {
 		if (0 == strncmp (targets[i].name, tname, end - tname) &&
 		    !isalnum (targets[i].name[end - tname])) {


More information about the cairo-commit mailing list