diff options
Diffstat (limited to 'server/src')
41 files changed, 127 insertions, 129 deletions
diff --git a/server/src/artefact.cc b/server/src/artefact.cc index 8c6b81a..48b8174 100644 --- a/server/src/artefact.cc +++ b/server/src/artefact.cc @@ -152,9 +152,9 @@ QueryResult Artefact::exec(Query &query, #ifdef TEST_ARTEFACT -//deps: configuration.cc debug.cc log.cc -//cflags: $(ATF_CFLAGS) -I.. -//libs: $(ATF_LIBS) +//deps: configuration.cc debug.cc log.cc mutex.cc +//cflags: -I.. $(ATF_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(ATF_LIBS) $(PTHREAD_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/client_connection.cc b/server/src/client_connection.cc index c3de7b0..c952ca7 100644 --- a/server/src/client_connection.cc +++ b/server/src/client_connection.cc @@ -256,7 +256,7 @@ void ClientConnection::getReply(Httpd::Reply &reply) } #ifdef TEST_CLIENT_CONNECTION -//deps: debug.cc transactionparser.cc session.cc xml_encode_decode.cc saxparser.cc transactionhandler.cc journal.cc mutex.cc templateparser.cc exception.cc configuration.cc macroparser.cc semaphore.cc entitylist.cc luaquerymapper.cc inotify.cc log.cc queryhandlerpentominos.cc widgetgenerator.cc queryhandlerpracro.cc resumeparser.cc journal_commit.cc versionstr.cc luaresume.cc luautil.cc artefact.cc environment.cc database.cc macrolist.cc templatelist.cc pracrodao.cc templateheaderparser.cc macroheaderparser.cc pracrodaotest.cc pracrodaopgsql.cc journal_uploadserver.cc sessionserialiser.cc sessionparser.cc widgetvalue.cc courseparser.cc praxisd.cc luapraxisd.cc courselist.cc +//deps: debug.cc transactionparser.cc session.cc xml_encode_decode.cc saxparser.cc transactionhandler.cc journal.cc mutex.cc templateparser.cc exception.cc configuration.cc macroparser.cc semaphore.cc entitylist.cc luaquerymapper.cc inotify.cc log.cc queryhandlerpentominos.cc widgetgenerator.cc queryhandlerpracro.cc journal_commit.cc versionstr.cc luaresume.cc luautil.cc artefact.cc environment.cc database.cc macrolist.cc templatelist.cc pracrodao.cc templateheaderparser.cc macroheaderparser.cc pracrodaotest.cc pracrodaopgsql.cc journal_uploadserver.cc sessionserialiser.cc sessionparser.cc widgetvalue.cc courseparser.cc praxisd.cc luapraxisd.cc courselist.cc luascript.cc sessionheaderparser.cc luaoncommit.cc //cflags: -DWITHOUT_DATABASE -DWITHOUT_ARTEFACT -I.. $(LUA_CFLAGS) $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(PQXX_CXXFLAGS) $(CURL_CFLAGS) //libs: $(LUA_LIBS) $(EXPAT_LIBS) $(PTHREAD_LIBS) $(PQXX_LIBS) $(CURL_LIBS) #include "test.h" @@ -315,7 +315,7 @@ std::string sid; { headers_t hdrs; ClientConnection con(env, hdrs, hdrs, "/test"); - TEST_TRUE(con.handle("", 0), "Test handler return value."); + TEST_TRUE(con.handle(), "Test handler return value."); con.getReply(reply); TEST_NOTEQUAL_STR(reply.data, empty_reply, "Did we get nonemtpy reply?"); TEST_NOTEQUAL_STR(reply.headers["SessionID"], "", @@ -327,7 +327,7 @@ std::string sid; { headers_t hdrs; ClientConnection con(env, hdrs, hdrs, "/test/test"); - TEST_TRUE(con.handle("", 0), "Test handler return value."); + TEST_TRUE(con.handle(), "Test handler return value."); con.getReply(reply); TEST_EQUAL_STR(reply.data, empty_reply, "Did we get an empty reponse?"); TEST_NOTEQUAL_STR(reply.headers["SessionID"], "", "Non empty session id?"); diff --git a/server/src/connectionpool.cc b/server/src/connectionpool.cc index e2b6bfc..16cfd68 100644 --- a/server/src/connectionpool.cc +++ b/server/src/connectionpool.cc @@ -33,7 +33,7 @@ #ifdef TEST_CONNECTIONPOOL //deps: mutex.cc semaphore.cc -//cflags: $(PTHREAD_CFLAGS) +//cflags: -I.. $(PTHREAD_CFLAGS) //libs: $(PTHREAD_LIBS) #include <test.h> #include <unistd.h> diff --git a/server/src/connectionpool.h b/server/src/connectionpool.h index 33473e5..0f1c844 100644 --- a/server/src/connectionpool.h +++ b/server/src/connectionpool.h @@ -133,7 +133,7 @@ int ConnectionPool<T>::numFree() template <class T> T ConnectionPool<T>::borrow() { - T t = NULL; + T t; semaphore.wait(); diff --git a/server/src/courselist.cc b/server/src/courselist.cc index b6d2b29..b2a33c5 100644 --- a/server/src/courselist.cc +++ b/server/src/courselist.cc @@ -58,12 +58,9 @@ void CourseList::addFile(std::string file) } #ifdef TEST_COURSELIST -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: +//deps: entitylist.cc mutex.cc inotify.cc debug.cc courseparser.cc saxparser.cc exception.cc versionstr.cc log.cc +//cflags: -I .. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) +//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/courseparser.cc b/server/src/courseparser.cc index af78ca1..0a9bbd9 100644 --- a/server/src/courseparser.cc +++ b/server/src/courseparser.cc @@ -160,9 +160,9 @@ Course *CourseParser::getCourse() } #ifdef TEST_COURSEPARSER -//deps: saxparser.cc debug.cc log.cc exception.cc -//cflags: -I.. $(EXPAT_CFLAGS) -//libs: $(EXPAT_LIBS) +//deps: saxparser.cc debug.cc log.cc exception.cc mutex.cc +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/environment.cc b/server/src/environment.cc index d232174..fc9c75c 100644 --- a/server/src/environment.cc +++ b/server/src/environment.cc @@ -68,9 +68,9 @@ Environment::~Environment() } #ifdef TEST_ENVIRONMENT -//deps: configuration.cc database.cc artefact.cc pracrodao.cc session.cc mutex.cc semaphore.cc debug.cc pracrodaotest.cc pracrodaopgsql.cc journal.cc journal_commit.cc entitylist.cc inotify.cc exception.cc versionstr.cc tcpsocket.cc macrolist.cc templatelist.cc saxparser.cc log.cc macroheaderparser.cc templateheaderparser.cc sessionserialiser.cc journal_uploadserver.cc xml_encode_decode.cc sessionparser.cc -//cflags: -DWITHOUT_ARTEFACT -I.. $(PQXX_CXXFLAGS) $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) -//libs: $(PQXX_LIBS) -lpthread $(EXPAT_LIBS) $(PTHREAD_LIBS) +//deps: configuration.cc database.cc artefact.cc pracrodao.cc session.cc mutex.cc semaphore.cc debug.cc pracrodaotest.cc pracrodaopgsql.cc journal.cc journal_commit.cc entitylist.cc inotify.cc exception.cc versionstr.cc tcpsocket.cc macrolist.cc templatelist.cc saxparser.cc log.cc macroheaderparser.cc templateheaderparser.cc sessionserialiser.cc journal_uploadserver.cc xml_encode_decode.cc sessionparser.cc sessionheaderparser.cc luascript.cc courselist.cc luapraxisd.cc praxisd.cc luautil.cc courseparser.cc +//cflags: -DWITHOUT_ARTEFACT -I.. $(PQXX_CXXFLAGS) $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) +//libs: $(PQXX_LIBS) -lpthread $(EXPAT_LIBS) $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/fieldnamescanner.cc b/server/src/fieldnamescanner.cc index ba3b61f..d8b10f1 100644 --- a/server/src/fieldnamescanner.cc +++ b/server/src/fieldnamescanner.cc @@ -131,8 +131,8 @@ templates_t scanfieldnames(Environment &env, std::set<std::string> &filter) #ifdef TEST_FIELDNAMESCANNER //deps: util.cc configuration.cc debug.cc log.cc templateparser.cc exception.cc saxparser.cc macrolist.cc entitylist.cc inotify.cc mutex.cc macroheaderparser.cc versionstr.cc macroparser.cc -//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) -//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(ATF_CFLAGS) $(OPENSSL_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(ATF_LIBS) $(OPENSSL_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/httpd.cc b/server/src/httpd.cc index 9349697..6682629 100644 --- a/server/src/httpd.cc +++ b/server/src/httpd.cc @@ -264,9 +264,9 @@ bool Httpd::is_running_ssl() } #ifdef TEST_HTTPD -//deps: debug.cc log.cc -//cflags: -I.. $(HTTPD_CFLAGS) -//libs: $(HTTPD_LIBS) -lcurl +//deps: debug.cc log.cc mutex.cc +//cflags: -I.. $(HTTPD_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(HTTPD_LIBS) $(CURL_LIBS) $(PTHREAD_LIBS) #include "test.h" #include <curl/curl.h> diff --git a/server/src/inotify.cc b/server/src/inotify.cc index cba781a..14a47bc 100644 --- a/server/src/inotify.cc +++ b/server/src/inotify.cc @@ -386,9 +386,9 @@ void INotify::clear() } #ifdef TEST_INOTIFY -//deps: debug.cc log.cc -//cflags: -I.. -//libs: +//deps: debug.cc log.cc mutex.cc +//cflags: -I.. $(PTHREAD_CFLAGS) +//libs: $(PTHREAD_LIBS) #include "test.h" #include <stdio.h> diff --git a/server/src/journal.cc b/server/src/journal.cc index 04b1459..f5eeed7 100644 --- a/server/src/journal.cc +++ b/server/src/journal.cc @@ -167,9 +167,9 @@ void Journal::runOnCommitScripts() throw(LUAScript::Exception) #ifdef TEST_JOURNAL -//deps: debug.cc log.cc journal_uploadserver.cc journal_commit.cc -//cflags: -I.. -//libs: +//deps: debug.cc log.cc journal_uploadserver.cc journal_commit.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc saxparser.cc luautil.cc configuration.cc +//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS) +//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS) #include <test.h> TEST_BEGIN; diff --git a/server/src/journal_commit.cc b/server/src/journal_commit.cc index d765ebb..1bfd9e8 100644 --- a/server/src/journal_commit.cc +++ b/server/src/journal_commit.cc @@ -145,9 +145,9 @@ int journal_commit(const char *cpr, const char *user, } #ifdef TEST_JOURNAL_COMMIT -//deps: debug.cc log.cc -//cflags: -I.. -//libs: +//deps: debug.cc log.cc mutex.cc +//cflags: -I.. $(PTHREAD_CFLAGS) +//libs: $(PTHREAD_LIBS) #include <test.h> TEST_BEGIN; diff --git a/server/src/journal_uploadserver.cc b/server/src/journal_uploadserver.cc index eac6cd5..3d433a2 100644 --- a/server/src/journal_uploadserver.cc +++ b/server/src/journal_uploadserver.cc @@ -238,9 +238,9 @@ void JournalUploadServer::commit() #ifdef TEST_JOURNAL_UPLOADSERVER -//deps: debug.cc log.cc journal.cc journal_commit.cc -//cflags: -I.. -//libs: +//deps: debug.cc log.cc journal.cc journal_commit.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc +//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS) +//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS) #include "test.h" #define LONG "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do\neiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \n\n \t"; diff --git a/server/src/luaoncommit.cc b/server/src/luaoncommit.cc index 8e96066..aa15cdb 100644 --- a/server/src/luaoncommit.cc +++ b/server/src/luaoncommit.cc @@ -52,12 +52,9 @@ LUAOnCommit::LUAOnCommit(Transaction &t, Commit &c) : LUAScript() } #ifdef TEST_LUAONCOMMIT -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: +//deps: debug.cc log.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc +//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS) +//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/luapraxisd.cc b/server/src/luapraxisd.cc index da34d32..b12eace 100644 --- a/server/src/luapraxisd.cc +++ b/server/src/luapraxisd.cc @@ -38,7 +38,7 @@ (lua_isboolean(L,i) ? lua_toboolean(L,i) : luaL_checkint(L,i)) #define error(L, m) \ - ERR(luapraxisd, "%s\n", m); lua_pushstring(L, m); lua_error(L); + { ERR(luapraxisd, "%s\n", m); lua_pushstring(L, m); lua_error(L); } typedef struct px_userdata { Praxisd *px; diff --git a/server/src/luaquerymapper.cc b/server/src/luaquerymapper.cc index 56ea1e9..defe1ae 100644 --- a/server/src/luaquerymapper.cc +++ b/server/src/luaquerymapper.cc @@ -262,9 +262,9 @@ std::string LUAQueryMapper::automap(const std::string &name) } #ifdef TEST_LUAQUERYMAPPER -//deps: exception.cc log.cc debug.cc luautil.cc -//cflags: -I.. ${LUA_CFLAGS} -//libs:${LUA_LIBS} +//deps: exception.cc debug.cc log.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc +//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS) +//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS) #include <test.h> TEST_BEGIN; diff --git a/server/src/luaresume.cc b/server/src/luaresume.cc index 1db4fb3..a0a3ade 100644 --- a/server/src/luaresume.cc +++ b/server/src/luaresume.cc @@ -50,9 +50,9 @@ LUAResume::LUAResume(Transaction &t, Commit &c) : LUAScript() } #ifdef TEST_LUARESUME -//deps: debug.cc log.cc luautil.cc -//cflags: -I.. $(LUA_CFLAGS) -//libs: $(LUA_LIBS) +//deps: exception.cc debug.cc log.cc mutex.cc luascript.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc +//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS) +//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS) #include <test.h> TEST_BEGIN; diff --git a/server/src/luascript.cc b/server/src/luascript.cc index 6ba52a9..e46aa8d 100644 --- a/server/src/luascript.cc +++ b/server/src/luascript.cc @@ -299,12 +299,9 @@ void LUAScript::setEnv(LUAScript::env_t id, std::string value) } #ifdef TEST_LUASCRIPT -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: +//deps: exception.cc debug.cc log.cc mutex.cc luapraxisd.cc praxisd.cc luautil.cc saxparser.cc configuration.cc +//cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) $(EXPAT_CFLAGS) +//libs: $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) $(EXPAT_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/macroheaderparser.cc b/server/src/macroheaderparser.cc index 3262888..8db14dc 100644 --- a/server/src/macroheaderparser.cc +++ b/server/src/macroheaderparser.cc @@ -146,9 +146,9 @@ Macro *MacroHeaderParser::getMacro() } #ifdef TEST_MACROHEADERPARSER -//deps: debug.cc log.cc saxparser.cc exception.cc -//cflags: -I.. $(EXPAT_CFLAGS) -//libs: $(EXPAT_LIBS) +//deps: debug.cc log.cc saxparser.cc exception.cc mutex.cc +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) #include <test.h> #define XMLFILE "/tmp/test_macroheaderparser.xml" diff --git a/server/src/macroparser.cc b/server/src/macroparser.cc index be781aa..8506a7b 100644 --- a/server/src/macroparser.cc +++ b/server/src/macroparser.cc @@ -392,9 +392,9 @@ Macro *MacroParser::getMacro() } #ifdef TEST_MACROPARSER -//deps: debug.cc log.cc saxparser.cc exception.cc -//cflags: -I.. $(EXPAT_CFLAGS) -//libs: $(EXPAT_LIBS) +//deps: debug.cc log.cc saxparser.cc exception.cc mutex.cc +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) #include <test.h> #define XMLFILE "/tmp/test_macroheaderparser.xml" diff --git a/server/src/mutex.cc b/server/src/mutex.cc index 9805591..d5e9a6f 100644 --- a/server/src/mutex.cc +++ b/server/src/mutex.cc @@ -27,8 +27,6 @@ */ #include "mutex.h" -#include "debug.h" - #define MUTEX_DBG(x) //#define MUTEX_DBG(x) x diff --git a/server/src/pracrodaopgsql.cc b/server/src/pracrodaopgsql.cc index db0a9aa..3c7040a 100644 --- a/server/src/pracrodaopgsql.cc +++ b/server/src/pracrodaopgsql.cc @@ -627,9 +627,9 @@ void PracroDAOPgsql::setIdle(std::string sessionid, bool idle) #endif/*WITHOUT_DB*/ #ifdef TEST_PRACRODAOPGSQL -//deps: debug.cc log.cc configuration.cc exception.cc pracrodao.cc -//cflags: -I.. $(PQXX_CXXFLAGS) -//libs: $(PQXX_LIBS) +//deps: debug.cc log.cc configuration.cc exception.cc pracrodao.cc mutex.cc +//cflags: -I.. $(PQXX_CXXFLAGS) $(PTHREAD_CFLAGS) +//libs: $(PQXX_LIBS) $(PTHREAD_LIBS) #include <test.h> #include <time.h> @@ -681,8 +681,8 @@ commit.fields["field2"] = "world"; commit.templ = "tester"; Macro macro; -macro.attributes["version"] = "1.0"; -macro.attributes["name"] = MACRO; +macro.version = "1.0"; +macro.name = MACRO; time_t now = time(NULL); diff --git a/server/src/pracrodaotest.cc b/server/src/pracrodaotest.cc index 705d4b8..d8b151d 100644 --- a/server/src/pracrodaotest.cc +++ b/server/src/pracrodaotest.cc @@ -332,9 +332,9 @@ void PracroDAOTest::discard(std::string sessionid) } #ifdef TEST_PRACRODAOTEST -//deps: debug.cc log.cc configuration.cc exception.cc pracrodao.cc -//cflags: -I.. -//libs: +//deps: debug.cc log.cc configuration.cc exception.cc pracrodao.cc mutex.cc +//cflags: -I.. $(PTHREAD_CFLAGS) +//libs: $(PTHREAD_LIBS) #include <test.h> #include <time.h> @@ -387,8 +387,8 @@ commit.fields["field2"] = "world"; commit.templ = "tester"; Macro macro; -macro.attributes["version"] = "1.0"; -macro.attributes["name"] = MACRO; +macro.version = "1.0"; +macro.name = MACRO; time_t now = time(NULL); diff --git a/server/src/praxisd.cc b/server/src/praxisd.cc index c198051..c8dfa6f 100644 --- a/server/src/praxisd.cc +++ b/server/src/praxisd.cc @@ -1012,9 +1012,9 @@ std::string Praxisd::dokmenu_get_by_cpr_and_name(std::string cpr, } #ifdef TEST_PRAXISD -//deps: saxparser.cc debug.cc log.cc -//cflags: $(CURL_CFLAGS) $(EXPAT_CFLAGS) -I.. -//libs: $(CURL_LIBS) $(EXPAT_LIBS) +//deps: saxparser.cc debug.cc log.cc mutex.cc +//cflags: -I.. $(CURL_CFLAGS) $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(CURL_LIBS) $(EXPAT_LIBS) $(PTHREAD_LIBS) #include "test.h" #define NL "\r\n" diff --git a/server/src/queryhandlerpentominos.cc b/server/src/queryhandlerpentominos.cc index 0b4aeb5..698fc2e 100644 --- a/server/src/queryhandlerpentominos.cc +++ b/server/src/queryhandlerpentominos.cc @@ -45,9 +45,9 @@ QueryResult QueryHandlerPentominos::exec(Query &query) } #ifdef TEST_QUERYHANDLERPENTOMINOS -//deps: artefact.cc configuration.cc debug.cc log.cc -//cflags: -I.. $(ATF_CFLAGS) -//libs: $(ATF_LIBS) +//deps: artefact.cc configuration.cc debug.cc log.cc mutex.cc +//cflags: -I.. $(ATF_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(ATF_LIBS) $(PTHREAD_LIBS) #include <test.h> #include "tcpsocket.h" diff --git a/server/src/queryhandlerpracro.cc b/server/src/queryhandlerpracro.cc index e95d4ff..1187c06 100644 --- a/server/src/queryhandlerpracro.cc +++ b/server/src/queryhandlerpracro.cc @@ -77,8 +77,8 @@ QueryResult QueryHandlerPracro::exec(Query &query) #ifdef TEST_QUERYHANDLERPRACRO //deps: database.cc mutex.cc debug.cc log.cc pracrodao.cc pracrodaotest.cc pracrodaopgsql.cc configuration.cc -//cflags: -I.. $(PQXX_CXXFLAGS) -//libs: $(PQXX_LIBS) +//cflags: -I.. $(PQXX_CXXFLAGS) $(PTHREAD_CFLAGS) +//libs: $(PQXX_LIBS) $(PTHREAD_LIBS) #include <test.h> #include <time.h> diff --git a/server/src/queryparser.cc b/server/src/queryparser.cc index 138b7ab..84f7437 100644 --- a/server/src/queryparser.cc +++ b/server/src/queryparser.cc @@ -88,9 +88,9 @@ void QueryParser::parseError(const char *buf, size_t len, std::string error, int } #ifdef TEST_QUERYPARSER -//deps: saxparser.cc debug.cc log.cc utf8.cc exception.cc -//cflags: -I.. $(EXPAT_CFLAGS) -//libs: $(EXPAT_LIBS) +//deps: saxparser.cc debug.cc log.cc utf8.cc exception.cc mutex.cc +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) #include <test.h> #include <string.h> diff --git a/server/src/saxparser.cc b/server/src/saxparser.cc index 14f204c..e01af83 100644 --- a/server/src/saxparser.cc +++ b/server/src/saxparser.cc @@ -198,9 +198,9 @@ void SAXParser::characterData(std::string &) } #ifdef TEST_SAXPARSER -//deps: log.cc debug.cc exception.cc -//cflags: -I.. -//libs: -lexpat +//deps: log.cc debug.cc exception.cc mutex.cc +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) #include <test.h> #define XMLFILE "/tmp/saxparsertest.xml" diff --git a/server/src/server.cc b/server/src/server.cc index 838da32..8592ad9 100644 --- a/server/src/server.cc +++ b/server/src/server.cc @@ -138,14 +138,17 @@ void server() } #ifdef TEST_SERVER -//deps: httpd.cc session.cc configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc client_connection.cc admin_connection.cc admin_rc.cc admin_export.cc transactionparser.cc transactionhandler.cc templateparser.cc macroparser.cc queryhandlerpracro.cc luaquerymapper.cc queryhandlerpentominos.cc resumeparser.cc luaresume.cc luautil.cc widgetgenerator.cc widgetvalue.cc -//cflags: -I.. -DWITHOUT_ARTEFACT -DWITHOUT_DB $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(HTTPD_CFLAGS) $(LUA_CFLAGS) -//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(HTTPD_LIBS) $(LUA_LIBS) +//deps: httpd.cc session.cc configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc client_connection.cc admin_connection.cc admin_rc.cc admin_export.cc transactionparser.cc transactionhandler.cc templateparser.cc macroparser.cc queryhandlerpracro.cc luaquerymapper.cc queryhandlerpentominos.cc luaresume.cc widgetgenerator.cc widgetvalue.cc luascript.cc luautil.cc luapraxisd.cc praxisd.cc sessionheaderparser.cc courseparser.cc courselist.cc luaoncommit.cc +//cflags: -I.. -DWITHOUT_ARTEFACT -DWITHOUT_DB $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(HTTPD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(HTTPD_LIBS) $(LUA_LIBS) $(CURL_LIBS) #include <test.h> #include <sys/types.h> #include <signal.h> +// Thsese are globals normally defined in pracrod.cc: +std::string logfile; +volatile bool logfile_reload; bool pracro_is_running = true; char request[] = diff --git a/server/src/session.cc b/server/src/session.cc index ea4d11c..4ee1041 100644 --- a/server/src/session.cc +++ b/server/src/session.cc @@ -400,9 +400,9 @@ SessionAutounlock::~SessionAutounlock() } #ifdef TEST_SESSION -//deps: configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc -//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) -DWITHOUT_ARTEFACT -DWITHOUT_DB -//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS) +//deps: configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc sessionheaderparser.cc luascript.cc luautil.cc luapraxisd.cc praxisd.cc courselist.cc courseparser.cc +//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) -DWITHOUT_ARTEFACT -DWITHOUT_DB $(LUA_CFLAGS) $(CURL_CFLAGS) +//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS) $(LUA_LIBS) $(CURL_LIBS) #include <test.h> #define PID "1505050505" @@ -410,6 +410,10 @@ SessionAutounlock::~SessionAutounlock() TEST_BEGIN; +// TODO: Put some testcode here (see test.h for usable macros). +TEST_TRUE(false, "No tests yet!"); + +/* debug_parse("+all"); Conf::database_backend = "testdb"; @@ -531,7 +535,7 @@ TEST_TRUE(s9->isReadonly(), "Read only session."); TEST_FALSE(s9->idle(), "Readonly session is not idle."); s9->setIdle(true); // Force idle (no effect) TEST_FALSE(s9->idle(), "Readonly session still not idle."); - +*/ TEST_END; #endif/*TEST_SESSION*/ diff --git a/server/src/sessionheaderparser.cc b/server/src/sessionheaderparser.cc index c9a8e67..8602196 100644 --- a/server/src/sessionheaderparser.cc +++ b/server/src/sessionheaderparser.cc @@ -164,12 +164,9 @@ SessionHeaderParser::Header SessionHeaderParser::getHeader() } #ifdef TEST_SESSIONHEADERPARSER -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: +//deps: saxparser.cc debug.cc log.cc exception.cc mutex.cc +//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) +//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/sessionparser.cc b/server/src/sessionparser.cc index 8913e3c..d9e2c9a 100644 --- a/server/src/sessionparser.cc +++ b/server/src/sessionparser.cc @@ -187,9 +187,9 @@ void SessionParser::parseError(const char *buf, size_t len, } #ifdef TEST_SESSIONPARSER -//deps: saxparser.cc debug.cc log.cc -//cflags: -I.. $(EXPAT_CFLAGS) -//libs: $(EXPAT_LIBS) +//deps: saxparser.cc debug.cc log.cc mutex.cc luascript.cc luautil.cc luapraxisd.cc praxisd.cc configuration.cc +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(LUA_LIBS) $(CURL_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/sessionserialiser.cc b/server/src/sessionserialiser.cc index 6288ddd..4e52d79 100644 --- a/server/src/sessionserialiser.cc +++ b/server/src/sessionserialiser.cc @@ -342,9 +342,9 @@ SessionSerialiser::sessionFiles() #ifdef TEST_SESSIONSERIALISER -//deps: session.cc journal.cc debug.cc configuration.cc mutex.cc journal_commit.cc sessionparser.cc saxparser.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc journal_uploadserver.cc log.cc environment.cc semaphore.cc artefact.cc macrolist.cc templatelist.cc entitylist.cc inotify.cc versionstr.cc exception.cc macroheaderparser.cc templateheaderparser.cc -//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) $(PQXX_CFLAGS) -DWITHOUT_ARTEFACT -//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS) $(PQXX_LIBS) +//deps: session.cc journal.cc debug.cc configuration.cc mutex.cc journal_commit.cc sessionparser.cc saxparser.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc journal_uploadserver.cc log.cc environment.cc semaphore.cc artefact.cc macrolist.cc templatelist.cc entitylist.cc inotify.cc versionstr.cc exception.cc macroheaderparser.cc templateheaderparser.cc sessionheaderparser.cc luascript.cc luautil.cc luapraxisd.cc praxisd.cc courselist.cc courseparser.cc +//cflags: -I.. $(PTHREAD_CFLAGS) $(EXPAT_CFLAGS) $(PQXX_CFLAGS) -DWITHOUT_ARTEFACT $(LUA_CFLAGS) $(CURL_CFLAGS) +//libs: $(PTHREAD_LIBS) $(EXPAT_LIBS) $(PQXX_LIBS) $(LUA_LIBS) $(CURL_LIBS) #include "test.h" #include <stdio.h> @@ -355,6 +355,10 @@ SessionSerialiser::sessionFiles() TEST_BEGIN; +// TODO: Put some testcode here (see test.h for usable macros). +TEST_TRUE(false, "No tests yet!"); + +#if 0 // Make sure we start out on an empty session directory. std::string spath = "/tmp/test_sessionserialiser"; while(mkdir(spath.c_str(), 0777) == -1 && errno == EEXIST) { @@ -443,6 +447,7 @@ Environment env; TEST_EQUAL(s1->templ, TID, "Compare found tuple."); delete s1; } +#endif/*0*/ TEST_END; diff --git a/server/src/tcpsocket.cc b/server/src/tcpsocket.cc index b54b581..fc4dab2 100644 --- a/server/src/tcpsocket.cc +++ b/server/src/tcpsocket.cc @@ -367,9 +367,9 @@ std::string TCPSocket::dstaddr() } #ifdef TEST_TCPSOCKET -//deps: exception.cc debug.cc log.cc -//cflags: -I.. -//libs: +//deps: exception.cc debug.cc log.cc mutex.cc +//cflags: -I.. $(PTHREAD_CFLAGS) +//libs: $(PTHREAD_LIBS) #include <test.h> #define PORT 12346 diff --git a/server/src/templateheaderparser.cc b/server/src/templateheaderparser.cc index 57b0a4e..b2c68e3 100644 --- a/server/src/templateheaderparser.cc +++ b/server/src/templateheaderparser.cc @@ -147,9 +147,9 @@ Template *TemplateHeaderParser::getTemplate() } #ifdef TEST_TEMPLATEHEADERPARSER -//deps: saxparser.cc exception.cc debug.cc log.cc -//cflags: -I.. $(EXPAT_CFLAGS) -//libs: $(EXPAT_LIBS) +//deps: saxparser.cc exception.cc debug.cc log.cc mutex.cc +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) #include <test.h> #define XMLFILE "/tmp/test_templateheaderparser.xml" diff --git a/server/src/templateparser.cc b/server/src/templateparser.cc index 8fc3eff..a71ccfb 100644 --- a/server/src/templateparser.cc +++ b/server/src/templateparser.cc @@ -225,9 +225,9 @@ Template *TemplateParser::getTemplate() } #ifdef TEST_TEMPLATEPARSER -//deps: saxparser.cc debug.cc log.cc exception.cc -//cflags: -I.. $(EXPAT_CFLAGS) -//libs: $(EXPAT_LIBS) +//deps: saxparser.cc debug.cc log.cc exception.cc mutex.cc +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) #include <test.h> #define XMLFILE "/tmp/test_templateparser.xml" diff --git a/server/src/transactionhandler.cc b/server/src/transactionhandler.cc index 6ab3d89..1623d56 100644 --- a/server/src/transactionhandler.cc +++ b/server/src/transactionhandler.cc @@ -358,9 +358,9 @@ std::string handleTransaction(Request &request, } #ifdef TEST_TRANSACTIONHANDLER -//deps: session.cc configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc client_connection.cc admin_connection.cc admin_rc.cc admin_export.cc transactionparser.cc templateparser.cc macroparser.cc queryhandlerpracro.cc luaquerymapper.cc queryhandlerpentominos.cc resumeparser.cc luaresume.cc luautil.cc widgetgenerator.cc widgetvalue.cc -//cflags: -I.. -DWITHOUT_ARTEFACT -DWITHOUT_DB $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(HTTPD_CFLAGS) $(LUA_CFLAGS) -//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(HTTPD_LIBS) $(LUA_LIBS) +//deps: session.cc configuration.cc journal.cc journal_uploadserver.cc journal_commit.cc mutex.cc debug.cc sessionserialiser.cc sessionparser.cc saxparser.cc environment.cc semaphore.cc artefact.cc xml_encode_decode.cc database.cc pracrodaopgsql.cc pracrodaotest.cc pracrodao.cc entitylist.cc macrolist.cc templatelist.cc macroheaderparser.cc templateheaderparser.cc versionstr.cc exception.cc log.cc inotify.cc client_connection.cc admin_connection.cc admin_rc.cc admin_export.cc transactionparser.cc templateparser.cc macroparser.cc queryhandlerpracro.cc luaquerymapper.cc queryhandlerpentominos.cc luaresume.cc luautil.cc widgetgenerator.cc widgetvalue.cc luascript.cc luapraxisd.cc praxisd.cc sessionheaderparser.cc courselist.cc luaoncommit.cc courseparser.cc +//cflags: -I.. -DWITHOUT_ARTEFACT -DWITHOUT_DB $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) $(HTTPD_CFLAGS) $(LUA_CFLAGS) $(CURL_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) $(HTTPD_LIBS) $(LUA_LIBS) $(CURL_LIBS) #include "test.h" TEST_BEGIN; diff --git a/server/src/transactionparser.cc b/server/src/transactionparser.cc index a52d797..fbead8d 100644 --- a/server/src/transactionparser.cc +++ b/server/src/transactionparser.cc @@ -97,9 +97,9 @@ void TransactionParser::parseError(const char *buf, size_t len, } #ifdef TEST_TRANSACTIONPARSER -//deps: saxparser.cc debug.cc exception.cc log.cc -//cflags: -I.. $(EXPAT_CFLAGS) -//libs: $(EXPAT_LIBS) +//deps: saxparser.cc debug.cc exception.cc log.cc mutex.cc +//cflags: -I.. $(EXPAT_CFLAGS) $(PTHREAD_CFLAGS) +//libs: $(EXPAT_LIBS) $(PTHREAD_LIBS) #include "test.h" static char xml_minimal[] = diff --git a/server/src/util.cc b/server/src/util.cc index 4c049bd..d1085a4 100644 --- a/server/src/util.cc +++ b/server/src/util.cc @@ -77,9 +77,9 @@ void printcolumn(std::string text, size_t width) } #ifdef TEST_UTIL -//deps: configuration.cc debug.cc log.cc -//cflags: -I.. -//libs: +//deps: configuration.cc debug.cc log.cc mutex.cc +//cflags: -I.. $(PTHREAD_CFLAGS) +//libs: $(PTHREAD_LIBS) #include <test.h> TEST_BEGIN; diff --git a/server/src/widgetgenerator.cc b/server/src/widgetgenerator.cc index 7f8e8c4..d3cfe9e 100644 --- a/server/src/widgetgenerator.cc +++ b/server/src/widgetgenerator.cc @@ -103,7 +103,7 @@ std::string widgetgenerator(std::string cpr, std::string sessionid, } #ifdef TEST_WIDGETGENERATOR -//deps: log.cc mutex.cc debug.cc xml_encode_decode.cc widgetvalue.cc luaquerymapper.cc configuration.cc exception.cc +//deps: log.cc mutex.cc debug.cc xml_encode_decode.cc widgetvalue.cc luaquerymapper.cc configuration.cc exception.cc luautil.cc //cflags: -I.. $(PTHREAD_CFLAGS) $(LUA_CFLAGS) //libs: $(PTHREAD_LIBS) $(LUA_LIBS) #include <test.h> diff --git a/server/src/widgetvalue.cc b/server/src/widgetvalue.cc index 71f27f4..7e176bb 100644 --- a/server/src/widgetvalue.cc +++ b/server/src/widgetvalue.cc @@ -137,9 +137,9 @@ bool getValue(Value &value, #ifdef TEST_WIDGETVALUE -//deps: debug.cc exception.cc log.cc configuration.cc luaquerymapper.cc -//cflags: -I.. $(LUA_CXXFLAGS) -//libs: $(LUA_LIBS) +//deps: debug.cc exception.cc log.cc configuration.cc luaquerymapper.cc mutex.cc luautil.cc +//cflags: -I.. $(LUA_CXXFLAGS) $(PTHREAD_CFLAGS) +//libs: $(LUA_LIBS) $(PTHREAD_LIBS) #include "test.h" TEST_BEGIN; |