aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-28 23:30:40 -0500
committerTed Gould <ted@gould.cx>2012-03-28 23:30:40 -0500
commit11ee75120bad73033ccd1ec1ceb919395023084e (patch)
treedc5eeb24a0b4b2b8ff83cb04b325bf8ef97dd8f2 /tests
parent7d376ec5570f6732f90a52e7fc448285c80c5ddb (diff)
downloadlibdbusmenu-11ee75120bad73033ccd1ec1ceb919395023084e.tar.gz
libdbusmenu-11ee75120bad73033ccd1ec1ceb919395023084e.tar.bz2
libdbusmenu-11ee75120bad73033ccd1ec1ceb919395023084e.zip
Adding in a test to print the number of instructions it takes to export a menu
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am19
-rwxr-xr-xtests/test-json-instruction-count6
2 files changed, 24 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 16f00c5..82f6a9d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,7 +16,8 @@ TESTS = \
if WANT_DBUSMENUDUMPER
TESTS += \
- test-json
+ test-json \
+ test-json-instruction
endif
if WANT_LIBDBUSMENUGTK
@@ -242,6 +243,22 @@ test_json_client_LDADD = \
$(DBUSMENUTESTS_LIBS) \
$(DBUSMENUGLIB_LIBS)
+#########################
+# Test JSON Instructions
+#########################
+
+test-json-instruction: test-json-client test-json-server test-json-instruction-count Makefile.am
+ @echo "#!/bin/bash" > $@
+ @echo export UBUNTU_MENUPROXY="" >> $@
+ @echo export G_DEBUG=fatal_criticals >> $@
+ @echo $(XVFB_RUN) >> $@
+ @echo $(DBUS_RUNNER) --task $(builddir)/test-json-client --wait-for org.dbusmenu.test --task-name Client --parameter $(top_builddir)/tools/dbusmenu-dumper --parameter /dev/null --ignore-return --task libtool --parameter --mode=execute --parameter $(srcdir)/test-json-instruction-count --parameter $(builddir)/test-json-server --task-name Server --parameter $(srcdir)/test-json-01.json --ignore-return >> $@
+ @chmod +x $@
+
+EXTRA_DIST += \
+ test-json-instruction-count
+
+
######################
# Test Glib Submenu
######################
diff --git a/tests/test-json-instruction-count b/tests/test-json-instruction-count
new file mode 100755
index 0000000..3a4db97
--- /dev/null
+++ b/tests/test-json-instruction-count
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+COMMAND=$@
+INSTRUCTIONS=`valgrind --tool=callgrind --callgrind-out-file=/dev/null --instr-atstart=no --collect-atstart=no --combine-dumps=yes $COMMAND 2>&1 > /dev/null | grep refs | grep I | tail --lines=1 | cut -d ":" -f 2 | sed -e 's/^[ \t]*//'`
+
+echo "Instructions needed to execute '$COMMAND': $INSTRUCTIONS"