From 68241e8a26ea3d8d2295d1d2cd7c8137db10d7a2 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Wed, 15 Apr 2009 12:33:11 -0400 Subject: [PATCH] Integrate test compilation in the daemon build-system --- Makefile.am | 2 +- src/sipvoiplink.cpp | 16 +++++----------- test/TestMain.cpp | 3 +-- test/run-tests | 24 ++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 14 deletions(-) create mode 100755 test/run-tests diff --git a/Makefile.am b/Makefile.am index 8dc7f28e1d..f774bdf57c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,6 +9,6 @@ unittest: ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = libs src ringtones po man +SUBDIRS = libs src ringtones po man test EXTRA_DIST = m4/*.m4 tools/*.sh platform/* images/* README.gentoo diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index df38379106..41121e3daf 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -28,12 +28,9 @@ #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> -//extern struct state _res; - #define CAN_REINVITE 1 - /**************** EXTERN VARIABLES AND FUNCTIONS (callbacks) **************************/ /* @@ -47,11 +44,11 @@ void get_remote_sdp_from_offer( pjsip_rx_data *rdata, pjmedia_sdp_session** r_sd int getModId(); /** - * * Set audio (SDP) configuration for a call - * * localport, localip, localexternalport - * * @param call a SIPCall valid pointer - * * @return bool True - * */ + * Set audio (SDP) configuration for a call + * localport, localip, localexternalport + * @param call a SIPCall valid pointer + * @return bool True + */ bool setCallAudioLocal(SIPCall* call, std::string localIP, bool stun, std::string server); void handle_incoming_options (pjsip_rx_data *rxdata); @@ -178,8 +175,6 @@ SIPVoIPLink* SIPVoIPLink::_instance = NULL; , _useStun(false) , _clients(0) { - _debug("SIPVoIPLink::~SIPVoIPLink(): sipvoiplink constructor called \n"); - // to get random number for RANDOM_PORT srand (time(NULL)); @@ -191,7 +186,6 @@ SIPVoIPLink* SIPVoIPLink::_instance = NULL; SIPVoIPLink::~SIPVoIPLink() { - _debug("SIPVoIPLink::~SIPVoIPLink(): sipvoiplink destructor called \n"); terminate(); } diff --git a/test/TestMain.cpp b/test/TestMain.cpp index 310732ac59..1bca8aeab1 100644 --- a/test/TestMain.cpp +++ b/test/TestMain.cpp @@ -6,8 +6,7 @@ int main(int argc, const char* argv[]) CppUnit::TextTestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); - runner.run(); + return runner.run(); - return 0; } diff --git a/test/run-tests b/test/run-tests new file mode 100755 index 0000000000..9b5d01405c --- /dev/null +++ b/test/run-tests @@ -0,0 +1,24 @@ +#!/bin/bash + +myname="`basename $0`" +failures=0 + +for f in * +do + # Skip ourself + if [ "$f" = "$myname" ]; then + continue + fi + + if [ -x "$f" ]; then + echo + echo "=== Running [$f] test ===" + # Warning, libCppUnit returns 0 on failure. + ./"$f" && { + echo Warning: Failure in $f. + failures=$((failures+1)) + } + fi +done + +echo "Tests finshed, there were $failures failures." -- GitLab