summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-10-29 11:51:49 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-10-29 17:41:54 +0100
commite4e7f9d88e05fa610a72245c40f4e47f85db61ff (patch)
treed28891fdc5bb13c94b51e315e15db319a44b0a8a /solenv
parentd8bc093dd07ceba42c9d722e7ccca4caedbd91e4 (diff)
Improve framework for callgrind performance unit tests
Do not abort in tests which take longer then before. Since 4f5f6d2444a24138c3d3d378771f87cb06427195 we have nice tool to collect callgrind results, store them.. Also, make it not necessary to duplicate anything. Any test can be turned into a performance test by using callgrindStart/callgrindDump. You only need to duplicate the makefile name in gb_Module_add_perfcheck_targets. So, if the test is run as part of 'perfcheck', it runs under callgrind, otherwise it behaves like a regular unit test. Change-Id: I7acbb855b1823c9a32ba126abb57dccc767ca239
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/CppunitTest.mk25
-rw-r--r--solenv/gbuild/extensions/post_SpeedUpTargets.mk2
2 files changed, 8 insertions, 19 deletions
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index aa259e35797b..4f00f819864c 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -34,6 +34,11 @@ GLIBCXX_FORCE_NEW := 1
endif
endif
+ifneq (,$(filter perfcheck,$(MAKECMDGOALS)))
+$(if $(ENABLE_VALGRIND),,$(call gb_Output_error,Running performance tests with empty $$(ENABLE_VALGRIND) does not make sense))
+gb_CppunitTest_VALGRINDTOOL := valgrind --tool=callgrind --dump-instr=yes --instr-atstart=no
+endif
+
# defined by platform
# gb_CppunitTest_TARGETTYPE
# gb_CppunitTest_get_filename
@@ -94,10 +99,7 @@ $(call gb_CppunitTest_get_target,%) :| $(gb_CppunitTest_CPPTESTDEPS)
|| ($(if $(value gb_CppunitTest_postprocess), \
RET=$$?; \
$(call gb_CppunitTest_postprocess,$(gb_CppunitTest_CPPTESTCOMMAND),$@.core,$$RET) >> $@.log 2>&1;) \
- cat $@.log; $(SRCDIR)/solenv/bin/unittest-failed.sh Cppunit $*))) \
- $(if $(PERFTEST), && VAL=$$(grep '^==.*== Collected : ' $@.log | sed "s/==.*== Collected : //") && \
- $(if $(filter 0,$(PERFTEST)), expr "$$VAL" "*" "101" "/" "100", test $$VAL -le $(PERFTEST) || (echo "Unit test is slow! $$VAL instructions detected (expected $(PERFTEST))." && false))) \
- )
+ cat $@.log; $(SRCDIR)/solenv/bin/unittest-failed.sh Cppunit $*))))
define gb_CppunitTest_CppunitTest
$(call gb_CppunitTest__CppunitTest_impl,$(1),$(call gb_CppunitTest_get_linktarget,$(1)))
@@ -147,21 +149,6 @@ $(call gb_CppunitTest_get_target,$(1)) : ARGS += $(2)
endef
-# Run this unit test with callgrind tool to measure performance. If you are
-# creating a new test, first set the number to 0, run the test, and it will
-# print an number for you to use as a second parameter here. The test will
-# fail if reported number of instructions will be bigger than this parameter.
-#
-# call gb_CppunitTest_set_performance_test,name,instructions_number
-define gb_CppunitTest_set_performance_test
-$(if $(ENABLE_VALGRIND),,$(call gb_Output_error,gb_CppunitTest_set_performance_test used with empty $$(ENABLE_VALGRIND)))
-
-$(call gb_CppunitTest_get_target,$(1)) : PERFTEST := $(2)
-$(call gb_CppunitTest_get_target,$(1)) : gb_CppunitTest_VALGRINDTOOL := valgrind --tool=callgrind --dump-instr=yes --instr-atstart=no
-$(call gb_CppunitTest_use_external,$(1),valgrind)
-
-endef
-
define gb_CppunitTest_use_ure
$(call gb_CppunitTest_use_rdb,$(1),ure/services)
$(call gb_CppunitTest_get_target,$(1)) : URE := $(true)
diff --git a/solenv/gbuild/extensions/post_SpeedUpTargets.mk b/solenv/gbuild/extensions/post_SpeedUpTargets.mk
index 8f3280f3c5aa..a13392a29cf7 100644
--- a/solenv/gbuild/extensions/post_SpeedUpTargets.mk
+++ b/solenv/gbuild/extensions/post_SpeedUpTargets.mk
@@ -22,6 +22,8 @@ endif
ifeq (,$(filter perfcheck,$(MAKECMDGOALS)))
gb_Module_SKIPTARGETS += perfcheck
+else
+gb_Module_SKIPTARGETS += check slowcheck subsequentcheck
endif
ifneq ($(strip $(MAKECMDGOALS)),)