From ff060eef97dbb6c91a69d682371e9af4a6bb89a4 Mon Sep 17 00:00:00 2001 From: Yves Gerey Date: Wed, 11 Sep 2019 15:53:01 +0200 Subject: [PATCH] Disable AudioDeviceTest unittests under sanitizers. Both the tests and the code under test are very old, unstaffed and not a part of webRTC stack. Here sanitizers make the tests hang, without providing useful report. So we are just disabling them, without intention to re-enable them. Bug: webrtc:10951 Change-Id: I40e97208606ba3f0eb5b19d404f7d038e6cc2bdf Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152487 Commit-Queue: Yves Gerey Reviewed-by: Henrik Andreassson Cr-Commit-Position: refs/heads/master@{#29157} --- modules/audio_device/audio_device_unittest.cc | 72 +++++++++++-------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/modules/audio_device/audio_device_unittest.cc b/modules/audio_device/audio_device_unittest.cc index 55382a59a7..cd6be0ab7f 100644 --- a/modules/audio_device/audio_device_unittest.cc +++ b/modules/audio_device/audio_device_unittest.cc @@ -501,10 +501,22 @@ class MockAudioTransport : public test::MockAudioTransport { // AudioDeviceTest test fixture. -class AudioDeviceTest +// bugs.webrtc.org/9808 +// Both the tests and the code under test are very old, unstaffed and not +// a part of webRTC stack. +// Here sanitizers make the tests hang, without providing usefull report. +// So we are just disabling them, without intention to re-enable them. +#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ + defined(THREAD_SANITIZER) || defined(UNDEFINED_SANITIZER) +#define MAYBE_AudioDeviceTest DISABLED_AudioDeviceTest +#else +#define MAYBE_AudioDeviceTest AudioDeviceTest +#endif + +class MAYBE_AudioDeviceTest : public ::testing::TestWithParam { protected: - AudioDeviceTest() + MAYBE_AudioDeviceTest() : audio_layer_(GetParam()), task_queue_factory_(CreateDefaultTaskQueueFactory()) { rtc::LogMessage::LogToDebug(rtc::LS_INFO); @@ -553,7 +565,7 @@ class AudioDeviceTest // An alternative would be for the mock to outlive audio_device. void PreTearDown() { EXPECT_EQ(0, audio_device_->Terminate()); } - virtual ~AudioDeviceTest() { + virtual ~MAYBE_AudioDeviceTest() { if (audio_device_) { EXPECT_EQ(0, audio_device_->Terminate()); } @@ -655,7 +667,7 @@ class AudioDeviceTest // Instead of using the test fixture, verify that the different factory methods // work as intended. -TEST(AudioDeviceTestWin, ConstructDestructWithFactory) { +TEST(MAYBE_AudioDeviceTestWin, ConstructDestructWithFactory) { std::unique_ptr task_queue_factory = CreateDefaultTaskQueueFactory(); rtc::scoped_refptr audio_device; @@ -691,9 +703,9 @@ TEST(AudioDeviceTestWin, ConstructDestructWithFactory) { } // Uses the test fixture to create, initialize and destruct the ADM. -TEST_P(AudioDeviceTest, ConstructDestructDefault) {} +TEST_P(MAYBE_AudioDeviceTest, ConstructDestructDefault) {} -TEST_P(AudioDeviceTest, InitTerminate) { +TEST_P(MAYBE_AudioDeviceTest, InitTerminate) { SKIP_TEST_IF_NOT(requirements_satisfied()); // Initialization is part of the test fixture. EXPECT_TRUE(audio_device()->Initialized()); @@ -702,7 +714,7 @@ TEST_P(AudioDeviceTest, InitTerminate) { } // Enumerate all available and active output devices. -TEST_P(AudioDeviceTest, PlayoutDeviceNames) { +TEST_P(MAYBE_AudioDeviceTest, PlayoutDeviceNames) { SKIP_TEST_IF_NOT(requirements_satisfied()); char device_name[kAdmMaxDeviceNameSize]; char unique_id[kAdmMaxGuidSize]; @@ -719,7 +731,7 @@ TEST_P(AudioDeviceTest, PlayoutDeviceNames) { } // Enumerate all available and active input devices. -TEST_P(AudioDeviceTest, RecordingDeviceNames) { +TEST_P(MAYBE_AudioDeviceTest, RecordingDeviceNames) { SKIP_TEST_IF_NOT(requirements_satisfied()); char device_name[kAdmMaxDeviceNameSize]; char unique_id[kAdmMaxGuidSize]; @@ -737,7 +749,7 @@ TEST_P(AudioDeviceTest, RecordingDeviceNames) { } // Counts number of active output devices and ensure that all can be selected. -TEST_P(AudioDeviceTest, SetPlayoutDevice) { +TEST_P(MAYBE_AudioDeviceTest, SetPlayoutDevice) { SKIP_TEST_IF_NOT(requirements_satisfied()); int num_devices = audio_device()->PlayoutDevices(); if (NewWindowsAudioDeviceModuleIsUsed()) { @@ -760,7 +772,7 @@ TEST_P(AudioDeviceTest, SetPlayoutDevice) { } // Counts number of active input devices and ensure that all can be selected. -TEST_P(AudioDeviceTest, SetRecordingDevice) { +TEST_P(MAYBE_AudioDeviceTest, SetRecordingDevice) { SKIP_TEST_IF_NOT(requirements_satisfied()); int num_devices = audio_device()->RecordingDevices(); if (NewWindowsAudioDeviceModuleIsUsed()) { @@ -783,14 +795,14 @@ TEST_P(AudioDeviceTest, SetRecordingDevice) { } // Tests Start/Stop playout without any registered audio callback. -TEST_P(AudioDeviceTest, StartStopPlayout) { +TEST_P(MAYBE_AudioDeviceTest, StartStopPlayout) { SKIP_TEST_IF_NOT(requirements_satisfied()); StartPlayout(); StopPlayout(); } // Tests Start/Stop recording without any registered audio callback. -TEST_P(AudioDeviceTest, StartStopRecording) { +TEST_P(MAYBE_AudioDeviceTest, StartStopRecording) { SKIP_TEST_IF_NOT(requirements_satisfied()); StartRecording(); StopRecording(); @@ -799,7 +811,7 @@ TEST_P(AudioDeviceTest, StartStopRecording) { // Tests Init/Stop/Init recording without any registered audio callback. // See https://bugs.chromium.org/p/webrtc/issues/detail?id=8041 for details // on why this test is useful. -TEST_P(AudioDeviceTest, InitStopInitRecording) { +TEST_P(MAYBE_AudioDeviceTest, InitStopInitRecording) { SKIP_TEST_IF_NOT(requirements_satisfied()); EXPECT_EQ(0, audio_device()->InitRecording()); EXPECT_TRUE(audio_device()->RecordingIsInitialized()); @@ -810,7 +822,7 @@ TEST_P(AudioDeviceTest, InitStopInitRecording) { // Verify that additional attempts to initialize or start recording while // already being active works. Additional calls should just be ignored. -TEST_P(AudioDeviceTest, StartInitRecording) { +TEST_P(MAYBE_AudioDeviceTest, StartInitRecording) { SKIP_TEST_IF_NOT(requirements_satisfied()); StartRecording(); // An additional attempt to initialize at this stage should be ignored. @@ -822,7 +834,7 @@ TEST_P(AudioDeviceTest, StartInitRecording) { // Verify that additional attempts to initialize or start playou while // already being active works. Additional calls should just be ignored. -TEST_P(AudioDeviceTest, StartInitPlayout) { +TEST_P(MAYBE_AudioDeviceTest, StartInitPlayout) { SKIP_TEST_IF_NOT(requirements_satisfied()); StartPlayout(); // An additional attempt to initialize at this stage should be ignored. @@ -833,7 +845,7 @@ TEST_P(AudioDeviceTest, StartInitPlayout) { } // Tests Init/Stop/Init recording while playout is active. -TEST_P(AudioDeviceTest, InitStopInitRecordingWhilePlaying) { +TEST_P(MAYBE_AudioDeviceTest, InitStopInitRecordingWhilePlaying) { SKIP_TEST_IF_NOT(requirements_satisfied()); StartPlayout(); EXPECT_EQ(0, audio_device()->InitRecording()); @@ -845,7 +857,7 @@ TEST_P(AudioDeviceTest, InitStopInitRecordingWhilePlaying) { } // Tests Init/Stop/Init playout without any registered audio callback. -TEST_P(AudioDeviceTest, InitStopInitPlayout) { +TEST_P(MAYBE_AudioDeviceTest, InitStopInitPlayout) { SKIP_TEST_IF_NOT(requirements_satisfied()); EXPECT_EQ(0, audio_device()->InitPlayout()); EXPECT_TRUE(audio_device()->PlayoutIsInitialized()); @@ -855,7 +867,7 @@ TEST_P(AudioDeviceTest, InitStopInitPlayout) { } // Tests Init/Stop/Init playout while recording is active. -TEST_P(AudioDeviceTest, InitStopInitPlayoutWhileRecording) { +TEST_P(MAYBE_AudioDeviceTest, InitStopInitPlayoutWhileRecording) { SKIP_TEST_IF_NOT(requirements_satisfied()); StartRecording(); EXPECT_EQ(0, audio_device()->InitPlayout()); @@ -871,7 +883,7 @@ TEST_P(AudioDeviceTest, InitStopInitPlayoutWhileRecording) { #ifdef WEBRTC_WIN // Tests Start/Stop playout followed by a second session (emulates a restart // triggered by a user using public APIs). -TEST_P(AudioDeviceTest, StartStopPlayoutWithExternalRestart) { +TEST_P(MAYBE_AudioDeviceTest, StartStopPlayoutWithExternalRestart) { SKIP_TEST_IF_NOT(requirements_satisfied()); StartPlayout(); StopPlayout(); @@ -883,7 +895,7 @@ TEST_P(AudioDeviceTest, StartStopPlayoutWithExternalRestart) { // Tests Start/Stop recording followed by a second session (emulates a restart // triggered by a user using public APIs). -TEST_P(AudioDeviceTest, StartStopRecordingWithExternalRestart) { +TEST_P(MAYBE_AudioDeviceTest, StartStopRecordingWithExternalRestart) { SKIP_TEST_IF_NOT(requirements_satisfied()); StartRecording(); StopRecording(); @@ -897,7 +909,7 @@ TEST_P(AudioDeviceTest, StartStopRecordingWithExternalRestart) { // triggered by an internal callback e.g. corresponding to a device switch). // Note that, internal restart is only supported in combination with the latest // Windows ADM. -TEST_P(AudioDeviceTest, StartStopPlayoutWithInternalRestart) { +TEST_P(MAYBE_AudioDeviceTest, StartStopPlayoutWithInternalRestart) { SKIP_TEST_IF_NOT(requirements_satisfied()); if (audio_layer() != AudioDeviceModule::kWindowsCoreAudio2) { return; @@ -942,7 +954,7 @@ TEST_P(AudioDeviceTest, StartStopPlayoutWithInternalRestart) { // triggered by an internal callback e.g. corresponding to a device switch). // Note that, internal restart is only supported in combination with the latest // Windows ADM. -TEST_P(AudioDeviceTest, StartStopRecordingWithInternalRestart) { +TEST_P(MAYBE_AudioDeviceTest, StartStopRecordingWithInternalRestart) { SKIP_TEST_IF_NOT(requirements_satisfied()); if (audio_layer() != AudioDeviceModule::kWindowsCoreAudio2) { return; @@ -991,7 +1003,7 @@ TEST_P(AudioDeviceTest, StartStopRecordingWithInternalRestart) { // Note that we can't add expectations on audio parameters in EXPECT_CALL // since parameter are not provided in the each callback. We therefore test and // verify the parameters in the fake audio transport implementation instead. -TEST_P(AudioDeviceTest, StartPlayoutVerifyCallbacks) { +TEST_P(MAYBE_AudioDeviceTest, StartPlayoutVerifyCallbacks) { SKIP_TEST_IF_NOT(requirements_satisfied()); MockAudioTransport mock(TransportType::kPlay); mock.HandleCallbacks(event(), nullptr, kNumCallbacks); @@ -1023,7 +1035,7 @@ TEST_P(AudioDeviceTest, StartPlayoutVerifyCallbacks) { // Start recording and verify that the native audio layer starts providing real // audio samples using the RecordedDataIsAvailable() callback. -TEST_P(AudioDeviceTest, MAYBE_StartRecordingVerifyCallbacks) { +TEST_P(MAYBE_AudioDeviceTest, MAYBE_StartRecordingVerifyCallbacks) { SKIP_TEST_IF_NOT(requirements_satisfied()); MockAudioTransport mock(TransportType::kRecord); mock.HandleCallbacks(event(), nullptr, kNumCallbacks); @@ -1039,7 +1051,7 @@ TEST_P(AudioDeviceTest, MAYBE_StartRecordingVerifyCallbacks) { // Start playout and recording (full-duplex audio) and verify that audio is // active in both directions. -TEST_P(AudioDeviceTest, MAYBE_StartPlayoutAndRecordingVerifyCallbacks) { +TEST_P(MAYBE_AudioDeviceTest, MAYBE_StartPlayoutAndRecordingVerifyCallbacks) { SKIP_TEST_IF_NOT(requirements_satisfied()); MockAudioTransport mock(TransportType::kPlayAndRecord); mock.HandleCallbacks(event(), nullptr, kNumCallbacks); @@ -1069,7 +1081,7 @@ TEST_P(AudioDeviceTest, MAYBE_StartPlayoutAndRecordingVerifyCallbacks) { // sequence by running in loopback for a few seconds while measuring the size // (max and average) of the FIFO. The size of the FIFO is increased by the // recording side and decreased by the playout side. -TEST_P(AudioDeviceTest, RunPlayoutAndRecordingInFullDuplex) { +TEST_P(MAYBE_AudioDeviceTest, RunPlayoutAndRecordingInFullDuplex) { SKIP_TEST_IF_NOT(requirements_satisfied()); NiceMock mock(TransportType::kPlayAndRecord); FifoAudioStream audio_stream; @@ -1102,7 +1114,7 @@ TEST_P(AudioDeviceTest, RunPlayoutAndRecordingInFullDuplex) { // Runs audio in full duplex until user hits Enter. Intended as a manual test // to ensure that the audio quality is good and that real device switches works // as intended. -TEST_P(AudioDeviceTest, +TEST_P(MAYBE_AudioDeviceTest, DISABLED_RunPlayoutAndRecordingInFullDuplexAndWaitForEnterKey) { SKIP_TEST_IF_NOT(requirements_satisfied()); if (audio_layer() != AudioDeviceModule::kWindowsCoreAudio2) { @@ -1140,7 +1152,7 @@ TEST_P(AudioDeviceTest, // some sort of audio feedback loop. E.g. a headset where the mic is placed // close to the speaker to ensure highest possible echo. It is also recommended // to run the test at highest possible output volume. -TEST_P(AudioDeviceTest, DISABLED_MeasureLoopbackLatency) { +TEST_P(MAYBE_AudioDeviceTest, DISABLED_MeasureLoopbackLatency) { SKIP_TEST_IF_NOT(requirements_satisfied()); NiceMock mock(TransportType::kPlayAndRecord); LatencyAudioStream audio_stream; @@ -1170,14 +1182,14 @@ TEST_P(AudioDeviceTest, DISABLED_MeasureLoopbackLatency) { // implementations) for Windows. INSTANTIATE_TEST_SUITE_P( AudioLayerWin, - AudioDeviceTest, + MAYBE_AudioDeviceTest, ::testing::Values(AudioDeviceModule::kPlatformDefaultAudio, AudioDeviceModule::kWindowsCoreAudio2)); #else // For all platforms but Windows, only test the default audio layer. INSTANTIATE_TEST_SUITE_P( AudioLayer, - AudioDeviceTest, + MAYBE_AudioDeviceTest, ::testing::Values(AudioDeviceModule::kPlatformDefaultAudio)); #endif