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 <yvesg@google.com>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29157}
This commit is contained in:
Yves Gerey
2019-09-11 15:53:01 +02:00
committed by Commit Bot
parent 0ba1705c6a
commit ff060eef97

View File

@ -501,10 +501,22 @@ class MockAudioTransport : public test::MockAudioTransport {
// AudioDeviceTest test fixture. // 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<webrtc::AudioDeviceModule::AudioLayer> { : public ::testing::TestWithParam<webrtc::AudioDeviceModule::AudioLayer> {
protected: protected:
AudioDeviceTest() MAYBE_AudioDeviceTest()
: audio_layer_(GetParam()), : audio_layer_(GetParam()),
task_queue_factory_(CreateDefaultTaskQueueFactory()) { task_queue_factory_(CreateDefaultTaskQueueFactory()) {
rtc::LogMessage::LogToDebug(rtc::LS_INFO); rtc::LogMessage::LogToDebug(rtc::LS_INFO);
@ -553,7 +565,7 @@ class AudioDeviceTest
// An alternative would be for the mock to outlive audio_device. // An alternative would be for the mock to outlive audio_device.
void PreTearDown() { EXPECT_EQ(0, audio_device_->Terminate()); } void PreTearDown() { EXPECT_EQ(0, audio_device_->Terminate()); }
virtual ~AudioDeviceTest() { virtual ~MAYBE_AudioDeviceTest() {
if (audio_device_) { if (audio_device_) {
EXPECT_EQ(0, audio_device_->Terminate()); EXPECT_EQ(0, audio_device_->Terminate());
} }
@ -655,7 +667,7 @@ class AudioDeviceTest
// Instead of using the test fixture, verify that the different factory methods // Instead of using the test fixture, verify that the different factory methods
// work as intended. // work as intended.
TEST(AudioDeviceTestWin, ConstructDestructWithFactory) { TEST(MAYBE_AudioDeviceTestWin, ConstructDestructWithFactory) {
std::unique_ptr<TaskQueueFactory> task_queue_factory = std::unique_ptr<TaskQueueFactory> task_queue_factory =
CreateDefaultTaskQueueFactory(); CreateDefaultTaskQueueFactory();
rtc::scoped_refptr<AudioDeviceModule> audio_device; rtc::scoped_refptr<AudioDeviceModule> audio_device;
@ -691,9 +703,9 @@ TEST(AudioDeviceTestWin, ConstructDestructWithFactory) {
} }
// Uses the test fixture to create, initialize and destruct the ADM. // 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()); SKIP_TEST_IF_NOT(requirements_satisfied());
// Initialization is part of the test fixture. // Initialization is part of the test fixture.
EXPECT_TRUE(audio_device()->Initialized()); EXPECT_TRUE(audio_device()->Initialized());
@ -702,7 +714,7 @@ TEST_P(AudioDeviceTest, InitTerminate) {
} }
// Enumerate all available and active output devices. // Enumerate all available and active output devices.
TEST_P(AudioDeviceTest, PlayoutDeviceNames) { TEST_P(MAYBE_AudioDeviceTest, PlayoutDeviceNames) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
char device_name[kAdmMaxDeviceNameSize]; char device_name[kAdmMaxDeviceNameSize];
char unique_id[kAdmMaxGuidSize]; char unique_id[kAdmMaxGuidSize];
@ -719,7 +731,7 @@ TEST_P(AudioDeviceTest, PlayoutDeviceNames) {
} }
// Enumerate all available and active input devices. // Enumerate all available and active input devices.
TEST_P(AudioDeviceTest, RecordingDeviceNames) { TEST_P(MAYBE_AudioDeviceTest, RecordingDeviceNames) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
char device_name[kAdmMaxDeviceNameSize]; char device_name[kAdmMaxDeviceNameSize];
char unique_id[kAdmMaxGuidSize]; 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. // 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()); SKIP_TEST_IF_NOT(requirements_satisfied());
int num_devices = audio_device()->PlayoutDevices(); int num_devices = audio_device()->PlayoutDevices();
if (NewWindowsAudioDeviceModuleIsUsed()) { if (NewWindowsAudioDeviceModuleIsUsed()) {
@ -760,7 +772,7 @@ TEST_P(AudioDeviceTest, SetPlayoutDevice) {
} }
// Counts number of active input devices and ensure that all can be selected. // 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()); SKIP_TEST_IF_NOT(requirements_satisfied());
int num_devices = audio_device()->RecordingDevices(); int num_devices = audio_device()->RecordingDevices();
if (NewWindowsAudioDeviceModuleIsUsed()) { if (NewWindowsAudioDeviceModuleIsUsed()) {
@ -783,14 +795,14 @@ TEST_P(AudioDeviceTest, SetRecordingDevice) {
} }
// Tests Start/Stop playout without any registered audio callback. // Tests Start/Stop playout without any registered audio callback.
TEST_P(AudioDeviceTest, StartStopPlayout) { TEST_P(MAYBE_AudioDeviceTest, StartStopPlayout) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
StartPlayout(); StartPlayout();
StopPlayout(); StopPlayout();
} }
// Tests Start/Stop recording without any registered audio callback. // Tests Start/Stop recording without any registered audio callback.
TEST_P(AudioDeviceTest, StartStopRecording) { TEST_P(MAYBE_AudioDeviceTest, StartStopRecording) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
StartRecording(); StartRecording();
StopRecording(); StopRecording();
@ -799,7 +811,7 @@ TEST_P(AudioDeviceTest, StartStopRecording) {
// Tests Init/Stop/Init recording without any registered audio callback. // Tests Init/Stop/Init recording without any registered audio callback.
// See https://bugs.chromium.org/p/webrtc/issues/detail?id=8041 for details // See https://bugs.chromium.org/p/webrtc/issues/detail?id=8041 for details
// on why this test is useful. // on why this test is useful.
TEST_P(AudioDeviceTest, InitStopInitRecording) { TEST_P(MAYBE_AudioDeviceTest, InitStopInitRecording) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
EXPECT_EQ(0, audio_device()->InitRecording()); EXPECT_EQ(0, audio_device()->InitRecording());
EXPECT_TRUE(audio_device()->RecordingIsInitialized()); EXPECT_TRUE(audio_device()->RecordingIsInitialized());
@ -810,7 +822,7 @@ TEST_P(AudioDeviceTest, InitStopInitRecording) {
// Verify that additional attempts to initialize or start recording while // Verify that additional attempts to initialize or start recording while
// already being active works. Additional calls should just be ignored. // 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()); SKIP_TEST_IF_NOT(requirements_satisfied());
StartRecording(); StartRecording();
// An additional attempt to initialize at this stage should be ignored. // 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 // Verify that additional attempts to initialize or start playou while
// already being active works. Additional calls should just be ignored. // 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()); SKIP_TEST_IF_NOT(requirements_satisfied());
StartPlayout(); StartPlayout();
// An additional attempt to initialize at this stage should be ignored. // 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. // Tests Init/Stop/Init recording while playout is active.
TEST_P(AudioDeviceTest, InitStopInitRecordingWhilePlaying) { TEST_P(MAYBE_AudioDeviceTest, InitStopInitRecordingWhilePlaying) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
StartPlayout(); StartPlayout();
EXPECT_EQ(0, audio_device()->InitRecording()); EXPECT_EQ(0, audio_device()->InitRecording());
@ -845,7 +857,7 @@ TEST_P(AudioDeviceTest, InitStopInitRecordingWhilePlaying) {
} }
// Tests Init/Stop/Init playout without any registered audio callback. // 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()); SKIP_TEST_IF_NOT(requirements_satisfied());
EXPECT_EQ(0, audio_device()->InitPlayout()); EXPECT_EQ(0, audio_device()->InitPlayout());
EXPECT_TRUE(audio_device()->PlayoutIsInitialized()); EXPECT_TRUE(audio_device()->PlayoutIsInitialized());
@ -855,7 +867,7 @@ TEST_P(AudioDeviceTest, InitStopInitPlayout) {
} }
// Tests Init/Stop/Init playout while recording is active. // Tests Init/Stop/Init playout while recording is active.
TEST_P(AudioDeviceTest, InitStopInitPlayoutWhileRecording) { TEST_P(MAYBE_AudioDeviceTest, InitStopInitPlayoutWhileRecording) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
StartRecording(); StartRecording();
EXPECT_EQ(0, audio_device()->InitPlayout()); EXPECT_EQ(0, audio_device()->InitPlayout());
@ -871,7 +883,7 @@ TEST_P(AudioDeviceTest, InitStopInitPlayoutWhileRecording) {
#ifdef WEBRTC_WIN #ifdef WEBRTC_WIN
// Tests Start/Stop playout followed by a second session (emulates a restart // Tests Start/Stop playout followed by a second session (emulates a restart
// triggered by a user using public APIs). // triggered by a user using public APIs).
TEST_P(AudioDeviceTest, StartStopPlayoutWithExternalRestart) { TEST_P(MAYBE_AudioDeviceTest, StartStopPlayoutWithExternalRestart) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
StartPlayout(); StartPlayout();
StopPlayout(); StopPlayout();
@ -883,7 +895,7 @@ TEST_P(AudioDeviceTest, StartStopPlayoutWithExternalRestart) {
// Tests Start/Stop recording followed by a second session (emulates a restart // Tests Start/Stop recording followed by a second session (emulates a restart
// triggered by a user using public APIs). // triggered by a user using public APIs).
TEST_P(AudioDeviceTest, StartStopRecordingWithExternalRestart) { TEST_P(MAYBE_AudioDeviceTest, StartStopRecordingWithExternalRestart) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
StartRecording(); StartRecording();
StopRecording(); StopRecording();
@ -897,7 +909,7 @@ TEST_P(AudioDeviceTest, StartStopRecordingWithExternalRestart) {
// triggered by an internal callback e.g. corresponding to a device switch). // triggered by an internal callback e.g. corresponding to a device switch).
// Note that, internal restart is only supported in combination with the latest // Note that, internal restart is only supported in combination with the latest
// Windows ADM. // Windows ADM.
TEST_P(AudioDeviceTest, StartStopPlayoutWithInternalRestart) { TEST_P(MAYBE_AudioDeviceTest, StartStopPlayoutWithInternalRestart) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
if (audio_layer() != AudioDeviceModule::kWindowsCoreAudio2) { if (audio_layer() != AudioDeviceModule::kWindowsCoreAudio2) {
return; return;
@ -942,7 +954,7 @@ TEST_P(AudioDeviceTest, StartStopPlayoutWithInternalRestart) {
// triggered by an internal callback e.g. corresponding to a device switch). // triggered by an internal callback e.g. corresponding to a device switch).
// Note that, internal restart is only supported in combination with the latest // Note that, internal restart is only supported in combination with the latest
// Windows ADM. // Windows ADM.
TEST_P(AudioDeviceTest, StartStopRecordingWithInternalRestart) { TEST_P(MAYBE_AudioDeviceTest, StartStopRecordingWithInternalRestart) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
if (audio_layer() != AudioDeviceModule::kWindowsCoreAudio2) { if (audio_layer() != AudioDeviceModule::kWindowsCoreAudio2) {
return; return;
@ -991,7 +1003,7 @@ TEST_P(AudioDeviceTest, StartStopRecordingWithInternalRestart) {
// Note that we can't add expectations on audio parameters in EXPECT_CALL // 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 // since parameter are not provided in the each callback. We therefore test and
// verify the parameters in the fake audio transport implementation instead. // 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()); SKIP_TEST_IF_NOT(requirements_satisfied());
MockAudioTransport mock(TransportType::kPlay); MockAudioTransport mock(TransportType::kPlay);
mock.HandleCallbacks(event(), nullptr, kNumCallbacks); 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 // Start recording and verify that the native audio layer starts providing real
// audio samples using the RecordedDataIsAvailable() callback. // audio samples using the RecordedDataIsAvailable() callback.
TEST_P(AudioDeviceTest, MAYBE_StartRecordingVerifyCallbacks) { TEST_P(MAYBE_AudioDeviceTest, MAYBE_StartRecordingVerifyCallbacks) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
MockAudioTransport mock(TransportType::kRecord); MockAudioTransport mock(TransportType::kRecord);
mock.HandleCallbacks(event(), nullptr, kNumCallbacks); 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 // Start playout and recording (full-duplex audio) and verify that audio is
// active in both directions. // active in both directions.
TEST_P(AudioDeviceTest, MAYBE_StartPlayoutAndRecordingVerifyCallbacks) { TEST_P(MAYBE_AudioDeviceTest, MAYBE_StartPlayoutAndRecordingVerifyCallbacks) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
MockAudioTransport mock(TransportType::kPlayAndRecord); MockAudioTransport mock(TransportType::kPlayAndRecord);
mock.HandleCallbacks(event(), nullptr, kNumCallbacks); 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 // 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 // (max and average) of the FIFO. The size of the FIFO is increased by the
// recording side and decreased by the playout side. // recording side and decreased by the playout side.
TEST_P(AudioDeviceTest, RunPlayoutAndRecordingInFullDuplex) { TEST_P(MAYBE_AudioDeviceTest, RunPlayoutAndRecordingInFullDuplex) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
NiceMock<MockAudioTransport> mock(TransportType::kPlayAndRecord); NiceMock<MockAudioTransport> mock(TransportType::kPlayAndRecord);
FifoAudioStream audio_stream; 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 // 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 // to ensure that the audio quality is good and that real device switches works
// as intended. // as intended.
TEST_P(AudioDeviceTest, TEST_P(MAYBE_AudioDeviceTest,
DISABLED_RunPlayoutAndRecordingInFullDuplexAndWaitForEnterKey) { DISABLED_RunPlayoutAndRecordingInFullDuplexAndWaitForEnterKey) {
SKIP_TEST_IF_NOT(requirements_satisfied()); SKIP_TEST_IF_NOT(requirements_satisfied());
if (audio_layer() != AudioDeviceModule::kWindowsCoreAudio2) { 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 // 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 // close to the speaker to ensure highest possible echo. It is also recommended
// to run the test at highest possible output volume. // 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()); SKIP_TEST_IF_NOT(requirements_satisfied());
NiceMock<MockAudioTransport> mock(TransportType::kPlayAndRecord); NiceMock<MockAudioTransport> mock(TransportType::kPlayAndRecord);
LatencyAudioStream audio_stream; LatencyAudioStream audio_stream;
@ -1170,14 +1182,14 @@ TEST_P(AudioDeviceTest, DISABLED_MeasureLoopbackLatency) {
// implementations) for Windows. // implementations) for Windows.
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
AudioLayerWin, AudioLayerWin,
AudioDeviceTest, MAYBE_AudioDeviceTest,
::testing::Values(AudioDeviceModule::kPlatformDefaultAudio, ::testing::Values(AudioDeviceModule::kPlatformDefaultAudio,
AudioDeviceModule::kWindowsCoreAudio2)); AudioDeviceModule::kWindowsCoreAudio2));
#else #else
// For all platforms but Windows, only test the default audio layer. // For all platforms but Windows, only test the default audio layer.
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
AudioLayer, AudioLayer,
AudioDeviceTest, MAYBE_AudioDeviceTest,
::testing::Values(AudioDeviceModule::kPlatformDefaultAudio)); ::testing::Values(AudioDeviceModule::kPlatformDefaultAudio));
#endif #endif