Replace test_support_main by test_main and get rid of test_support_main_threaded_mac
test_support_main_threaded_mac doesn't seem to be used. It looks like it was last used about a year and a half ago, and was removed in https://webrtc-codereview.appspot.com/55379004 BUG=webrtc:6424 R=kjellander@webrtc.org NOTRY=True Review-Url: https://codereview.webrtc.org/2540693002 Cr-Commit-Position: refs/heads/master@{#15332}
This commit is contained in:
@ -289,7 +289,7 @@ if (rtc_include_tests) {
|
||||
|
||||
deps = [
|
||||
":common_audio",
|
||||
"../test:test_support_main",
|
||||
"../test:test_main",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
#include "webrtc/system_wrappers/include/stringize_macros.h"
|
||||
#include "webrtc/test/gmock.h"
|
||||
#include "webrtc/test/gtest.h"
|
||||
#include "webrtc/test/test_suite.h"
|
||||
|
||||
using testing::_;
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ if (rtc_include_tests) {
|
||||
deps = [
|
||||
":common_video",
|
||||
"../system_wrappers:system_wrappers",
|
||||
"../test:test_support_main",
|
||||
"../test:test_main",
|
||||
"../test:video_test_common",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
#include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
|
||||
#include "webrtc/system_wrappers/include/clock.h"
|
||||
#include "webrtc/test/gtest.h"
|
||||
#include "webrtc/test/test_suite.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
|
||||
// Files generated at build-time by the protobuf compiler.
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/test/gtest.h"
|
||||
#include "webrtc/test/test_suite.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
|
||||
// Files generated at build-time by the protobuf compiler.
|
||||
|
||||
@ -74,8 +74,8 @@ if (rtc_include_tests) {
|
||||
"../modules/video_coding",
|
||||
"../modules/video_coding:video_codecs_test_framework",
|
||||
"../system_wrappers",
|
||||
"../test:test_main",
|
||||
"../test:test_support",
|
||||
"../test:test_support_main",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
]
|
||||
@ -649,8 +649,8 @@ if (rtc_include_tests) {
|
||||
"../system_wrappers",
|
||||
"../test:rtp_test_utils",
|
||||
"../test:test_common",
|
||||
"../test:test_main",
|
||||
"../test:test_support",
|
||||
"../test:test_support_main",
|
||||
"../test:video_test_common",
|
||||
"audio_coding",
|
||||
"audio_coding:acm_receive_test",
|
||||
@ -750,7 +750,7 @@ if (rtc_include_tests) {
|
||||
"..:webrtc_common",
|
||||
"../base:rtc_base_approved",
|
||||
"../test:test_common",
|
||||
"../test:test_support_main",
|
||||
"../test:test_main",
|
||||
"remote_bitrate_estimator:bwe_simulator_lib",
|
||||
"video_capture",
|
||||
"//testing/gmock",
|
||||
|
||||
@ -1075,7 +1075,7 @@ if (rtc_include_tests) {
|
||||
":neteq",
|
||||
":neteq_unittest_tools",
|
||||
"../../common_audio",
|
||||
"../../test:test_support_main",
|
||||
"../../test:test_main",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
@ -1173,7 +1173,7 @@ if (rtc_include_tests) {
|
||||
":isac_fix",
|
||||
":webrtc_opus",
|
||||
"../../system_wrappers:system_wrappers_default",
|
||||
"../../test:test_support_main",
|
||||
"../../test:test_main",
|
||||
"../audio_processing",
|
||||
"//testing/gtest",
|
||||
]
|
||||
@ -1451,7 +1451,7 @@ if (rtc_include_tests) {
|
||||
":neteq_quality_test_support",
|
||||
":neteq_unittest_tools",
|
||||
":webrtc_opus",
|
||||
"../../test:test_support_main",
|
||||
"../../test:test_main",
|
||||
"//testing/gtest",
|
||||
"//third_party/gflags",
|
||||
]
|
||||
@ -1498,7 +1498,7 @@ if (rtc_include_tests) {
|
||||
":neteq_quality_test_support",
|
||||
":neteq_unittest_tools",
|
||||
"../../system_wrappers:system_wrappers_default",
|
||||
"../../test:test_support_main",
|
||||
"../../test:test_main",
|
||||
"//testing/gtest",
|
||||
"//third_party/gflags",
|
||||
]
|
||||
@ -1515,7 +1515,7 @@ if (rtc_include_tests) {
|
||||
":isac_fix",
|
||||
":neteq",
|
||||
":neteq_quality_test_support",
|
||||
"../../test:test_support_main",
|
||||
"../../test:test_main",
|
||||
"//testing/gtest",
|
||||
"//third_party/gflags",
|
||||
]
|
||||
@ -1532,7 +1532,7 @@ if (rtc_include_tests) {
|
||||
":g711",
|
||||
":neteq",
|
||||
":neteq_quality_test_support",
|
||||
"../../test:test_support_main",
|
||||
"../../test:test_main",
|
||||
"//testing/gtest",
|
||||
"//third_party/gflags",
|
||||
]
|
||||
@ -1678,8 +1678,8 @@ if (rtc_include_tests) {
|
||||
":webrtc_opus",
|
||||
"../../base:rtc_base_approved",
|
||||
"../../common_audio",
|
||||
"../../test:test_main",
|
||||
"../../test:test_support",
|
||||
"../../test:test_support_main",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
|
||||
#include "webrtc/system_wrappers/include/clock.h"
|
||||
#include "webrtc/test/gtest.h"
|
||||
#include "webrtc/test/test_suite.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -282,8 +282,8 @@ if (rtc_include_tests && !is_ios) {
|
||||
":audio_device",
|
||||
"../..:webrtc_common",
|
||||
"../../system_wrappers",
|
||||
"../../test:test_main",
|
||||
"../../test:test_support",
|
||||
"../../test:test_support_main",
|
||||
"../rtp_rtcp",
|
||||
"../utility",
|
||||
"//testing/gtest",
|
||||
|
||||
@ -203,7 +203,7 @@ if (rtc_include_tests) {
|
||||
deps = [
|
||||
":rtp_rtcp",
|
||||
"//testing/gtest",
|
||||
"//webrtc/test:test_support_main",
|
||||
"//webrtc/test:test_main",
|
||||
]
|
||||
} # test_packet_masks_metrics
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ if (!build_with_chromium) {
|
||||
"../utility",
|
||||
"//testing/gtest",
|
||||
]
|
||||
deps += [ "//webrtc/test:test_support_main" ]
|
||||
deps += [ "//webrtc/test:test_main" ]
|
||||
|
||||
if (!build_with_chromium && is_clang) {
|
||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
||||
|
||||
@ -196,7 +196,7 @@ if (rtc_include_tests) {
|
||||
deps = [
|
||||
":metrics_default",
|
||||
":system_wrappers",
|
||||
"../test:test_support_main",
|
||||
"../test:test_main",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
|
||||
@ -22,9 +22,9 @@ group("test") {
|
||||
":field_trial",
|
||||
":rtp_test_utils",
|
||||
":test_common",
|
||||
":test_main",
|
||||
":test_renderer",
|
||||
":test_support",
|
||||
":test_support_main",
|
||||
":test_support_unittests",
|
||||
":video_test_common",
|
||||
]
|
||||
@ -98,6 +98,7 @@ rtc_source_set("test_main") {
|
||||
":field_trial",
|
||||
":test_support",
|
||||
"../system_wrappers:metrics_default",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
"//third_party/gflags",
|
||||
]
|
||||
@ -163,46 +164,6 @@ rtc_source_set("test_support") {
|
||||
}
|
||||
}
|
||||
|
||||
# Depend on this target when you want to have test_support but also the
|
||||
# main method needed for gtest to execute!
|
||||
rtc_source_set("test_support_main") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"run_all_unittests.cc",
|
||||
"test_suite.cc",
|
||||
"test_suite.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":field_trial",
|
||||
":test_support",
|
||||
"../system_wrappers:metrics_default",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
"//third_party/gflags",
|
||||
]
|
||||
}
|
||||
|
||||
# Depend on this target when you want to have test_support and a special
|
||||
# main for mac which will run your test on a worker thread and consume
|
||||
# events on the main thread. Useful if you want to access a webcam.
|
||||
# This main will provide all the scaffolding and objective-c black magic
|
||||
# for you. All you need to do is to implement a function in the
|
||||
# run_threaded_main_mac.h file (ImplementThisToRunYourTest).
|
||||
rtc_source_set("test_support_main_threaded_mac") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"testsupport/mac/run_threaded_main_mac.h",
|
||||
"testsupport/mac/run_threaded_main_mac.mm",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":test_support",
|
||||
]
|
||||
}
|
||||
|
||||
rtc_source_set("run_test") {
|
||||
testonly = true
|
||||
sources = [
|
||||
@ -276,7 +237,7 @@ rtc_test("test_support_unittests") {
|
||||
|
||||
deps += [
|
||||
":test_common",
|
||||
":test_support_main",
|
||||
":test_main",
|
||||
"../modules/video_capture",
|
||||
"//testing/gmock",
|
||||
"//testing/gtest",
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/test/test_suite.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
webrtc::test::TestSuite test_suite(argc, argv);
|
||||
return test_suite.Run();
|
||||
}
|
||||
@ -12,8 +12,12 @@
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/system_wrappers/include/metrics_default.h"
|
||||
#include "webrtc/test/field_trial.h"
|
||||
#include "webrtc/test/gmock.h"
|
||||
#include "webrtc/test/gtest.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
#include "webrtc/test/testsupport/trace_to_stderr.h"
|
||||
|
||||
DEFINE_bool(logs, false, "print logs to stderr");
|
||||
|
||||
DEFINE_string(force_fieldtrials, "",
|
||||
"Field trials control experimental feature code which can be forced. "
|
||||
@ -21,7 +25,7 @@ DEFINE_string(force_fieldtrials, "",
|
||||
" will assign the group Enable to field trial WebRTC-FooFeature.");
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
::testing::InitGoogleMock(&argc, argv);
|
||||
|
||||
// Default to LS_INFO, even for release builds to provide better test logging.
|
||||
// TODO(pbos): Consider adding a command-line override.
|
||||
@ -36,5 +40,11 @@ int main(int argc, char* argv[]) {
|
||||
webrtc::test::SetExecutablePath(argv[0]);
|
||||
webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials);
|
||||
webrtc::metrics::Enable();
|
||||
|
||||
rtc::LogMessage::SetLogToStderr(FLAGS_logs);
|
||||
std::unique_ptr<webrtc::test::TraceToStderr> trace_to_stderr;
|
||||
if (FLAGS_logs)
|
||||
trace_to_stderr.reset(new webrtc::test::TraceToStderr);
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/test/test_suite.h"
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/system_wrappers/include/metrics_default.h"
|
||||
#include "webrtc/test/field_trial.h"
|
||||
#include "webrtc/test/gmock.h"
|
||||
#include "webrtc/test/gtest.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
#include "webrtc/test/testsupport/trace_to_stderr.h"
|
||||
|
||||
DEFINE_bool(logs, false, "print logs to stderr");
|
||||
|
||||
DEFINE_string(force_fieldtrials, "",
|
||||
"Field trials control experimental feature code which can be forced. "
|
||||
"E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
|
||||
" will assign the group Enable to field trial WebRTC-FooFeature.");
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
TestSuite::TestSuite(int argc, char** argv) {
|
||||
SetExecutablePath(argv[0]);
|
||||
testing::InitGoogleMock(&argc, argv); // Runs InitGoogleTest() internally.
|
||||
// AllowCommandLineParsing allows us to ignore flags passed on to us by
|
||||
// Chromium build bots without having to explicitly disable them.
|
||||
google::AllowCommandLineReparsing();
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials);
|
||||
webrtc::metrics::Enable();
|
||||
}
|
||||
|
||||
TestSuite::~TestSuite() {
|
||||
}
|
||||
|
||||
int TestSuite::Run() {
|
||||
Initialize();
|
||||
int result = RUN_ALL_TESTS();
|
||||
Shutdown();
|
||||
return result;
|
||||
}
|
||||
|
||||
void TestSuite::Initialize() {
|
||||
rtc::LogMessage::SetLogToStderr(FLAGS_logs);
|
||||
if (FLAGS_logs)
|
||||
trace_to_stderr_.reset(new TraceToStderr);
|
||||
}
|
||||
|
||||
void TestSuite::Shutdown() {
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_TEST_TEST_SUITE_H_
|
||||
#define WEBRTC_TEST_TEST_SUITE_H_
|
||||
|
||||
// Derived from Chromium's src/base/test/test_suite.h.
|
||||
|
||||
// Defines a basic test suite framework for running gtest based tests. You can
|
||||
// instantiate this class in your main function and call its Run method to run
|
||||
// any gtest based tests that are linked into your executable.
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
class TraceToStderr;
|
||||
|
||||
class TestSuite {
|
||||
public:
|
||||
TestSuite(int argc, char** argv);
|
||||
virtual ~TestSuite();
|
||||
|
||||
int Run();
|
||||
|
||||
protected:
|
||||
// Override these for custom initialization and shutdown handling. Use these
|
||||
// instead of putting complex code in your constructor/destructor.
|
||||
virtual void Initialize();
|
||||
virtual void Shutdown();
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(TestSuite);
|
||||
|
||||
private:
|
||||
std::unique_ptr<TraceToStderr> trace_to_stderr_;
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // TEST_TEST_SUITE_H_
|
||||
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This file and its corresponding .mm file implement a main function on Mac.
|
||||
* It's useful if you need to access a webcam in your Mac application. The code
|
||||
* forks a worker thread which runs the below ImplementThisToRunYourTest
|
||||
* function, and uses the main thread to pump messages. That way we can run our
|
||||
* code in a regular sequential fashion and still pump events, which are
|
||||
* necessary to access the webcam for instance.
|
||||
*/
|
||||
|
||||
// Implement this method to do whatever you want to do in the worker thread.
|
||||
// The argc and argv variables are the unmodified command line from main.
|
||||
int ImplementThisToRunYourTest(int argc, char** argv);
|
||||
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import "webrtc/test/testsupport/mac/run_threaded_main_mac.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
// This class passes parameter from main to the worked thread and back.
|
||||
@interface AutoTestInWorkerThread : NSObject {
|
||||
int argc_;
|
||||
char** argv_;
|
||||
int result_;
|
||||
bool done_;
|
||||
}
|
||||
|
||||
- (void)setDone:(bool)done;
|
||||
- (bool)done;
|
||||
- (void)setArgc:(int)argc argv:(char**)argv;
|
||||
- (int) result;
|
||||
- (void)runTest:(NSObject*)ignored;
|
||||
|
||||
@end
|
||||
|
||||
@implementation AutoTestInWorkerThread
|
||||
|
||||
- (void)setDone:(bool)done {
|
||||
done_ = done;
|
||||
}
|
||||
|
||||
- (bool)done {
|
||||
return done_;
|
||||
}
|
||||
|
||||
- (void)setArgc:(int)argc argv:(char**)argv {
|
||||
argc_ = argc;
|
||||
argv_ = argv;
|
||||
}
|
||||
|
||||
- (void)runTest:(NSObject*)ignored {
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
result_ = ImplementThisToRunYourTest(argc_, argv_);
|
||||
done_ = true;
|
||||
|
||||
[pool release];
|
||||
return;
|
||||
}
|
||||
|
||||
- (int)result {
|
||||
return result_;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
int result = 0;
|
||||
AutoTestInWorkerThread* tests = [[AutoTestInWorkerThread alloc] init];
|
||||
|
||||
[tests setArgc:argc argv:argv];
|
||||
[tests setDone:false];
|
||||
|
||||
[NSThread detachNewThreadSelector:@selector(runTest:)
|
||||
toTarget:tests
|
||||
withObject:nil];
|
||||
|
||||
NSRunLoop* main_run_loop = [NSRunLoop mainRunLoop];
|
||||
NSDate *loop_until = [NSDate dateWithTimeIntervalSinceNow:0.1];
|
||||
bool runloop_ok = true;
|
||||
while (![tests done] && runloop_ok) {
|
||||
runloop_ok = [main_run_loop runMode:NSDefaultRunLoopMode
|
||||
beforeDate:loop_until];
|
||||
loop_until = [NSDate dateWithTimeIntervalSinceNow:0.1];
|
||||
}
|
||||
|
||||
result = [tests result];
|
||||
|
||||
[pool release];
|
||||
return result;
|
||||
}
|
||||
@ -271,7 +271,7 @@ if (rtc_include_tests) {
|
||||
":command_line_parser",
|
||||
":frame_editing_lib",
|
||||
":video_quality_analysis",
|
||||
"../test:test_support_main",
|
||||
"../test:test_main",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ if (rtc_include_tests) {
|
||||
"//webrtc/modules/rtp_rtcp",
|
||||
"//webrtc/modules/utility",
|
||||
"//webrtc/system_wrappers",
|
||||
"//webrtc/test:test_support_main",
|
||||
"//webrtc/test:test_main",
|
||||
]
|
||||
|
||||
if (is_android) {
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/test/test_suite.h"
|
||||
#include "webrtc/test/testsupport/fileutils.h"
|
||||
#include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
|
||||
#include "webrtc/voice_engine/voice_engine_defines.h"
|
||||
|
||||
Reference in New Issue
Block a user