diff --git a/src/voice_engine/test/auto_test/automated_mode.cc b/src/voice_engine/test/auto_test/automated_mode.cc index 13fa2575b..a8b624490 100644 --- a/src/voice_engine/test/auto_test/automated_mode.cc +++ b/src/voice_engine/test/auto_test/automated_mode.cc @@ -10,8 +10,10 @@ #include "gtest/gtest.h" -int RunInAutomatedMode(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); +void InitializeGoogleTest(int* argc, char** argv) { + testing::InitGoogleTest(argc, argv); +} +int RunInAutomatedMode() { return RUN_ALL_TESTS(); } diff --git a/src/voice_engine/test/auto_test/automated_mode.h b/src/voice_engine/test/auto_test/automated_mode.h index cd7ab9e1b..599f021aa 100644 --- a/src/voice_engine/test/auto_test/automated_mode.h +++ b/src/voice_engine/test/auto_test/automated_mode.h @@ -11,6 +11,7 @@ #ifndef SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_AUTOMATED_MODE_H_ #define SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_AUTOMATED_MODE_H_ -int RunInAutomatedMode(int argc, char** argv); +void InitializeGoogleTest(int* argc, char** argv); +int RunInAutomatedMode(); #endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_AUTOMATED_MODE_H_ diff --git a/src/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h b/src/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h index ef1636b86..cd1520d06 100644 --- a/src/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h +++ b/src/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h @@ -15,22 +15,22 @@ #include "common_types.h" #include "engine_configurations.h" -#include "voe_audio_processing.h" -#include "voe_base.h" -#include "voe_call_report.h" -#include "voe_codec.h" -#include "voe_dtmf.h" -#include "voe_encryption.h" -#include "voe_errors.h" -#include "voe_external_media.h" -#include "voe_file.h" -#include "voe_hardware.h" -#include "voe_neteq_stats.h" -#include "voe_network.h" -#include "voe_rtp_rtcp.h" -#include "voe_test_defines.h" -#include "voe_video_sync.h" -#include "voe_volume_control.h" +#include "voice_engine/include/voe_audio_processing.h" +#include "voice_engine/include/voe_base.h" +#include "voice_engine/include/voe_call_report.h" +#include "voice_engine/include/voe_codec.h" +#include "voice_engine/include/voe_dtmf.h" +#include "voice_engine/include/voe_encryption.h" +#include "voice_engine/include/voe_errors.h" +#include "voice_engine/include/voe_external_media.h" +#include "voice_engine/include/voe_file.h" +#include "voice_engine/include/voe_hardware.h" +#include "voice_engine/include/voe_neteq_stats.h" +#include "voice_engine/include/voe_network.h" +#include "voice_engine/include/voe_rtp_rtcp.h" +#include "voice_engine/include/voe_video_sync.h" +#include "voice_engine/include/voe_volume_control.h" +#include "voice_engine/test/auto_test/voe_test_defines.h" // TODO(qhogpat): Remove these undefs once the clashing macros are gone. #undef TEST diff --git a/src/voice_engine/test/auto_test/standard/file_test.cc b/src/voice_engine/test/auto_test/standard/file_test.cc index 63b160057..d8e83709a 100644 --- a/src/voice_engine/test/auto_test/standard/file_test.cc +++ b/src/voice_engine/test/auto_test/standard/file_test.cc @@ -8,8 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "after_streaming_fixture.h" -#include "testsupport/fileutils.h" +#include "voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" +#include "voice_engine/test/auto_test/voe_standard_test.h" +#include "test/testsupport/fileutils.h" + class FileTest : public AfterStreamingFixture { protected: @@ -24,6 +26,11 @@ class FileTest : public AfterStreamingFixture { }; TEST_F(FileTest, ManualRecordToFileForThreeSecondsAndPlayback) { + if (!FLAGS_include_timing_dependent_tests) { + TEST_LOG("Skipping test - running in slow execution environment.../n"); + return; + } + SwitchToManualMicrophone(); std::string recording_filename = diff --git a/src/voice_engine/test/auto_test/standard/network_test.cc b/src/voice_engine/test/auto_test/standard/network_test.cc index e4aebd172..8cc902d17 100644 --- a/src/voice_engine/test/auto_test/standard/network_test.cc +++ b/src/voice_engine/test/auto_test/standard/network_test.cc @@ -11,6 +11,7 @@ #include "voice_engine/test/auto_test/fakes/fake_external_transport.h" #include "voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" #include "voice_engine/test/auto_test/voe_test_interface.h" +#include "voice_engine/test/auto_test/voe_standard_test.h" #include "voice_engine/include/mock/mock_voe_connection_observer.h" #include "voice_engine/include/mock/mock_voe_observer.h" @@ -143,6 +144,11 @@ TEST_F(NetworkTest, DoesNotCallDeRegisteredObserver) { } TEST_F(NetworkTest, DeadOrAliveObserverSeesAliveMessagesIfEnabled) { + if (!FLAGS_include_timing_dependent_tests) { + TEST_LOG("Skipping test - running in slow execution environment.../n"); + return; + } + webrtc::MockVoeConnectionObserver mock_observer; EXPECT_EQ(0, voe_network_->RegisterDeadOrAliveObserver( channel_, mock_observer)); @@ -158,6 +164,11 @@ TEST_F(NetworkTest, DeadOrAliveObserverSeesAliveMessagesIfEnabled) { } TEST_F(NetworkTest, DeadOrAliveObserverSeesDeadMessagesIfEnabled) { + if (!FLAGS_include_timing_dependent_tests) { + TEST_LOG("Skipping test - running in slow execution environment.../n"); + return; + } + // "When do you see them?" - "All the time!" webrtc::MockVoeConnectionObserver mock_observer; EXPECT_EQ(0, voe_network_->RegisterDeadOrAliveObserver( diff --git a/src/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc b/src/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc index 8e2021739..a1ecf76b7 100644 --- a/src/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc +++ b/src/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc @@ -8,9 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "after_streaming_fixture.h" -#include "voe_standard_test.h" -#include "testsupport/fileutils.h" +#include "test/testsupport/fileutils.h" +#include "voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" +#include "voice_engine/test/auto_test/voe_standard_test.h" class TestRtpObserver : public webrtc::VoERTPObserver { public: @@ -139,6 +139,11 @@ void RtcpAppHandler::Reset() { } TEST_F(RtpRtcpTest, RemoteRtcpCnameHasPropagatedToRemoteSide) { + if (!FLAGS_include_timing_dependent_tests) { + TEST_LOG("Skipping test - running in slow execution environment.../n"); + return; + } + // We need to sleep a bit here for the name to propagate. For instance, // 200 milliseconds is not enough, so we'll go with one second here. Sleep(1000); diff --git a/src/voice_engine/test/auto_test/standard/voe_base_misc_test.cc b/src/voice_engine/test/auto_test/standard/voe_base_misc_test.cc index 0388025b8..f96d2c1f0 100644 --- a/src/voice_engine/test/auto_test/standard/voe_base_misc_test.cc +++ b/src/voice_engine/test/auto_test/standard/voe_base_misc_test.cc @@ -8,7 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "before_initialization_fixture.h" +#include "voice_engine/test/auto_test/fixtures/before_initialization_fixture.h" + +#include class VoeBaseMiscTest : public BeforeInitializationFixture { }; @@ -21,6 +23,7 @@ TEST_F(VoeBaseMiscTest, MaxNumChannelsIs32) { TEST_F(VoeBaseMiscTest, GetVersionPrintsSomeUsefulInformation) { char char_buffer[1024]; + memset(char_buffer, 0, sizeof(char_buffer)); EXPECT_EQ(0, voe_base_->GetVersion(char_buffer)); EXPECT_THAT(char_buffer, ContainsRegex("VoiceEngine")); } diff --git a/src/voice_engine/test/auto_test/voe_standard_test.cc b/src/voice_engine/test/auto_test/voe_standard_test.cc index 60cc9b2e0..9977e98a8 100644 --- a/src/voice_engine/test/auto_test/voe_standard_test.cc +++ b/src/voice_engine/test/auto_test/voe_standard_test.cc @@ -8,37 +8,27 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include -#include -#include - -#include "engine_configurations.h" -#if defined(_WIN32) -#include // Exists only on windows. -#include -#endif - #include "voice_engine/test/auto_test/voe_standard_test.h" -#if defined (_ENABLE_VISUAL_LEAK_DETECTOR_) && defined(_DEBUG) && \ - defined(_WIN32) && !defined(_INSTRUMENTATION_TESTING_) -#include "vld.h" -#endif +#include +#include -#include "system_wrappers/interface/critical_section_wrapper.h" +#include "engine_configurations.h" #include "system_wrappers/interface/event_wrapper.h" -#include "system_wrappers/interface/thread_wrapper.h" -#include "voice_engine/voice_engine_defines.h" -#include "voice_engine/test/auto_test/automated_mode.h" - -#ifdef _TEST_NETEQ_STATS_ #include "voice_engine/include/voe_neteq_stats.h" -#endif - +#include "voice_engine/test/auto_test/automated_mode.h" #include "voice_engine/test/auto_test/voe_cpu_test.h" #include "voice_engine/test/auto_test/voe_extended_test.h" #include "voice_engine/test/auto_test/voe_stress_test.h" #include "voice_engine/test/auto_test/voe_unit_test.h" +#include "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."); using namespace webrtc; @@ -535,7 +525,7 @@ int run_auto_test(TestType test_type, ExtendedSelection ext_selection) { } } // namespace voetest -int RunInManualMode(int argc, char** argv) { +int RunInManualMode() { using namespace voetest; SubAPIManager api_manager; @@ -587,7 +577,7 @@ int RunInManualMode(int argc, char** argv) { TEST_LOG("\n\n+++ Running standard tests +++\n\n"); // Currently, all googletest-rewritten tests are in the "automated" suite. - return RunInAutomatedMode(argc, argv); + return RunInAutomatedMode(); } // Function that can be called from other entry functions. @@ -600,12 +590,15 @@ int RunInManualMode(int argc, char** argv) { #if !defined(WEBRTC_IOS) int main(int argc, char** argv) { - if (argc > 1 && std::string(argv[1]) == "--automated") { - // This function is defined in automated_mode.cc to avoid macro clashes - // with googletest (for instance the ASSERT_TRUE macro). - return RunInAutomatedMode(argc, argv); + // This function and RunInAutomatedMode is defined in automated_mode.cc + // to avoid macro clashes with googletest (for instance ASSERT_TRUE). + InitializeGoogleTest(&argc, argv); + google::ParseCommandLineFlags(&argc, &argv, true); + + if (FLAGS_automated) { + return RunInAutomatedMode(); } - return RunInManualMode(argc, argv); + return RunInManualMode(); } #endif //#if !defined(WEBRTC_IOS) diff --git a/src/voice_engine/test/auto_test/voe_standard_test.h b/src/voice_engine/test/auto_test/voe_standard_test.h index bbb6d2e7d..6a58d7b22 100644 --- a/src/voice_engine/test/auto_test/voe_standard_test.h +++ b/src/voice_engine/test/auto_test/voe_standard_test.h @@ -14,6 +14,7 @@ #include #include +#include "gflags/gflags.h" #include "resource_manager.h" #include "voe_audio_processing.h" #include "voe_base.h" @@ -60,6 +61,8 @@ class VoENetEqStats; extern char mobileLogMsg[640]; #endif +DECLARE_bool(include_timing_dependent_tests); + namespace voetest { class SubAPIManager { diff --git a/src/voice_engine/test/voice_engine_tests.gypi b/src/voice_engine/test/voice_engine_tests.gypi index 5e235891c..efa272df0 100644 --- a/src/voice_engine/test/voice_engine_tests.gypi +++ b/src/voice_engine/test/voice_engine_tests.gypi @@ -18,6 +18,7 @@ '<(webrtc_root)/test/test.gyp:test_support', '<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/testing/gmock.gyp:gmock', + '<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags', '<(webrtc_root)/test/libtest/libtest.gyp:libtest', ], 'include_dirs': [ diff --git a/tools/valgrind-webrtc/memcheck/suppressions.txt b/tools/valgrind-webrtc/memcheck/suppressions.txt index 086436184..b84f49819 100644 --- a/tools/valgrind-webrtc/memcheck/suppressions.txt +++ b/tools/valgrind-webrtc/memcheck/suppressions.txt @@ -218,6 +218,171 @@ fun:StartThread } +{ + bug_898_1 + Memcheck:Uninitialized + ... + fun:_ZN16FakeMediaProcess7ProcessEiN6webrtc15ProcessingTypesEPsiib + ... + fun:_ZN6webrtc21AudioDeviceLinuxPulse17PlayThreadProcessEv + fun:_ZN6webrtc21AudioDeviceLinuxPulse14PlayThreadFuncEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + +{ + bug_898_2 + Memcheck:Uninitialized + ... + fun:_ZN16FakeMediaProcess7ProcessEiN6webrtc15ProcessingTypesEPsiib + ... + fun:_ZN6webrtc21AudioDeviceLinuxPulse16RecThreadProcessEv + fun:_ZN6webrtc21AudioDeviceLinuxPulse13RecThreadFuncEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + + +{ + bug_332_1 + Memcheck:Uninitialized + ... + fun:_ZN6webrtc11VoEBaseImpl16NeedMorePlayDataEjhhjPvRj + fun:_ZN6webrtc17AudioDeviceBuffer18RequestPlayoutDataEj + fun:_ZN6webrtc21AudioDeviceLinuxPulse17PlayThreadProcessEv + fun:_ZN6webrtc21AudioDeviceLinuxPulse14PlayThreadFuncEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + +{ + bug_332_2 + Memcheck:Unaddressable + fun:memcpy@@GLIBC_2.14 + fun:_ZN6webrtc21AudioDeviceLinuxPulse16ReadRecordedDataEPKvm + fun:_ZN6webrtc21AudioDeviceLinuxPulse16RecThreadProcessEv + fun:_ZN6webrtc21AudioDeviceLinuxPulse13RecThreadFuncEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + +{ + bug_332_3 + Memcheck:Uninitialized + fun:_ZN6webrtc11RTCPUtility21RTCPParseCommonHeaderEPKhS2_RNS0_16RTCPCommonHeaderE + ... + fun:_ZN6webrtc12RTCPReceiver10HandleSDESERNS_11RTCPUtility12RTCPParserV2E + fun:_ZN6webrtc12RTCPReceiver18IncomingRTCPPacketERNS_8RTCPHelp21RTCPPacketInformationEPNS_11RTCPUtility12RTCPParserV2E + fun:_ZN6webrtc17ModuleRtpRtcpImpl14IncomingPacketEPKht + fun:_ZN6webrtc3voe7Channel18IncomingRTCPPacketEPKaiPKct + fun:_ZN6webrtc16UdpTransportImpl20IncomingRTCPFunctionEPKaiPKNS_13SocketAddressE + fun:_ZN6webrtc16UdpTransportImpl20IncomingRTCPCallbackEPvPKaiPKNS_13SocketAddressE + fun:_ZN6webrtc14UdpSocketPosix11HasIncomingEv + fun:_ZN6webrtc25UdpSocketManagerPosixImpl7ProcessEv + fun:_ZN6webrtc25UdpSocketManagerPosixImpl3RunEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + +{ + bug_332_4 + Memcheck:Uninitialized + ... + fun:_ZN6webrtc3voe10AudioLevel12ComputeLevelERKNS_10AudioFrameE + fun:_ZN6webrtc3voe11OutputMixer28DoOperationsOnCombinedSignalEv + fun:_ZN6webrtc11VoEBaseImpl16NeedMorePlayDataEjhhjPvRj + fun:_ZN6webrtc17AudioDeviceBuffer18RequestPlayoutDataEj + fun:_ZN6webrtc21AudioDeviceLinuxPulse17PlayThreadProcessEv + fun:_ZN6webrtc21AudioDeviceLinuxPulse14PlayThreadFuncEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + +{ + bug_332_5 + Memcheck:Uninitialized + fun:WebRtcSpl_UpBy2ShortToInt + fun:WebRtcSpl_Resample8khzTo22khz + fun:_ZN6webrtc9Resampler4PushEPKsiPsiRi + fun:_ZN6webrtc3voe16RemixAndResampleERKNS_10AudioFrameEPNS_9ResamplerEPS1_ + fun:_ZN6webrtc3voe11OutputMixer13GetMixedAudioEiiPNS_10AudioFrameE + fun:_ZN6webrtc11VoEBaseImpl16NeedMorePlayDataEjhhjPvRj + fun:_ZN6webrtc17AudioDeviceBuffer18RequestPlayoutDataEj + fun:_ZN6webrtc21AudioDeviceLinuxPulse17PlayThreadProcessEv + fun:_ZN6webrtc21AudioDeviceLinuxPulse14PlayThreadFuncEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + +{ + bug_332_6 + Memcheck:Param + socketcall.sendto(msg) + obj:/lib/x86_64-linux-gnu/libpthread-2.15.so + fun:_ZN6webrtc14UdpSocketPosix6SendToEPKaiRKNS_13SocketAddressE + fun:_ZN6webrtc16UdpTransportImpl10SendPacketEiPKvi + ... + fun:_ZN6webrtc21AudioDeviceLinuxPulse16ReadRecordedDataEPKvm + fun:_ZN6webrtc21AudioDeviceLinuxPulse16RecThreadProcessEv + fun:_ZN6webrtc21AudioDeviceLinuxPulse13RecThreadFuncEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + +{ + bug_332_7 + Memcheck:Param + socketcall.sendto(msg) + obj:/lib/x86_64-linux-gnu/libpthread-2.15.so + fun:_ZN6webrtc14UdpSocketPosix6SendToEPKaiRKNS_13SocketAddressE + fun:_ZN6webrtc16UdpTransportImpl14SendRTCPPacketEiPKvi + fun:_ZN6webrtc3voe7Channel14SendRTCPPacketEiPKvi + fun:_ZN6webrtc10RTCPSender13SendToNetworkEPKht + fun:_ZN6webrtc10RTCPSender8SendRTCPEjiPKtbm + fun:_ZN6webrtc17ModuleRtpRtcpImpl7ProcessEv + fun:_ZN6webrtc17ProcessThreadImpl7ProcessEv + fun:_ZN6webrtc17ProcessThreadImpl3RunEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + +{ + bug_332_8 + Memcheck:Uninitialized + fun:linear_to_ulaw + fun:WebRtcG711_EncodeU + fun:_ZN6webrtc7ACMPCMU14InternalEncodeEPhPs + fun:_ZN6webrtc15ACMGenericCodec10EncodeSafeEPhPsPjPNS_21WebRtcACMEncodingTypeE + fun:_ZN6webrtc15ACMGenericCodec6EncodeEPhPsPjPNS_21WebRtcACMEncodingTypeE + fun:_ZN6webrtc21AudioCodingModuleImpl7ProcessEv + fun:_ZN6webrtc3voe7Channel13EncodeAndSendEv + fun:_ZN6webrtc3voe13TransmitMixer13EncodeAndSendEv + fun:_ZN6webrtc11VoEBaseImpl23RecordedDataIsAvailableEPKvjhhjjijRj + fun:_ZN6webrtc17AudioDeviceBuffer19DeliverRecordedDataEv + fun:_ZN6webrtc21AudioDeviceLinuxPulse19ProcessRecordedDataEPajj + fun:_ZN6webrtc21AudioDeviceLinuxPulse16ReadRecordedDataEPKvm + fun:_ZN6webrtc21AudioDeviceLinuxPulse16RecThreadProcessEv + fun:_ZN6webrtc21AudioDeviceLinuxPulse13RecThreadFuncEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + +{ + bug_332_9 + Memcheck:Uninitialized + ... + fun:_ZN6webrtc12RTCPReceiver18IncomingRTCPPacketERNS_8RTCPHelp21RTCPPacketInformationEPNS_11RTCPUtility12RTCPParserV2E + fun:_ZN6webrtc17ModuleRtpRtcpImpl14IncomingPacketEPKht + fun:_ZN6webrtc3voe7Channel18IncomingRTCPPacketEPKaiPKct + fun:_ZN6webrtc16UdpTransportImpl20IncomingRTCPFunctionEPKaiPKNS_13SocketAddressE + fun:_ZN6webrtc16UdpTransportImpl20IncomingRTCPCallbackEPvPKaiPKNS_13SocketAddressE + fun:_ZN6webrtc14UdpSocketPosix11HasIncomingEv + fun:_ZN6webrtc25UdpSocketManagerPosixImpl7ProcessEv + fun:_ZN6webrtc25UdpSocketManagerPosixImpl3RunEPv + fun:_ZN6webrtc11ThreadPosix3RunEv + fun:StartThread +} + { bug_891 Memcheck:Unaddressable @@ -238,3 +403,5 @@ fun:_ZN6webrtc5Trace3AddENS_10TraceLevelENS_11TraceModuleEiPKcz ... } + +