Merge lp:~3v1n0/bamf/tests-dbus-cleanup-0.4 into lp:bamf/0.4

Proposed by Marco Trevisan (Treviño)
Status: Superseded
Proposed branch: lp:~3v1n0/bamf/tests-dbus-cleanup-0.4
Merge into: lp:bamf/0.4
Diff against target: 318 lines (+167/-15)
9 files modified
Makefile.am.coverage (+11/-8)
configure.ac (+12/-0)
debian/control (+1/-0)
tests/Makefile.am (+2/-0)
tests/Makefile.am.gtests (+13/-6)
tests/bamfdaemon/Makefile.am (+3/-1)
tests/gtester.xsl (+69/-0)
tests/gtester2xunit.py (+54/-0)
tests/libbamf/Makefile.am (+2/-0)
To merge this branch: bzr merge lp:~3v1n0/bamf/tests-dbus-cleanup-0.4
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Francis Ginther Pending
Review via email: mp+168248@code.launchpad.net

This proposal has been superseded by a proposal from 2013-06-08.

Commit message

Makefile.am.gtests: kill the launched dbus-daemon after running the tests

Description of the change

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
540. By Marco Trevisan (Treviño)

Merging with lp:~3v1n0/bamf/xunit-coverage-fixes-0.4

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile.am.coverage'
--- Makefile.am.coverage 2012-12-13 21:54:59 +0000
+++ Makefile.am.coverage 2013-06-08 17:33:25 +0000
@@ -7,8 +7,6 @@
77
8clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr8clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr
99
10if HAVE_GCOV
11
12clean-gcno:10clean-gcno:
13 @echo Removing old coverage instrumentation11 @echo Removing old coverage instrumentation
14 -find -name '*.gcno' -print | xargs -r rm12 -find -name '*.gcno' -print | xargs -r rm
@@ -16,7 +14,8 @@
16clean-gcda:14clean-gcda:
17 @echo Removing old coverage results15 @echo Removing old coverage results
18 -find -name '*.gcda' -print | xargs -r rm16 -find -name '*.gcda' -print | xargs -r rm
19 17
18if HAVE_GCOV
20coverage-html:19coverage-html:
21 -$(MAKE) $(AM_MAKEFLAGS) -k check20 -$(MAKE) $(AM_MAKEFLAGS) -k check
22 $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html21 $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
@@ -35,14 +34,18 @@
35coverage-gcovr:34coverage-gcovr:
36 -$(MAKE) $(AM_MAKEFLAGS) -k check35 -$(MAKE) $(AM_MAKEFLAGS) -k check
37 $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr36 $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr
38 37
38coverage-xml: coverage-gcovr
39
39generate-coverage-gcovr:40generate-coverage-gcovr:
40 @echo Generating coverage GCOVR report41 @echo Generating coverage GCOVR report
41 $(GCOVR) --xml -r $(top_builddir) -o $(top_builddir)/coverage.xml42 $(GCOVR) --xml -r $(top_builddir) -e "tests.*" -o $(top_builddir)/coverage.xml
42
43clean-coverage-gcovr: clean-gcda
44 -rm -rf $(top_builddir)/coverage.xml
4543
46endif # HAVE_GCOVR44endif # HAVE_GCOVR
4745
48endif # HAVE_GCOV46endif # HAVE_GCOV
47
48clean-coverage-gcovr: clean-gcda
49 -rm -f $(top_builddir)/coverage.xml
50
51clean-coverage-xml: clean-coverage-gcovr
4952
=== modified file 'configure.ac'
--- configure.ac 2013-05-24 18:37:43 +0000
+++ configure.ac 2013-06-08 17:33:25 +0000
@@ -120,6 +120,18 @@
120AC_SUBST(LIBUNITY_WEBAPPS_LIBS)120AC_SUBST(LIBUNITY_WEBAPPS_LIBS)
121121
122###########################122###########################
123# gtester2xunit checks #
124###########################
125
126AC_PATH_PROG([PYTHON],[python])
127AC_MSG_CHECKING(for gtester2xunit dependencies)
128if !($PYTHON -c "import libxslt, libxml2" 2> /dev/null); then
129 AC_MSG_RESULT([no])
130 AC_MSG_ERROR([You need to install python-libxslt1 and python-libxml2]);
131fi
132AC_MSG_RESULT([yes])
133
134###########################
123# Headless tests135# Headless tests
124###########################136###########################
125AC_ARG_ENABLE([headless-tests],137AC_ARG_ENABLE([headless-tests],
126138
=== modified file 'debian/control'
--- debian/control 2013-05-01 23:03:44 +0000
+++ debian/control 2013-06-08 17:33:25 +0000
@@ -16,6 +16,7 @@
16 libunity-webapps-dev (>= 2.3.3),16 libunity-webapps-dev (>= 2.3.3),
17 libwnck-3-dev (>= 3.4.5),17 libwnck-3-dev (>= 3.4.5),
18 libgirepository1.0-dev,18 libgirepository1.0-dev,
19 python-libxslt1,
19 valac,20 valac,
20 xvfb,21 xvfb,
21Standards-Version: 3.9.322Standards-Version: 3.9.3
2223
=== modified file 'tests/Makefile.am'
--- tests/Makefile.am 2013-05-24 18:37:43 +0000
+++ tests/Makefile.am 2013-06-08 17:33:25 +0000
@@ -7,4 +7,6 @@
7EXTRA_DIST = \7EXTRA_DIST = \
8 data \8 data \
9 run-xvfb.sh \9 run-xvfb.sh \
10 gtester2xunit.py \
11 gtester.xsl \
10 $(NULL)12 $(NULL)
1113
=== modified file 'tests/Makefile.am.gtests'
--- tests/Makefile.am.gtests 2013-05-30 22:44:37 +0000
+++ tests/Makefile.am.gtests 2013-06-08 17:33:25 +0000
@@ -3,9 +3,11 @@
3#3#
4# Author: Marco Trevisan <marco@ubuntu.com>4# Author: Marco Trevisan <marco@ubuntu.com>
55
6GTESTER2XUNIT_RUN = $(abs_top_srcdir)/tests/gtester2xunit.py
7
6# Run tests as part of make check8# Run tests as part of make check
9
7if ENABLE_HEADLESS_TESTS10if ENABLE_HEADLESS_TESTS
8check-local: test-headless
911
10XVFB_RUN = $(abs_top_srcdir)/tests/run-xvfb.sh12XVFB_RUN = $(abs_top_srcdir)/tests/run-xvfb.sh
11LOG_PATH = headless-logs13LOG_PATH = headless-logs
@@ -22,15 +24,20 @@
22 $(DBUS_LAUNCH) > $(LOG_PATH)/sessionbus.sh; \24 $(DBUS_LAUNCH) > $(LOG_PATH)/sessionbus.sh; \
23 source $(LOG_PATH)/sessionbus.sh; \25 source $(LOG_PATH)/sessionbus.sh; \
24 \26 \
25 make test;27 make $(AM_MAKEFLAGS) -k test
26# END HEADLESS TESTS28
27else29check-local: test-headless
30
31else # END HEADLESS TESTS
32
28check-local: test33check-local: test
34
29endif35endif
3036
3137
32test:38test:
33 @gtester -k --verbose -o=$(TEST_BINARY)-results.xml ./$(TEST_BINARY)39 @gtester -k --verbose -o=$(TEST_BINARY)-results.xml ./$(TEST_BINARY); \
40 $(GTESTER2XUNIT_RUN) -x $(abs_top_srcdir)/tests/gtester.xsl $(TEST_BINARY)-results.xml
3441
35.PHONY: check-report full-report42.PHONY: check-report full-report
36check-report: $(TEST_BINARY)43check-report: $(TEST_BINARY)
@@ -47,4 +54,4 @@
47 > $(TEST_BINARY)-results.html )54 > $(TEST_BINARY)-results.html )
4855
49clean-generic:56clean-generic:
50 rm -f $(TEST_BINARY)-results.xml $(TEST_BINARY)-results.html57 rm -f $(TEST_BINARY)-results*.xml $(TEST_BINARY)-results.html
5158
=== modified file 'tests/bamfdaemon/Makefile.am'
--- tests/bamfdaemon/Makefile.am 2013-05-24 17:59:23 +0000
+++ tests/bamfdaemon/Makefile.am 2013-06-08 17:33:25 +0000
@@ -78,6 +78,7 @@
78 -I$(top_builddir)/src \78 -I$(top_builddir)/src \
79 -DWNCK_I_KNOW_THIS_IS_UNSTABLE \79 -DWNCK_I_KNOW_THIS_IS_UNSTABLE \
80 -DTESTDIR=\""$(abs_top_srcdir)/tests"\" \80 -DTESTDIR=\""$(abs_top_srcdir)/tests"\" \
81 $(COVERAGE_CFLAGS) \
81 $(GCC_FLAGS) \82 $(GCC_FLAGS) \
82 $(GTK_CFLAGS) \83 $(GTK_CFLAGS) \
83 $(GLIB_CFLAGS) \84 $(GLIB_CFLAGS) \
@@ -92,10 +93,11 @@
92 $(WNCK_LIBS) \93 $(WNCK_LIBS) \
93 $(GTOP_LIBS) \94 $(GTOP_LIBS) \
94 $(GTK_LIBS) \95 $(GTK_LIBS) \
95 $(LIBUNITY_WEBAPPS_LIBS) 96 $(LIBUNITY_WEBAPPS_LIBS)
9697
97test_bamf_LDFLAGS = \98test_bamf_LDFLAGS = \
98 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions \99 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions \
100 $(COVERAGE_LDFLAGS) \
99 $(NULL)101 $(NULL)
100102
101EXTRA_DIST = \103EXTRA_DIST = \
102104
=== added file 'tests/gtester.xsl'
--- tests/gtester.xsl 1970-01-01 00:00:00 +0000
+++ tests/gtester.xsl 2013-06-08 17:33:25 +0000
@@ -0,0 +1,69 @@
1<?xml version="1.0"?>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
4 <!-- I can't believe I have to do this -->
5 <!-- Based on this code:
6 http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx
7 -->
8 <xsl:template name="strreplace">
9 <xsl:param name="string"/>
10 <xsl:param name="token"/>
11 <xsl:param name="newtoken"/>
12 <xsl:choose>
13 <xsl:when test="contains($string, $token)">
14 <xsl:value-of select="substring-before($string, $token)"/>
15 <xsl:value-of select="$newtoken"/>
16 <xsl:call-template name="strreplace">
17 <xsl:with-param name="string" select="substring-after($string, $token)"/>
18 <xsl:with-param name="token" select="$token"/>
19 <xsl:with-param name="newtoken" select="$newtoken"/>
20 </xsl:call-template>
21 </xsl:when>
22 <xsl:otherwise>
23 <xsl:value-of select="$string"/>
24 </xsl:otherwise>
25 </xsl:choose>
26 </xsl:template>
27
28 <xsl:template match="/">
29 <xsl:for-each select="gtester">
30 <testsuite>
31 <xsl:attribute name="name">
32 <xsl:value-of select="testbinary[1]/@path"/>
33 </xsl:attribute>
34 <xsl:attribute name="tests">
35 <xsl:value-of select="count(testbinary[1]/testcase)"/>
36 </xsl:attribute>
37 <xsl:attribute name="time">
38 <xsl:value-of select="sum(testbinary[1]/testcase/duration)"/>
39 </xsl:attribute>
40 <xsl:attribute name="failures">
41 <xsl:value-of select="count(testbinary[1]/testcase/status[@result='failed'])"/>
42 </xsl:attribute>
43 <xsl:for-each select="testbinary[1]/testcase">
44 <testcase>
45 <xsl:variable name="classname">
46 <xsl:call-template name="strreplace">
47 <xsl:with-param name="string" select="substring-after(@path, '/')"/>
48 <xsl:with-param name="token" select="'/'"/>
49 <xsl:with-param name="newtoken" select="'.'"/>
50 </xsl:call-template>
51 </xsl:variable>
52 <xsl:attribute name="classname">
53 <xsl:value-of select="$classname"/>
54 </xsl:attribute>
55 <xsl:attribute name="name">g_test</xsl:attribute>
56 <xsl:attribute name="time">
57 <xsl:value-of select="duration"/>
58 </xsl:attribute>
59 <xsl:if test="status[@result = 'failed']">
60 <failure>
61 <xsl:value-of select="error"/>
62 </failure>
63 </xsl:if>
64 </testcase>
65 </xsl:for-each>
66 </testsuite>
67 </xsl:for-each>
68 </xsl:template>
69</xsl:stylesheet>
070
=== added file 'tests/gtester2xunit.py'
--- tests/gtester2xunit.py 1970-01-01 00:00:00 +0000
+++ tests/gtester2xunit.py 2013-06-08 17:33:25 +0000
@@ -0,0 +1,54 @@
1#! /usr/bin/python
2from argparse import ArgumentParser
3import libxslt
4import libxml2
5import sys
6import os
7
8XSL_TRANSFORM='/usr/share/gtester2xunit/gtester.xsl'
9
10def transform_file(input_filename, output_filename, xsl_file):
11 gtester = libxml2.parseFile(xsl_file)
12 style = libxslt.parseStylesheetDoc(gtester)
13 doc = libxml2.parseFile(input_filename)
14 result = style.applyStylesheet(doc, None)
15 result.saveFormatFile(filename=output_filename, format=True)
16
17
18def get_output_filename(input_filename):
19 filename, extension = os.path.splitext(input_filename)
20 return '{filename}-xunit{extension}'.format(filename=filename,
21 extension=extension)
22
23def main():
24 parser = ArgumentParser(
25 description="Simple utility that converts xml output of " +
26 "gtester to xunit output for jenkins")
27 parser.add_argument('-o', '--output',
28 help="Write output to specified file instead of default")
29 parser.add_argument('-x', '--xsl',
30 help="xsl file that should be used for the transformation")
31 parser.add_argument('-i', '--in-place',
32 help="Write the ouput to the original file (i.e. replace " +
33 "the original xml)",
34 action='store_true',
35 default=False)
36 parser.add_argument('files', metavar='FILE', type=str, nargs='+',
37 help="file(s) to transform to xunit format")
38 args = vars(parser.parse_args())
39 for input_filename in args['files']:
40 if not args['output']:
41 if args['in_place']:
42 output_filename = input_filename
43 else:
44 output_filename = get_output_filename(input_filename)
45 else:
46 output_filename = args['output']
47 if not args['xsl']:
48 xsl = XSL_TRANSFORM
49 else:
50 xsl = args['xsl']
51 transform_file(input_filename, output_filename, xsl)
52
53sys.exit(main())
54# vim: set syntex=python:
055
=== modified file 'tests/libbamf/Makefile.am'
--- tests/libbamf/Makefile.am 2013-05-30 22:44:04 +0000
+++ tests/libbamf/Makefile.am 2013-06-08 17:33:25 +0000
@@ -12,6 +12,7 @@
12 -I$(top_srcdir)/lib/libbamf \12 -I$(top_srcdir)/lib/libbamf \
13 -I$(top_builddir)/lib/libbamf \13 -I$(top_builddir)/lib/libbamf \
14 -DTESTDIR=\""$(abs_top_srcdir)/tests"\" \14 -DTESTDIR=\""$(abs_top_srcdir)/tests"\" \
15 $(COVERAGE_CFLAGS) \
15 $(GCC_FLAGS) \16 $(GCC_FLAGS) \
16 $(DBUS_CFLAGS) \17 $(DBUS_CFLAGS) \
17 $(GTK_CFLAGS) \18 $(GTK_CFLAGS) \
@@ -19,6 +20,7 @@
1920
20test_libbamf_LDADD = \21test_libbamf_LDADD = \
21 $(top_builddir)/lib/libbamf/libbamf$(LIBBAMF_VER).la \22 $(top_builddir)/lib/libbamf/libbamf$(LIBBAMF_VER).la \
23 $(COVERAGE_LDFLAGS) \
22 $(GLIB_LIBS) \24 $(GLIB_LIBS) \
23 $(GTK_LIBS) \25 $(GTK_LIBS) \
24 $(DBUS_LIBS)26 $(DBUS_LIBS)

Subscribers

People subscribed via source and target branches