Browse Source
huge changes in build system. Moved a lot of stuff to separate archives, not finished right now. Additionally add some support for coverage reports. Next step after build restructuring is to write tests.
release0.1.5
huge changes in build system. Moved a lot of stuff to separate archives, not finished right now. Additionally add some support for coverage reports. Next step after build restructuring is to write tests.
release0.1.5
47 changed files with 372 additions and 190 deletions
-
5.gitignore
-
2Makefile.am
-
27Makefile.am.coverage
-
18configure.ac
-
40include/auth.h
-
45include/auth/auth.h
-
6include/auth/credential.h
-
8include/auth/interface/auth.h
-
38include/hash.h
-
42include/hash/hash.h
-
6include/hash/interface/hashable.h
-
0include/hash/value.h
-
16include/http.h
-
1include/http/message.h
-
77m4/gcov.m4
-
59src/Makefile.am
-
6src/auth/Makefile.am
-
4src/auth/credential.c
-
6src/auth/interface/auth.c
-
8src/auth/ldap.c
-
BINsrc/auth/libauth.a
-
13src/cbuf/Makefile.am
-
0src/cbuf/cbuf.c
-
BINsrc/cbuf/libcbuf.a
-
2src/class/Makefile.am
-
BINsrc/class/libclass.a
-
9src/hash/Makefile.am
-
1src/hash/add.c
-
1src/hash/delete.c
-
1src/hash/get.c
-
2src/hash/hash.c
-
2src/hash/interface/hashable.c
-
BINsrc/hash/libhash.a
-
7src/hash/value.c
-
41src/http/Makefile.am
-
4src/http/cookie.c
-
2src/http/header.c
-
BINsrc/http/libhttp.a
-
4src/http/message.c
-
1src/http/parser/header.c
-
1src/http/parser/post_vars.c
-
1src/http/parser/request_vars.c
-
1src/http/request.c
-
1src/http/worker.c
-
4src/http/worker/process.c
-
2src/taskrambler.c
-
48tests/Makefile.am
@ -0,0 +1,27 @@ |
|||
|
|||
# Coverage targets
|
|||
|
|||
if HAVE_GCOV |
|||
|
|||
.PHONY: clean-gcda |
|||
clean-gcda: |
|||
@echo Removing old coverage results |
|||
-find -name '*.gcda' -print | xargs -r rm |
|||
|
|||
.PHONY: coverage-html generate-coverage-html clean-coverage-html |
|||
coverage-html: clean-gcda |
|||
-$(MAKE) $(AM_MAKEFLAGS) -k check |
|||
$(MAKE) $(AM_MAKEFLAGS) generate-coverage-html |
|||
|
|||
generate-coverage-html: |
|||
@echo Collecting coverage data |
|||
$(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool |
|||
LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info |
|||
|
|||
clean-coverage-html: clean-gcda |
|||
-$(LCOV) --directory $(top_builddir) -z |
|||
-rm -rf coverage.info coveragereport |
|||
|
|||
clean-local: clean-coverage-html |
|||
|
|||
endif # HAVE_GCOV
|
|||
@ -1,44 +1,10 @@ |
|||
/** |
|||
* \file |
|||
* Authenticatio module factory |
|||
* |
|||
* A factory to get a specific authentication module. |
|||
* An authentication module is a class that implement the Auth interface. |
|||
* |
|||
* \author Georg Hopp |
|||
* |
|||
* \copyright |
|||
* Copyright © 2012 Georg Hopp |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* 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, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#ifndef __AUTH_H__ |
|||
#define __AUTH_H__ |
|||
|
|||
#include "class.h" |
|||
#include "auth/auth.h" |
|||
#include "auth/ldap.h" |
|||
|
|||
typedef enum e_AuthModule { |
|||
AUTH_LDAP = 0 |
|||
} AuthModule; |
|||
|
|||
CLASS(Auth) { |
|||
}; |
|||
|
|||
void * authCreateById(Auth, int); |
|||
AuthLdap authCreateLdap(Auth); |
|||
#include "auth/credential.h" |
|||
#include "auth/interface/auth.h" |
|||
|
|||
#endif // __AUTH_H__ |
|||
|
|||
|
|||
@ -0,0 +1,45 @@ |
|||
/** |
|||
* \file |
|||
* Authenticatio module factory |
|||
* |
|||
* A factory to get a specific authentication module. |
|||
* An authentication module is a class that implement the Auth interface. |
|||
* |
|||
* \author Georg Hopp |
|||
* |
|||
* \copyright |
|||
* Copyright © 2012 Georg Hopp |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* 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, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#ifndef __AUTH_AUTH_H__ |
|||
#define __AUTH_AUTH_H__ |
|||
|
|||
#include "class.h" |
|||
#include "auth/ldap.h" |
|||
|
|||
typedef enum e_AuthModule { |
|||
AUTH_LDAP = 0 |
|||
} AuthModule; |
|||
|
|||
CLASS(Auth) { |
|||
}; |
|||
|
|||
void * authCreateById(Auth, int); |
|||
AuthLdap authCreateLdap(Auth); |
|||
|
|||
#endif // __AUTH_AUTH_H__ |
|||
|
|||
// vim: set ts=4 sw=4: |
|||
@ -1,41 +1,9 @@ |
|||
/** |
|||
* \file |
|||
* |
|||
* \author Georg Hopp |
|||
* |
|||
* \copyright |
|||
* Copyright © 2012 Georg Hopp |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* 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, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#ifndef __HASH_H__ |
|||
#define __HASH_H__ |
|||
|
|||
#include <sys/types.h> |
|||
|
|||
#include "class.h" |
|||
|
|||
|
|||
CLASS(Hash) { |
|||
void * root; |
|||
}; |
|||
|
|||
void * hashAdd(Hash, void *); |
|||
void * hashDelete(Hash, const char *, size_t); |
|||
void * hashGet(Hash, const char *, size_t); |
|||
void hashEach(Hash, void (*)(const void*)); |
|||
#include "hash/hash.h" |
|||
#include "hash/value.h" |
|||
#include "hash/interface/hashable.h" |
|||
|
|||
#endif // __HASH_H__ |
|||
|
|||
|
|||
@ -0,0 +1,42 @@ |
|||
/** |
|||
* \file |
|||
* |
|||
* \author Georg Hopp |
|||
* |
|||
* \copyright |
|||
* Copyright © 2012 Georg Hopp |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* 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, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
#ifndef __HASH_HASH_H__ |
|||
#define __HASH_HASH_H__ |
|||
|
|||
#include <sys/types.h> |
|||
|
|||
#include "class.h" |
|||
|
|||
|
|||
CLASS(Hash) { |
|||
void * root; |
|||
}; |
|||
|
|||
void * hashAdd(Hash, void *); |
|||
void * hashDelete(Hash, const char *, size_t); |
|||
void * hashGet(Hash, const char *, size_t); |
|||
void hashEach(Hash, void (*)(const void*)); |
|||
|
|||
#endif // __HASH_HASH_H__ |
|||
|
|||
// vim: set ts=4 sw=4: |
|||
@ -0,0 +1,16 @@ |
|||
#ifndef __HTTP_H__ |
|||
#define __HTTP_H__ |
|||
|
|||
#include "http/cookie.h" |
|||
#include "http/header.h" |
|||
#include "http/message.h" |
|||
#include "http/message/queue.h" |
|||
#include "http/request.h" |
|||
#include "http/response.h" |
|||
#include "http/parser.h" |
|||
#include "http/writer.h" |
|||
#include "http/worker.h" |
|||
|
|||
#endif // __HTTP_H__ |
|||
|
|||
// vim: set ts=4 sw=4: |
|||
@ -0,0 +1,77 @@ |
|||
# Checks for existence of coverage tools: |
|||
# * gcov |
|||
# * lcov |
|||
# * genhtml |
|||
# * gcovr |
|||
# |
|||
# Sets ac_cv_check_gcov to yes if tooling is present |
|||
# and reports the executables to the variables LCOV, GCOVR and GENHTML. |
|||
AC_DEFUN([AC_TDD_GCOV], |
|||
[ |
|||
AC_ARG_ENABLE(gcov, |
|||
AS_HELP_STRING([--enable-gcov], |
|||
[enable coverage testing with gcov]), |
|||
[use_gcov=$enableval], [use_gcov=no]) |
|||
AM_CONDITIONAL(HAVE_GCOV, test "x$use_gcov" = "xyes") |
|||
|
|||
if test "x$use_gcov" = "xyes"; then |
|||
# we need gcc: |
|||
if test "$GCC" != "yes"; then |
|||
AC_MSG_ERROR([GCC is required for --enable-gcov]) |
|||
fi |
|||
|
|||
# Check if ccache is being used |
|||
AC_CHECK_PROG(SHTOOL, shtool, shtool) |
|||
case `$SHTOOL path $CC` in |
|||
*ccache*[)] gcc_ccache=yes;; |
|||
*[)] gcc_ccache=no;; |
|||
esac |
|||
|
|||
if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then |
|||
AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) |
|||
fi |
|||
|
|||
lcov_version_list="1.6 1.7 1.8 1.9" |
|||
AC_CHECK_PROG(LCOV, lcov, lcov) |
|||
AC_CHECK_PROG(GENHTML, genhtml, genhtml) |
|||
|
|||
if test "$LCOV"; then |
|||
AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [ |
|||
glib_cv_lcov_version=invalid |
|||
lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` |
|||
for lcov_check_version in $lcov_version_list; do |
|||
if test "$lcov_version" = "$lcov_check_version"; then |
|||
glib_cv_lcov_version="$lcov_check_version (ok)" |
|||
fi |
|||
done |
|||
]) |
|||
else |
|||
lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" |
|||
AC_MSG_ERROR([$lcov_msg]) |
|||
fi |
|||
|
|||
case $glib_cv_lcov_version in |
|||
""|invalid[)] |
|||
lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." |
|||
AC_MSG_ERROR([$lcov_msg]) |
|||
LCOV="exit 0;" |
|||
;; |
|||
esac |
|||
|
|||
if test -z "$GENHTML"; then |
|||
AC_MSG_ERROR([Could not find genhtml from the lcov package]) |
|||
fi |
|||
|
|||
# Remove all optimization flags from CFLAGS |
|||
changequote({,}) |
|||
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` |
|||
changequote([,]) |
|||
|
|||
# Add the special gcc flags |
|||
COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage" |
|||
COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" |
|||
COVERAGE_LDFLAGS="-lgcov" |
|||
|
|||
fi |
|||
]) # AC_TDD_GCOV |
|||
|
|||
@ -0,0 +1,6 @@ |
|||
ACLOCAL_AMFLAGS = -I m4 |
|||
|
|||
noinst_LIBRARIES = libauth.a |
|||
|
|||
libauth_a_SOURCES = interface/auth.c credential.c ldap.c |
|||
libauth_a_CFLAGS = -Wall -I ../../include/ |
|||
@ -0,0 +1,13 @@ |
|||
ACLOCAL_AMFLAGS = -I m4 |
|||
|
|||
CB = cbuf.c read.c write.c \
|
|||
get_line.c set_data.c get_data.c \
|
|||
addr_index.c get_free.c get_read.c get_write.c \
|
|||
inc_read.c inc_write.c is_empty.c memchr.c \
|
|||
skip_non_alpha.c is_locked.c lock.c release.c \
|
|||
empty.c |
|||
|
|||
noinst_LIBRARIES = libcbuf.a |
|||
|
|||
libcbuf_a_SOURCES = $(CB) |
|||
libcbuf_a_CFLAGS = -Wall -I ../../include/ |
|||
@ -1,7 +1,5 @@ |
|||
ACLOCAL_AMFLAGS = -I m4 |
|||
|
|||
AM_CFLAGS = -Wall -I ../include/ |
|||
|
|||
noinst_LIBRARIES = libclass.a |
|||
|
|||
libclass_a_SOURCES = interface.c interface/class.c |
|||
|
|||
@ -0,0 +1,9 @@ |
|||
ACLOCAL_AMFLAGS = -I m4 |
|||
|
|||
HASH = hash.c add.c get.c delete.c each.c value.c \
|
|||
interface/hashable.c |
|||
|
|||
noinst_LIBRARIES = libhash.a |
|||
|
|||
libhash_a_SOURCES = $(HASH) |
|||
libhash_a_CFLAGS = -Wall -I ../../include/ |
|||
@ -0,0 +1,41 @@ |
|||
ACLOCAL_AMFLAGS = -I m4 |
|||
|
|||
MSG = message.c \
|
|||
message/has_keep_alive.c \
|
|||
message/header_size_get.c \
|
|||
message/header_to_string.c \
|
|||
message/get_version.c \
|
|||
message/has_valid_version.c |
|||
MSGQ = message/queue.c |
|||
REQ = request.c \
|
|||
request/has_valid_method.c |
|||
RESP = response.c \
|
|||
response/304.c \
|
|||
response/404.c \
|
|||
response/403.c \
|
|||
response/login_form.c \
|
|||
response/asset.c \
|
|||
response/randval.c \
|
|||
response/session.c |
|||
PARSER = parser.c \
|
|||
parser/parse.c \
|
|||
parser/new_message.c \
|
|||
parser/header.c \
|
|||
parser/body.c \
|
|||
parser/request_vars.c \
|
|||
parser/post_vars.c |
|||
WRITER = writer.c \
|
|||
writer/write.c |
|||
WORKER = worker.c \
|
|||
worker/process.c \
|
|||
worker/write.c \
|
|||
worker/get_asset.c \
|
|||
worker/add_common_header.c |
|||
HEADER = header.c \
|
|||
header/to_string.c |
|||
|
|||
noinst_LIBRARIES = libhttp.a |
|||
|
|||
libhttp_a_SOURCES = $(MSG) $(MSGQ) $(REQ) $(RESP) $(PARSER) $(WRITER) \
|
|||
$(WORKER) $(HEADER) |
|||
libhttp_a_CFLAGS = -Wall -I ../../include/ |
|||
@ -1,28 +1,28 @@ |
|||
ACLOCAL_AMFLAGS = -I m4 |
|||
|
|||
TESTS_ENVIRONMENT = valgrind --error-exitcode=123 --leak-check=full --quiet |
|||
TESTS = cclassTest loggerTest socketTest serverTest |
|||
check_PROGRAMS = cclassTest loggerTest socketTest serverTest |
|||
|
|||
COMMON = runtest.c ../src/interface/class.c |
|||
CCLASS = $(COMMON) mock/class.c |
|||
LOGGER = $(COMMON) ../src/logger.c ../src/interface/logger.c \
|
|||
../src/logger/stderr.c ../src/logger/syslog.c |
|||
SOCKET = $(LOGGER) ../src/socket.c ../src/socket/listen.c \
|
|||
../src/socket/accept.c ../src/socket/connect.c |
|||
SERVER = $(SOCKET) ../src/server.c ../src/server/run.c \
|
|||
../src/server/close_conn.c ../src/utils/signalHandling.c |
|||
|
|||
cclassTest_SOURCES = $(CCLASS) cclassTest.c |
|||
cclassTest_CFLAGS = -Wall -ggdb -O0 -finline-functions -I ../include -I .. -I . |
|||
|
|||
loggerTest_SOURCES = $(LOGGER) loggerTest.c |
|||
loggerTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I . |
|||
|
|||
socketTest_SOURCES = $(SOCKET) socketTest.c |
|||
socketTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I . |
|||
|
|||
serverTest_SOURCES = $(SERVER) serverTest.c |
|||
serverTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I . |
|||
#TESTS_ENVIRONMENT = valgrind --error-exitcode=123 --leak-check=full --quiet
|
|||
#TESTS = cclassTest loggerTest socketTest serverTest
|
|||
#check_PROGRAMS = cclassTest loggerTest socketTest serverTest
|
|||
#
|
|||
#COMMON = runtest.c ../src/interface/class.c
|
|||
#CCLASS = $(COMMON) mock/class.c
|
|||
#LOGGER = $(COMMON) ../src/logger.c ../src/interface/logger.c \
|
|||
# ../src/logger/stderr.c ../src/logger/syslog.c
|
|||
#SOCKET = $(LOGGER) ../src/socket.c ../src/socket/listen.c \
|
|||
# ../src/socket/accept.c ../src/socket/connect.c
|
|||
#SERVER = $(SOCKET) ../src/server.c ../src/server/run.c \
|
|||
# ../src/server/close_conn.c ../src/utils/signalHandling.c
|
|||
#
|
|||
#cclassTest_SOURCES = $(CCLASS) cclassTest.c
|
|||
#cclassTest_CFLAGS = -Wall -ggdb -O0 -finline-functions -I ../include -I .. -I .
|
|||
#
|
|||
#loggerTest_SOURCES = $(LOGGER) loggerTest.c
|
|||
#loggerTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I .
|
|||
#
|
|||
#socketTest_SOURCES = $(SOCKET) socketTest.c
|
|||
#socketTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I .
|
|||
#
|
|||
#serverTest_SOURCES = $(SERVER) serverTest.c
|
|||
#serverTest_CFLAGS = -Wall -ggdb -O0 -I ../include -I .. -I .
|
|||
|
|||
EXTRA_DIST = runtest.h mock/class.h |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue