blob: 545be7161978b53b95ff86b06623e9b0f88165d6 [file] [log] [blame]
/*
* 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.
*/
#include "webrtc/voice_engine/test/auto_test/voe_standard_test.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "webrtc/rtc_base/flags.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
#include "webrtc/typedefs.h"
#include "webrtc/voice_engine/test/auto_test/automated_mode.h"
#include "webrtc/voice_engine/test/auto_test/voe_test_defines.h"
#include "webrtc/voice_engine/voice_engine_defines.h"
DEFINE_bool(include_timing_dependent_tests, true,
"If true, we will include tests / parts of tests that are known "
"to break in slow execution environments (such as valgrind).");
DEFINE_bool(automated, false,
"If true, we'll run the automated tests we have in noninteractive "
"mode.");
DEFINE_bool(help, false, "Print this message.");
namespace webrtc {
namespace voetest {
int dummy = 0; // Dummy used in different functions to avoid warnings
void SubAPIManager::DisplayStatus() const {
TEST_LOG("Supported sub APIs:\n\n");
if (_base)
TEST_LOG(" Base\n");
if (_codec)
TEST_LOG(" Codec\n");
if (_file)
TEST_LOG(" File\n");
if (_hardware)
TEST_LOG(" Hardware\n");
if (_network)
TEST_LOG(" Network\n");
if (_rtp_rtcp)
TEST_LOG(" RTP_RTCP\n");
if (_apm)
TEST_LOG(" AudioProcessing\n");
ANL();
TEST_LOG("Excluded sub APIs:\n\n");
if (!_base)
TEST_LOG(" Base\n");
if (!_codec)
TEST_LOG(" Codec\n");
if (!_file)
TEST_LOG(" File\n");
if (!_hardware)
TEST_LOG(" Hardware\n");
if (!_network)
TEST_LOG(" Network\n");
if (!_rtp_rtcp)
TEST_LOG(" RTP_RTCP\n");
if (!_apm)
TEST_LOG(" AudioProcessing\n");
ANL();
}
int RunInManualMode() {
SubAPIManager api_manager;
api_manager.DisplayStatus();
printf("----------------------------\n");
printf("Select type of test\n\n");
printf(" (0) Quit\n");
printf(" (1) Standard test\n");
printf("\n: ");
int selection(0);
dummy = scanf("%d", &selection);
switch (selection) {
case 0:
return 0;
case 1:
TEST_LOG("\n\n+++ Running standard tests +++\n\n");
// Currently, all googletest-rewritten tests are in the "automated" suite.
return RunInAutomatedMode();
default:
TEST_LOG("Invalid selection!\n");
return 0;
}
}
} // namespace voetest
} // namespace webrtc
#if !defined(WEBRTC_IOS)
int main(int argc, char** argv) {
// This function and RunInAutomatedMode is defined in automated_mode.cc
// to avoid macro clashes with googletest (for instance ASSERT_TRUE).
webrtc::voetest::InitializeGoogleTest(&argc, argv);
if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true)) {
return 1;
}
if (FLAG_help) {
rtc::FlagList::Print(nullptr, false);
return 0;
}
if (FLAG_automated) {
return webrtc::voetest::RunInAutomatedMode();
}
return webrtc::voetest::RunInManualMode();
}
#endif //#if !defined(WEBRTC_IOS)