Bug 1316886 - Port sdp_file_parser unit test to standalone binary; r=drno
authorDan Minor <dminor@mozilla.com>
Fri, 11 Nov 2016 15:27:41 -0500
changeset 322411 09b5ba29c6db1e3023ee3953f782430b67f4baa1
parent 322410 9c15c0a68e00a36beed4d3c6a1eb88539c6e43c0
child 322412 222dd5537727a008fbb3fc299d6e3ef856761f46
push id30951
push usercbook@mozilla.com
push dateTue, 15 Nov 2016 11:25:40 +0000
treeherdermozilla-central@85a9d908e91a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1316886
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1316886 - Port sdp_file_parser unit test to standalone binary; r=drno MozReview-Commit-ID: 15joXOZxHgq
media/webrtc/moz.build
media/webrtc/signaling/fuzztest/moz.build
media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
media/webrtc/signaling/src/sdp/sipcc/cpr_types.h
media/webrtc/signaling/test/moz.build
media/webrtc/signaling/test/sdp_file_parser.cpp
--- a/media/webrtc/moz.build
+++ b/media/webrtc/moz.build
@@ -115,8 +115,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk
         GYP_DIRS['signalingtest'].variables = gyp_vars.copy()
         GYP_DIRS['signalingtest'].variables.update(
             build_for_test=1,
             moz_webrtc_mediacodec=0,
             build_for_standalone=0
         )
         GYP_DIRS['signalingtest'].sandbox_vars['ALLOW_COMPILER_WARNINGS'] = True
         GYP_DIRS['signalingtest'].non_unified_sources += signaling_non_unified_sources
+
+DIRS += ['signaling/fuzztest']
new file mode 100644
--- /dev/null
+++ b/media/webrtc/signaling/fuzztest/moz.build
@@ -0,0 +1,48 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit':
+    DISABLE_STL_WRAPPING = True
+    DEFINES['MOZ_NO_MOZALLOC'] = True
+
+    if CONFIG['OS_TARGET'] == 'Darwin':
+        DEFINES['SIP_OS_OSX'] = True
+    else:
+        DEFINES['SIP_OS_LINUX'] = True
+
+    LOCAL_INCLUDES += [
+        '../..',
+        '/media/mtransport',
+        '/media/webrtc/signaling/src/common/browser_logging',
+    ]
+
+    USE_LIBS += [
+        '/media/webrtc/trunk/testing/gtest_gtest/gtest',
+        'nspr'
+    ]
+
+    SOURCES = [
+      '/media/webrtc/signaling/src/sdp/SdpAttribute.cpp',
+      '/media/webrtc/signaling/src/sdp/SdpHelper.cpp',
+      '/media/webrtc/signaling/src/sdp/SdpMediaSection.cpp',
+      '/media/webrtc/signaling/src/sdp/sipcc/cpr_string.c',
+      '/media/webrtc/signaling/src/sdp/sipcc/sdp_access.c',
+      '/media/webrtc/signaling/src/sdp/sipcc/sdp_attr.c',
+      '/media/webrtc/signaling/src/sdp/sipcc/sdp_attr_access.c',
+      '/media/webrtc/signaling/src/sdp/sipcc/sdp_base64.c',
+      '/media/webrtc/signaling/src/sdp/sipcc/sdp_config.c',
+      '/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c',
+      '/media/webrtc/signaling/src/sdp/sipcc/sdp_services_unix.c',
+      '/media/webrtc/signaling/src/sdp/sipcc/sdp_token.c',
+      '/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c',
+      '/media/webrtc/signaling/src/sdp/SipccSdp.cpp',
+      '/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp',
+      '/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp',
+      '/media/webrtc/signaling/src/sdp/SipccSdpParser.cpp',
+      'sdp_file_parser.cpp',
+    ]
+
+    GeckoProgram('sdp_file_parser')
rename from media/webrtc/signaling/test/sdp_file_parser.cpp
rename to media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
--- a/media/webrtc/signaling/test/sdp_file_parser.cpp
+++ b/media/webrtc/signaling/fuzztest/sdp_file_parser.cpp
@@ -5,29 +5,51 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <string>
 #include <iostream>
 #include <fstream>
 
 #define GTEST_HAS_RTTI 0
 #include "gtest/gtest.h"
-#include "gtest_utils.h"
-
-// without this include linking fails
-#include "FakeMediaStreamsImpl.h"
-#include "FakeLogging.h"
 
 #include "signaling/src/sdp/SipccSdpParser.h"
 
-#include "FakeIPC.h"
-#include "FakeIPC.cpp"
+#include "CSFLog.h"
+
+void CSFLog(CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, ...)
+{
+  va_list ap;
+  va_start(ap, format);
+
+  printf("%s\n:", tag);
+  vprintf(format, ap);
+
+  va_end(ap);
+}
 
 namespace mozilla {
 
+enum class LogLevel {
+
+};
+
+namespace detail {
+
+void log_print(PRLogModuleInfo const* info, LogLevel level, char const* format, ...) {
+  va_list ap;
+  va_start(ap, format);
+
+  vprintf(format, ap);
+
+  va_end(ap);
+}
+
+} // End namespace detail.
+
 const std::string kDefaultFilename((char *)"/tmp/sdp.bin");
 std::string filename(kDefaultFilename);
 
 class SdpParseTest : public ::testing::Test
 {
   public:
     SdpParseTest() {}
 
--- a/media/webrtc/signaling/src/sdp/sipcc/cpr_types.h
+++ b/media/webrtc/signaling/src/sdp/sipcc/cpr_types.h
@@ -1,15 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef _CPR_TYPES_H_
 #define _CPR_TYPES_H_
 
+#include <inttypes.h>
+
 #if defined SIP_OS_LINUX
 #include "cpr_linux_types.h"
 #elif defined SIP_OS_WINDOWS
 #include "cpr_win_types.h"
 #elif defined SIP_OS_OSX
 #include "cpr_darwin_types.h"
 #else
 //lol
--- a/media/webrtc/signaling/test/moz.build
+++ b/media/webrtc/signaling/test/moz.build
@@ -6,17 +6,16 @@
 
 # TODO: bug 1172551 - get these tests working on iOS
 if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit':
     GeckoCppUnitTests([
         'jsep_session_unittest',
         'jsep_track_unittest',
         'mediaconduit_unittests',
         'mediapipeline_unittest',
-        'sdp_file_parser',
         'sdp_unittests',
         'signaling_unittests',
     ])
 
 include('/ipc/chromium/chromium-config.mozbuild')
 include('common.build')
 
 USE_LIBS += [