aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-04-27 15:17:47 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-04-27 15:17:47 -0500
commitea22a6005cd8c2c07447bb7303f542d4e00570ad (patch)
tree3094cc3300bda1559998bc9b1dcda89d08d711af
parent1bab86efd3e4637d61e20364c2859982605850b1 (diff)
parentf2298244150295340ce53a35ea6ff92433105f2c (diff)
downloadayatana-indicator-session-ea22a6005cd8c2c07447bb7303f542d4e00570ad.tar.gz
ayatana-indicator-session-ea22a6005cd8c2c07447bb7303f542d4e00570ad.tar.bz2
ayatana-indicator-session-ea22a6005cd8c2c07447bb7303f542d4e00570ad.zip
use ted's suggestions for using xorg-gtest and to remove the service-test-runner.sh script
-rw-r--r--configure.ac3
-rw-r--r--tests/Makefile.am26
-rw-r--r--tests/test-service.cc17
3 files changed, 18 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac
index e90a05e..de54ff4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -183,13 +183,14 @@ AC_ARG_ENABLE([tests],
if test "x$enable_tests" != "xno"; then
m4_include([m4/gtest.m4])
CHECK_GTEST
+ CHECK_XORG_GTEST
if test "x$enable_tests" = "xauto"; then
enable_tests=${have_gtest}
elif test "x$enable_tests" = "xyes" && test "x$have_gtest" != "xyes"; then
AC_MSG_ERROR([tests were requested but gtest is not installed.])
fi
if test "x$enable_tests" = "xyes"; then
- PKG_CHECK_MODULES([TEST_SERVICE],[indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
+ PKG_CHECK_MODULES([TEST_SERVICE],[indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
dbustest-1 >= $DBUSTEST_REQUIRED_VERSION
dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION])
fi
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c03af4c..0d30bba 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,20 +1,24 @@
-AM_CPPFLAGS = $(GTEST_CPPFLAGS) $(INDICATOR_CFLAGS) -I${top_srcdir}/src -Wall -Werror
+
+AM_CPPFLAGS = \
+ $(GTEST_CPPFLAGS) \
+ $(XORG_GTEST_CPPFLAGS) \
+ $(INDICATOR_CFLAGS) \
+ -I${top_srcdir}/src \
+ -Wall -Werror
AM_CXXFLAGS = $(GTEST_CXXFLAGS)
+TESTS = test-service
check_PROGRAMS = test-service
test_service_SOURCES = test-service.cc
-test_service_LDADD = $(TEST_SERVICE_LIBS) libgtest.a
-test_service_CPPFLAGS = $(TEST_SERVICE_CFLAGS) $(AM_CPPFLAGS)
+test_service_LDADD = $(TEST_SERVICE_LIBS) libgtest.a $(XORG_GTEST_MAIN_LIBS) $(X11_LIBS)
+test_service_CPPFLAGS = \
+ $(TEST_SERVICE_CFLAGS) \
+ $(AM_CPPFLAGS) \
+ -DINDICATOR_SERVICE_PATH="\"$(top_builddir)/src/indicator-session-service\""
check_LIBRARIES = libgtest.a
nodist_libgtest_a_SOURCES = \
+ $(XORG_GTEST_SOURCE)/src/xorg-gtest-all.cpp \
$(GTEST_SOURCE)/src/gtest-all.cc \
- $(GTEST_SOURCE)/src/gtest_main.cc
-
-check_SCRIPTS = test-service-runner.sh
-test-service-runner.sh: Makefile.am
- @echo "#!/bin/sh" > $@
- @echo $(top_builddir)/tests/test-service $(top_builddir)/src/indicator-session-service$(EXEEXT) 2\>/dev/null >> $@
- @chmod +x $@
+ $(XORG_GTEST_SOURCE)/src/xorg-gtest_main.cpp
-TESTS = ${check_SCRIPTS}
diff --git a/tests/test-service.cc b/tests/test-service.cc
index c3d2471..d163db5 100644
--- a/tests/test-service.cc
+++ b/tests/test-service.cc
@@ -25,8 +25,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
****
***/
-static const char * the_executable = NULL;
-
/**
* Fixture class for testing indicator-session-service with Google Test.
*/
@@ -36,7 +34,7 @@ class SessionServiceTest: public IndicatorServiceTest
virtual ~SessionServiceTest() {}
SessionServiceTest(): IndicatorServiceTest(INDICATOR_SESSION_DBUS_NAME,
INDICATOR_SESSION_DBUS_OBJECT,
- the_executable) { }
+ INDICATOR_SERVICE_PATH) { }
public:
virtual void SetUp() {
wait_seconds(1);
@@ -56,16 +54,3 @@ TEST_F(SessionServiceTest, HelloWorld)
ASSERT_TRUE(true);
}
-
-int
-main (int argc, char *argv[])
-{
- if (argc < 2) {
- fprintf (stderr, "Usage: appname /path/to/indicator-session-service");
- return -1;
- }
- the_executable = argv[1];
- fprintf (stdout, "executable is '%s'\n", the_executable);
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}