summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5857e88)
raw | patch | inline | side by side (parent: 5857e88)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 28 Apr 2014 05:57:46 +0000 (07:57 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Mon, 28 Apr 2014 05:57:46 +0000 (07:57 +0200) |
Added a test using very simple configuration snippets.
.gitignore | patch | blob | history | |
t/Makefile.am | patch | blob | history | |
t/integration/simple_config.sh | [new file with mode: 0755] | patch | blob |
t/integration/test_lib.sh | [new file with mode: 0644] | patch | blob |
diff --git a/.gitignore b/.gitignore
index 7ebb01e388edf9f3e235c5cc443fbeeec5dcc917..b9cfd1d8f493d441ba26eb968437690f7057ad47 100644 (file)
--- a/.gitignore
+++ b/.gitignore
*.o
sysdb.h
-# unit testing output
+# integration/unit testing output
+t/integration/*.sh.log
+t/integration/*.sh.trs
t/unit/libsysdb_test
t/unit/libsysdb_net_test
t/unit/*.log
diff --git a/t/Makefile.am b/t/Makefile.am
index 4764a6ed276d5fdd9a71469975816f75388dd5e3..504e88c957be3f5e37aa0e745614b1a20054d460 100644 (file)
--- a/t/Makefile.am
+++ b/t/Makefile.am
AM_LDFLAGS = @COVERAGE_LDFLAGS@
AM_CPPFLAGS = -I$(top_srcdir)/src/include
-TESTS = unit/libsysdb_test unit/libsysdb_net_test
-check_PROGRAMS = unit/libsysdb_test unit/libsysdb_net_test
+TESTS =
+check_PROGRAMS =
+
+#
+# unit tests
+#
+
+TESTS += unit/libsysdb_test unit/libsysdb_net_test
+check_PROGRAMS += unit/libsysdb_test unit/libsysdb_net_test
unit_libsysdb_test_SOURCES = \
unit/libsysdb_test.c unit/libsysdb_test.h \
unit_libsysdb_net_test_CFLAGS = $(AM_CFLAGS) @CHECK_CFLAGS@ -I$(top_srcdir)/t/unit
unit_libsysdb_net_test_LDADD = $(top_builddir)/src/libsysdb.la @CHECK_LIBS@
+#
+# integration tests
+#
+
+TESTS += integration/simple_config.sh
+
test: check
diff --git a/t/integration/simple_config.sh b/t/integration/simple_config.sh
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/bash
+#
+# SysDB -- t/integration/simple_config.sh
+# Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#
+# Integration tests using simple configuration snippets.
+#
+
+set -e
+
+source "$( dirname "$0" )/test_lib.sh"
+
+cat <<EOF > "$TESTDIR/sysdbd.conf"
+Listen "invalid://address"
+EOF
+
+if "$TOP_SRCDIR/src/sysdbd" -D -C "$TESTDIR/sysdbd.conf"; then
+ echo 'SysDBd accepted invalid listen address; expected: failure' >&2
+ exit 1
+fi
+
+cat <<EOF > "$TESTDIR/sysdbd.conf"
+Listen "$SOCKET_FILE"
+EOF
+
+"$TOP_SRCDIR/src/sysdbd" -D -C "$TESTDIR/sysdbd.conf" &
+sysdbd_pid=$!
+
+wait_for_sysdbd
+kill $!
diff --git a/t/integration/test_lib.sh b/t/integration/test_lib.sh
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# SysDB -- t/integration/test_lib.sh
+# Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#
+# Shell library of test helpers for integration tests.
+#
+
+TOP_SRCDIR="$( readlink -f "$( dirname "$0" )/../.." )"
+TESTDIR="$( mktemp -d )"
+trap "rm -rf '$TESTDIR'" EXIT
+
+mkdir "$TESTDIR/backend"
+cp "$TOP_SRCDIR/t/integration/.libs/mock_plugin.so" "$TESTDIR/backend"
+
+SOCKET_FILE="$TESTDIR/sock"
+PLUGIN_DIR="$TESTDIR"
+
+function wait_for_sysdbd() {
+ local i
+ for (( i=0; i<10; i++ )); do
+ if test -e "$SOCKET_FILE"; then
+ break
+ fi
+ sleep 1
+ done
+ if test $i -eq 10; then
+ echo 'SysDBd did not start within 10 seconds' >&2
+ exit 1
+ fi
+}
+