Skip to content
Snippets Groups Projects
Commit 0debd060 authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

tests: complete rewrite of sip' main()


- use C++11'ish code convention
- init the libdring (add a sample yml configuration)
- keep only cppunit needed code

Change-Id: If635f668ddfc45ace864dd8c43ed2f4f2c83c148
Reviewed-by: default avatarAnthony Léonard <anthony.leonard@savoirfairelinux.com>
parent 8a3cf4c9
No related branches found
No related tags found
No related merge requests found
accounts:
- id: IP2IP
alias: IP2IP
enable: true
type: SIP
allCodecs: 1/2/3/4/5/6/7/8/9/10/11/
mailbox: ""
autoAnswer: false
activeCallLimit: -1
ringtoneEnabled: true
ringtonePath: /usr/share/ring/ringtones/default.wav
hasCustomUserAgent: false
useragent: Ring/3.0.0
displayName: ""
hostname: ""
upnpEnabled: false
audioPortMax: 32766
audioPortMin: 16384
dtmfType: overrtp
interface: default
publishAddr: ""
publishPort: 5060
sameasLocal: true
videoEnabled: true
videoPortMax: 65534
videoPortMin: 49152
stunEnabled: false
stunServer: ""
turnEnabled: false
turnServer: ""
turnServerUserName: ""
turnServerPassword: ""
turnServerRealm: ""
port: 5060
username: ""
credential:
- Account.password: ""
Account.realm: "*"
Account.username: ""
keepAlive: false
presenceModuleEnabled: false
presencePublishSupported: false
presenceSubscribeSupported: false
registrationexpire: 60
serviceRoute: ""
tls:
calist: ""
certificate: ""
password: ""
privateKey: ""
enable: false
tlsPort: 5061
verifyClient: true
verifyServer: false
requireCertif: true
timeout: 2
ciphers: ""
method: TLSv1
server: ""
srtp:
keyExchange: ""
rtpFallback: false
preferences:
historyLimit: 0
historyMaxCalls: 20
md5Hash: false
order: IP2IP/
portNum: 5060
registrationexpire: 180
searchBarDisplay: true
zoneToneChoice: North America
voipPreferences:
playDtmf: true
playTones: true
pulseLength: 250
symmetric: true
zidFile: ""
hooks:
numberAddPrefix: ""
sipEnabled: false
urlCommand: x-www-browser
urlSipField: X-ring-url
audio:
alsa:
cardIn: 0
cardOut: 0
cardRing: 0
plugin: default
smplRate: 44100
alwaysRecording: false
audioApi: pulseaudio
automaticGainControl: false
captureMuted: false
noiseReduce: false
playbackMuted: false
pulse:
devicePlayback: ""
deviceRecord: ""
deviceRingtone: ""
recordPath: ""
volumeMic: 1
volumeSpkr: 1
video:
decodingAccelerated: true
devices:
- framerate: 30
channel: Camera 1
video_size: 960x540
name: Integrated Camera
shortcuts:
hangUp: ""
pickUp: ""
popupWindow: ""
toggleHold: ""
togglePickupHangup: ""
\ No newline at end of file
/*
* Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
* Author: Julien Bonjean <julien.bonjean@savoirfairelinux.com>
* Copyright (C) 2017 Savoir-Faire Linux Inc.
* Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
*
* 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
......@@ -15,42 +15,46 @@
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "test_SIP.h"
#include <cppunit/CompilerOutputter.h>
#include <cppunit/XmlOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TextTestRunner.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/CompilerOutputter.h>
#include "dring.h"
#include <stdexcept>
void init_daemon()
{
DRing::init(DRing::InitFlag(DRing::DRING_FLAG_DEBUG | DRing::DRING_FLAG_CONSOLE_LOG));
DRing::start("dring-sample.yml");
}
int main(int argc, char* argv[])
{
init_daemon();
CppUnit::TextUi::TestRunner runner;
// Register all tests
auto& registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
// Use a compiler error format outputter for results and output into stderr
runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cerr ));
// Get the top level suite from the registry
CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
bool ret;
// Adds the test to the list of test to run
CppUnit::TextUi::TestRunner runner;
runner.addTest( suite );
try {
// Run tests
ret = !runner.run("", false);
} catch (const std::exception& e) {
std::cerr << "Exception catched during tests: " << e.what() << '\n';
ret = 1;
}
// Change the default outputter to a compiler error format outputter
runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
std::cerr ) );
// Run the tests.
bool wasSucessful = runner.run();
DRing::fini();
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
return ret;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment