aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-01-20 09:47:08 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-01-27 11:33:47 +0100
commit1719a724528135e07f7cc7a2a8e6329532905888 (patch)
tree317d4e316ee4d3337856af9b203f8fa554848423
parent6b4e13f43fc22b8afb14477af7b4cf1057ffe855 (diff)
downloadpacrunner-1719a724528135e07f7cc7a2a8e6329532905888.tar.gz
unit: Adding unit test as configurable entry
A stub for pacrunner unit test is also added. Note: the unit test for mozjs will be built only if enabling unit and mozjs is done.
-rw-r--r--Makefile.am12
-rwxr-xr-xbootstrap-configure1
-rw-r--r--configure.ac4
-rw-r--r--unit/test-pacrunner.c31
4 files changed, 47 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 4b2efa4..bc7bce6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -86,8 +86,16 @@ tools_proxy_SOURCES = tools/proxy.c
tools_proxy_LDADD = libproxy/libproxy.la
endif
+if UNIT
+
+noinst_PROGRAMS = unit/test-pacrunner
+
+unit_test_pacrunner_SOURCES = unit/test-pacrunner.c
+
+unit_test_pacrunner_LDADD = @GLIB_LIBS@
+
if MOZJS
-noinst_PROGRAMS = unit/test-mozjs
+noinst_PROGRAMS += unit/test-mozjs
unit_test_mozjs_SOURCES = unit/test-mozjs.c src/pacrunner.h \
src/proxy.c src/manual.c src/download.c \
@@ -96,6 +104,8 @@ unit_test_mozjs_SOURCES = unit/test-mozjs.c src/pacrunner.h \
unit_test_mozjs_LDADD = @MOZJS_LIBS@ @GLIB_LIBS@ @GTHREAD_LIBS@
endif
+endif #UNIT
+
AM_CFLAGS = @GLIB_CFLAGS@ @GTHREAD_LIBS@ @DBUS_CFLAGS@ @CAPNG_CFLAGS@ \
$(builtin_cflags) \
-DPACRUNNER_PLUGIN_BUILTIN \
diff --git a/bootstrap-configure b/bootstrap-configure
index 179fce5..84ab110 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -13,4 +13,5 @@ fi
--enable-libproxy \
--enable-curl \
--enable-mozjs \
+ --enable-unit \
--enable-capng $*
diff --git a/configure.ac b/configure.ac
index 6ca42f6..73b5f8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,10 @@ AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
fi
])
+AC_ARG_ENABLE(unit, AC_HELP_STRING([--enable-unit],
+ [enable compiling unit test binaries]))
+AM_CONDITIONAL(UNIT, test "${enable_unit}" = "yes")
+
AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
[enable position independent executables flag]), [
if (test "${enableval}" = "yes" &&
diff --git a/unit/test-pacrunner.c b/unit/test-pacrunner.c
new file mode 100644
index 0000000..71d6c4c
--- /dev/null
+++ b/unit/test-pacrunner.c
@@ -0,0 +1,31 @@
+/*
+ *
+ * PACrunner - Proxy configuration daemon
+ *
+ * Copyright (C) 2010-2012 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+ return EXIT_SUCCESS;
+}