tester: fix liblinphone tester [Switch submodule branch]

parent dc8f5d71
/*
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "LinphoneManager.h"
#define LOGV(level, ...) [LinphoneLogger log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
#define LOGD(...) LOGV(ORTP_DEBUG, __VA_ARGS__)
#define LOGI(...) LOGV(ORTP_MESSAGE, __VA_ARGS__)
#define LOGW(...) LOGV(ORTP_WARNING, __VA_ARGS__)
#define LOGE(...) LOGV(ORTP_ERROR, __VA_ARGS__)
#define LOGF(...) LOGV(ORTP_FATAL, __VA_ARGS__)
#define IPAD (LinphoneManager.runningOnIpad)
@interface LinphoneLogger : NSObject {
}
+ (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ...;
void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
@end
\ No newline at end of file
/*
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "Log.h"
@implementation LinphoneLogger
+ (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ... {
va_list args;
va_start(args, format);
NSString *str = [[NSString alloc] initWithFormat:format arguments:args];
const char *utf8str = [str cStringUsingEncoding:NSString.defaultCStringEncoding];
int filesize = 20;
const char *filename = strchr(file, '/') ? strrchr(file, '/') + 1 : file;
if (severity <= ORTP_DEBUG) {
// lol: ortp_debug(XXX) can be disabled at compile time, but ortp_log(ORTP_DEBUG, xxx) will always be valid even
// not in debug build...
ortp_debug("%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str);
} else {
ortp_log(severity, "%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line,
utf8str);
}
va_end(args);
}
#pragma mark - Logs Functions callbacks
void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) {
NSString *format = [[NSString alloc] initWithUTF8String:fmt];
NSString *formatedString = [[NSString alloc] initWithFormat:format arguments:args];
char levelC = 'I';
switch ((OrtpLogLevel)lev) {
case ORTP_FATAL:
levelC = 'F';
break;
case ORTP_ERROR:
levelC = 'E';
break;
case ORTP_WARNING:
levelC = 'W';
break;
case ORTP_MESSAGE:
levelC = 'I';
break;
case ORTP_TRACE:
case ORTP_DEBUG:
levelC = 'D';
break;
case ORTP_LOGLEV_END:
return;
}
// since \r are interpreted like \n, avoid double new lines when logging packets
NSLog(@"%c %@", levelC, [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"]);
}
@end
/* Utils.h
/*
*
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
*
......@@ -19,23 +19,6 @@
#import "LinphoneManager.h"
#define LOGV(level, ...) [LinphoneLogger log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
#define LOGD(...) LOGV(ORTP_DEBUG, __VA_ARGS__)
#define LOGI(...) LOGV(ORTP_MESSAGE, __VA_ARGS__)
#define LOGW(...) LOGV(ORTP_WARNING, __VA_ARGS__)
#define LOGE(...) LOGV(ORTP_ERROR, __VA_ARGS__)
#define LOGF(...) LOGV(ORTP_FATAL, __VA_ARGS__)
#define IPAD (LinphoneManager.runningOnIpad)
@interface LinphoneLogger : NSObject {
}
+ (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ...;
void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
@end
@interface LinphoneUtils : NSObject
+ (BOOL)findAndResignFirstResponder:(UIView*)view;
......
......@@ -28,58 +28,6 @@
#import "FastAddressBook.h"
#import "ColorSpaceUtilities.h"
@implementation LinphoneLogger
+ (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ... {
va_list args;
va_start(args, format);
NSString *str = [[NSString alloc] initWithFormat:format arguments:args];
const char *utf8str = [str cStringUsingEncoding:NSString.defaultCStringEncoding];
int filesize = 20;
const char *filename = strchr(file, '/') ? strrchr(file, '/') + 1 : file;
if (severity <= ORTP_DEBUG) {
// lol: ortp_debug(XXX) can be disabled at compile time, but ortp_log(ORTP_DEBUG, xxx) will always be valid even
// not in debug build...
ortp_debug("%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str);
} else {
ortp_log(severity, "%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line,
utf8str);
}
va_end(args);
}
#pragma mark - Logs Functions callbacks
void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) {
NSString *format = [[NSString alloc] initWithUTF8String:fmt];
NSString *formatedString = [[NSString alloc] initWithFormat:format arguments:args];
char levelC = 'I';
switch ((OrtpLogLevel)lev) {
case ORTP_FATAL:
levelC = 'F';
break;
case ORTP_ERROR:
levelC = 'E';
break;
case ORTP_WARNING:
levelC = 'W';
break;
case ORTP_MESSAGE:
levelC = 'I';
break;
case ORTP_TRACE:
case ORTP_DEBUG:
levelC = 'D';
break;
case ORTP_LOGLEV_END:
return;
}
// since \r are interpreted like \n, avoid double new lines when logging packets
NSLog(@"%c %@", levelC, [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"]);
}
@end
@implementation LinphoneUtils
+ (BOOL)hasSelfAvatar {
......
......@@ -10,7 +10,7 @@
#import "MasterView.h"
#import "LogsView.h"
#include "linphone/liblinphone_tester.h"
#import "Utils.h"
#import "Log.h"
static NSString *const kAllTestsName = @"Run All tests";
......
......@@ -12,7 +12,7 @@
#include "linphone/liblinphone_tester.h"
#include "mediastreamer2/msutils.h"
#import "Utils.h"
#import "Log.h"
@interface MasterView () {
NSMutableArray *_objects;
......
......@@ -11,6 +11,7 @@
#import "LinphoneManager.h"
#import "KIF/KIFTypist.h"
#import "Log.h"
#import "Utils.h"
@implementation LinphoneTestCase
......
......@@ -85,8 +85,6 @@
631348301B6F7B6600C6BDCB /* UIRoundBorderedButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6313482F1B6F7B6600C6BDCB /* UIRoundBorderedButton.m */; };
631348321B6FA53300C6BDCB /* rootca.pem in Resources */ = {isa = PBXBuildFile; fileRef = 631348311B6FA53300C6BDCB /* rootca.pem */; };
6316FA6D1BE12A3E0050E441 /* UIRightImageButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6316FA6C1BE12A3E0050E441 /* UIRightImageButton.m */; };
632DA24D1B43EE9400EB356A /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = D35860D515B549B500513429 /* Utils.m */; };
632DA24E1B43EEEF00EB356A /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = D35860D515B549B500513429 /* Utils.m */; };
6334DDFA1BBAC97C00631900 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D32B6E2E15A5C0AC0033019F /* libsqlite3.dylib */; };
6334DDFB1BBAC99400631900 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D32B6E2E15A5C0AC0033019F /* libsqlite3.dylib */; };
6334DDFC1BBAC99B00631900 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 152F22351B15E889008C0621 /* libxml2.dylib */; };
......@@ -549,6 +547,8 @@
63CFEE0B1B9EDD88007EA5BD /* libmswebrtc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 63EA4C941B50189D00922857 /* libmswebrtc.a */; };
63CFEE0C1B9EDD88007EA5BD /* libmsx264.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22AA8AFC13D7125500B30535 /* libmsx264.a */; };
63CFEE131B9EDF65007EA5BD /* libvo-amrwbenc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 63CFEDE31B9EDD36007EA5BD /* libvo-amrwbenc.a */; };
63D11C531C3D501200E8FCEE /* Log.m in Sources */ = {isa = PBXBuildFile; fileRef = 63D11C521C3D501200E8FCEE /* Log.m */; };
63D11C551C3D50A100E8FCEE /* Log.m in Sources */ = {isa = PBXBuildFile; fileRef = 63D11C521C3D501200E8FCEE /* Log.m */; };
63E59A3F1ADE70D900646FB3 /* InAppProductsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E59A3E1ADE70D900646FB3 /* InAppProductsManager.m */; };
63EEE3FF1BBA9AC00087D3AF /* libcunit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F03A9B7E18C0D9C900C4D7FE /* libcunit.a */; };
63EEE4001BBA9AC00087D3AF /* liblinphonetester.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F0BB8C0F193623F200974404 /* liblinphonetester.a */; };
......@@ -1364,6 +1364,8 @@
63CFEDE21B9EDD36007EA5BD /* libswresample.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libswresample.a; path = "liblinphone-sdk/apple-darwin/lib/libswresample.a"; sourceTree = "<group>"; };
63CFEDE31B9EDD36007EA5BD /* libvo-amrwbenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libvo-amrwbenc.a"; path = "liblinphone-sdk/apple-darwin/lib/libvo-amrwbenc.a"; sourceTree = "<group>"; };
63CFEDE41B9EDD36007EA5BD /* libbcg729.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libbcg729.a; path = "liblinphone-sdk/apple-darwin/lib/libbcg729.a"; sourceTree = "<group>"; };
63D11C521C3D501200E8FCEE /* Log.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Log.m; path = Utils/Log.m; sourceTree = "<group>"; };
63D11C541C3D503A00E8FCEE /* Log.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Log.h; sourceTree = "<group>"; };
63E59A3D1ADE6ECB00646FB3 /* InAppProductsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InAppProductsManager.h; sourceTree = "<group>"; };
63E59A3E1ADE70D900646FB3 /* InAppProductsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InAppProductsManager.m; sourceTree = "<group>"; };
63EA4C941B50189D00922857 /* libmswebrtc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmswebrtc.a; path = "liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/libmswebrtc.a"; sourceTree = "<group>"; };
......@@ -2585,6 +2587,8 @@
C9B3A6FD15B485DB006F52EE /* Utils.h */,
D35860D515B549B500513429 /* Utils.m */,
D3554EC515CA79A900478841 /* XMLRPC.xcodeproj */,
63D11C521C3D501200E8FCEE /* Log.m */,
63D11C541C3D503A00E8FCEE /* Log.h */,
);
name = Utils;
sourceTree = "<group>";
......@@ -3479,6 +3483,7 @@
D3F795D615A582810077328B /* ChatConversationView.m in Sources */,
D32B6E2915A5BC440033019F /* ChatConversationTableView.m in Sources */,
D3A8BB7015A6C7D500F96BE5 /* UIChatBubbleTextCell.m in Sources */,
63D11C531C3D501200E8FCEE /* Log.m in Sources */,
D3128FE115AABC7E00A2147A /* ContactDetailsView.m in Sources */,
D37C639B15AADEF6009D0BAC /* ContactDetailsTableView.m in Sources */,
63E59A3F1ADE70D900646FB3 /* InAppProductsManager.m in Sources */,
......@@ -3527,7 +3532,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
632DA24E1B43EEEF00EB356A /* Utils.m in Sources */,
63058A3C1B4E822F00EFAE36 /* DTObjectBlockExecutor.m in Sources */,
63058A3F1B4E823000EFAE36 /* NSObject+DTRuntime.m in Sources */,
63058A3E1B4E822F00EFAE36 /* LinphoneTester_Tests.m in Sources */,
......@@ -3538,9 +3542,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63D11C551C3D50A100E8FCEE /* Log.m in Sources */,
63058A2D1B4E821E00EFAE36 /* main.m in Sources */,
63058A241B4E821E00EFAE36 /* AppDelegate.m in Sources */,
632DA24D1B43EE9400EB356A /* Utils.m in Sources */,
63058A2A1B4E821E00EFAE36 /* DetailView.m in Sources */,
63058A2E1B4E821E00EFAE36 /* MasterView.m in Sources */,
63058A2C1B4E821E00EFAE36 /* LogsView.m in Sources */,
......
......@@ -7,4 +7,5 @@
#import <UIKit/UIKit.h>
#endif
#import "Log.h"
#import "Utils.h"
linphone @ 218db02a
Subproject commit 0d2723fae84f812c8d8bb7daaee9b91ca57958b5
Subproject commit 218db02a1ab4590d31032b4cbce25b5c34d508e7
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment