From d005468e9bcfe4d6c219994f4b90fa55c6fd8272 Mon Sep 17 00:00:00 2001 From: "phoglund@webrtc.org" Date: Wed, 9 Jan 2013 16:53:42 +0000 Subject: [PATCH] Generalized mechanism for excluding gtests on platforms, disabled broken tests on mac. BUG=1268 TEST=vie_auto_test on mac and linux TBR=mflodman, kjellander Review URL: https://webrtc-codereview.appspot.com/1027006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3347 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/test/test.gyp | 1 + webrtc/test/testsupport/gtest_disable.h | 39 ++++++++++++++++++ .../auto_test/automated/legacy_fixture.cc | 4 +- .../test/auto_test/automated/legacy_fixture.h | 8 ++-- .../automated/two_windows_fixture.cc | 8 ++-- .../automated/vie_api_integration_test.cc | 34 +++++++-------- .../vie_extended_integration_test.cc | 41 +++++++++++-------- .../auto_test/automated/vie_rtp_fuzz_test.cc | 22 +++++----- .../vie_standard_integration_test.cc | 24 +++++------ .../automated/vie_video_verification_test.cc | 4 +- .../fixtures/before_initialization_fixture.h | 20 +-------- 11 files changed, 117 insertions(+), 88 deletions(-) create mode 100644 webrtc/test/testsupport/gtest_disable.h diff --git a/webrtc/test/test.gyp b/webrtc/test/test.gyp index 2184eff27b..914aec89af 100644 --- a/webrtc/test/test.gyp +++ b/webrtc/test/test.gyp @@ -42,6 +42,7 @@ 'testsupport/frame_writer.cc', 'testsupport/frame_writer.h', 'testsupport/gtest_prod_util.h', + 'testsupport/gtest_disable.h', 'testsupport/mock/mock_frame_reader.h', 'testsupport/mock/mock_frame_writer.h', 'testsupport/packet_reader.cc', diff --git a/webrtc/test/testsupport/gtest_disable.h b/webrtc/test/testsupport/gtest_disable.h new file mode 100644 index 0000000000..b4a661f4bb --- /dev/null +++ b/webrtc/test/testsupport/gtest_disable.h @@ -0,0 +1,39 @@ +/* + * 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. + */ +#ifndef TEST_TESTSUPPORT_INCLUDE_GTEST_DISABLE_H_ +#define TEST_TESTSUPPORT_INCLUDE_GTEST_DISABLE_H_ + +// Helper macros for platform disables. These can be chained. Example use: +// TEST_F(ViEStandardIntegrationTest, +// DISABLED_ON_LINUX(RunsBaseTestWithoutErrors)) { // ... +// +// Or, you can disable a whole test class by wrapping all mentions of the test +// class name inside one of these macros. +// +// The platform #defines we are looking at here are set by the build system. +#ifdef WEBRTC_LINUX +#define DISABLED_ON_LINUX(test) DISABLED_##test +#else +#define DISABLED_ON_LINUX(test) test +#endif + +#ifdef WEBRTC_MAC +#define DISABLED_ON_MAC(test) DISABLED_##test +#else +#define DISABLED_ON_MAC(test) test +#endif + +#ifdef _WIN32 +#define DISABLED_ON_WIN(test) DISABLED_##test +#else +#define DISABLED_ON_WIN(test) test +#endif + +#endif // TEST_TESTSUPPORT_INCLUDE_GTEST_DISABLE_H_ diff --git a/webrtc/video_engine/test/auto_test/automated/legacy_fixture.cc b/webrtc/video_engine/test/auto_test/automated/legacy_fixture.cc index 591a567199..08c49d8d6e 100644 --- a/webrtc/video_engine/test/auto_test/automated/legacy_fixture.cc +++ b/webrtc/video_engine/test/auto_test/automated/legacy_fixture.cc @@ -8,9 +8,9 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "video_engine/test/auto_test/automated/legacy_fixture.h" +#include "webrtc/video_engine/test/auto_test/automated/legacy_fixture.h" -#include "video_engine/test/auto_test/interface/vie_autotest.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h" void LegacyFixture::SetUpTestCase() { TwoWindowsFixture::SetUpTestCase(); diff --git a/webrtc/video_engine/test/auto_test/automated/legacy_fixture.h b/webrtc/video_engine/test/auto_test/automated/legacy_fixture.h index b4527669fd..2386f4ba6c 100644 --- a/webrtc/video_engine/test/auto_test/automated/legacy_fixture.h +++ b/webrtc/video_engine/test/auto_test/automated/legacy_fixture.h @@ -8,10 +8,10 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SRC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_ -#define SRC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_ +#ifndef WEBRTC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_ +#define WEBRTC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_ -#include "video_engine/test/auto_test/automated/two_windows_fixture.h" +#include "webrtc/video_engine/test/auto_test/automated/two_windows_fixture.h" // Inherited by old-style standard integration tests based on ViEAutoTest. class LegacyFixture : public TwoWindowsFixture { @@ -26,4 +26,4 @@ class LegacyFixture : public TwoWindowsFixture { static ViEAutoTest* tests_; }; -#endif // SRC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_ +#endif // WEBRTC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_ diff --git a/webrtc/video_engine/test/auto_test/automated/two_windows_fixture.cc b/webrtc/video_engine/test/auto_test/automated/two_windows_fixture.cc index a4a551d6d0..d190920d75 100644 --- a/webrtc/video_engine/test/auto_test/automated/two_windows_fixture.cc +++ b/webrtc/video_engine/test/auto_test/automated/two_windows_fixture.cc @@ -8,16 +8,16 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "video_engine/test/auto_test/automated/two_windows_fixture.h" +#include "webrtc/video_engine/test/auto_test/automated/two_windows_fixture.h" -#include "video_engine/test/auto_test/interface/vie_window_creator.h" -#include "video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_window_creator.h" void TwoWindowsFixture::SetUpTestCase() { window_creator_ = new ViEWindowCreator(); ViEAutoTestWindowManagerInterface* window_manager = - window_creator_->CreateTwoWindows(); + window_creator_->CreateTwoWindows(); window_1_ = window_manager->GetWindow1(); window_2_ = window_manager->GetWindow2(); diff --git a/webrtc/video_engine/test/auto_test/automated/vie_api_integration_test.cc b/webrtc/video_engine/test/auto_test/automated/vie_api_integration_test.cc index 82a205b0e0..7b49103b9f 100644 --- a/webrtc/video_engine/test/auto_test/automated/vie_api_integration_test.cc +++ b/webrtc/video_engine/test/auto_test/automated/vie_api_integration_test.cc @@ -8,53 +8,55 @@ * be found in the AUTHORS file in the root of the source tree. */ -/** - * Runs "extended" integration tests. - */ - #include "gtest/gtest.h" -#include "legacy_fixture.h" -#include "vie_autotest.h" +#include "webrtc/test/testsupport/gtest_disable.h" +#include "webrtc/video_engine/test/auto_test/automated/legacy_fixture.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h" namespace { -class ViEApiIntegrationTest : public LegacyFixture { +// TODO(phoglund): These tests are generally broken on mac. +// http://code.google.com/p/webrtc/issues/detail?id=1268 +class DISABLED_ON_MAC(ViEApiIntegrationTest) : public LegacyFixture { }; -TEST_F(ViEApiIntegrationTest, RunsBaseTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), RunsBaseTestWithoutErrors) { tests_->ViEBaseAPITest(); } // TODO(phoglund): Crashes on the v4l2loopback camera. -TEST_F(ViEApiIntegrationTest, DISABLED_RunsCaptureTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), + DISABLED_RunsCaptureTestWithoutErrors) { tests_->ViECaptureAPITest(); } -TEST_F(ViEApiIntegrationTest, RunsCodecTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), RunsCodecTestWithoutErrors) { tests_->ViECodecAPITest(); } -TEST_F(ViEApiIntegrationTest, RunsEncryptionTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), + RunsEncryptionTestWithoutErrors) { tests_->ViEEncryptionAPITest(); } -TEST_F(ViEApiIntegrationTest, RunsFileTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), RunsFileTestWithoutErrors) { tests_->ViEFileAPITest(); } -TEST_F(ViEApiIntegrationTest, RunsImageProcessTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), + RunsImageProcessTestWithoutErrors) { tests_->ViEImageProcessAPITest(); } -TEST_F(ViEApiIntegrationTest, RunsNetworkTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), RunsNetworkTestWithoutErrors) { tests_->ViENetworkAPITest(); } -TEST_F(ViEApiIntegrationTest, RunsRenderTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), RunsRenderTestWithoutErrors) { tests_->ViERenderAPITest(); } -TEST_F(ViEApiIntegrationTest, RunsRtpRtcpTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEApiIntegrationTest), RunsRtpRtcpTestWithoutErrors) { tests_->ViERtpRtcpAPITest(); } diff --git a/webrtc/video_engine/test/auto_test/automated/vie_extended_integration_test.cc b/webrtc/video_engine/test/auto_test/automated/vie_extended_integration_test.cc index 7d16db0632..c091475cac 100644 --- a/webrtc/video_engine/test/auto_test/automated/vie_extended_integration_test.cc +++ b/webrtc/video_engine/test/auto_test/automated/vie_extended_integration_test.cc @@ -8,54 +8,61 @@ * be found in the AUTHORS file in the root of the source tree. */ -/** - * Runs "extended" integration tests. - */ - #include "gtest/gtest.h" -#include "legacy_fixture.h" -#include "vie_autotest.h" +#include "webrtc/test/testsupport/gtest_disable.h" +#include "webrtc/video_engine/test/auto_test/automated/legacy_fixture.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h" namespace { -class ViEExtendedIntegrationTest : public LegacyFixture { +// TODO(phoglund): These tests are generally broken on mac. +// http://code.google.com/p/webrtc/issues/detail?id=1268 +class DISABLED_ON_MAC(ViEExtendedIntegrationTest) : public LegacyFixture { }; -TEST_F(ViEExtendedIntegrationTest, RunsBaseTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), RunsBaseTestWithoutErrors) { tests_->ViEBaseExtendedTest(); } // TODO(phoglund): Crashes on the v4l2loopback camera. -TEST_F(ViEExtendedIntegrationTest, DISABLED_RunsCaptureTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), + DISABLED_RunsCaptureTestWithoutErrors) { tests_->ViECaptureExtendedTest(); } -TEST_F(ViEExtendedIntegrationTest, RunsCodecTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), + RunsCodecTestWithoutErrors) { tests_->ViECodecExtendedTest(); } -TEST_F(ViEExtendedIntegrationTest, RunsEncryptionTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), + RunsEncryptionTestWithoutErrors) { tests_->ViEEncryptionExtendedTest(); } -TEST_F(ViEExtendedIntegrationTest, RunsFileTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), + RunsFileTestWithoutErrors) { tests_->ViEFileExtendedTest(); } -TEST_F(ViEExtendedIntegrationTest, RunsImageProcessTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), + RunsImageProcessTestWithoutErrors) { tests_->ViEImageProcessExtendedTest(); } -TEST_F(ViEExtendedIntegrationTest, RunsNetworkTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), + RunsNetworkTestWithoutErrors) { tests_->ViENetworkExtendedTest(); } -TEST_F(ViEExtendedIntegrationTest, RunsRenderTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), + RunsRenderTestWithoutErrors) { tests_->ViERenderExtendedTest(); } -TEST_F(ViEExtendedIntegrationTest, RunsRtpRtcpTestWithoutErrors) { +TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), + RunsRtpRtcpTestWithoutErrors) { tests_->ViERtpRtcpExtendedTest(); } -} // namespace +} // namespace diff --git a/webrtc/video_engine/test/auto_test/automated/vie_rtp_fuzz_test.cc b/webrtc/video_engine/test/auto_test/automated/vie_rtp_fuzz_test.cc index c86233e289..bdf3e862a3 100644 --- a/webrtc/video_engine/test/auto_test/automated/vie_rtp_fuzz_test.cc +++ b/webrtc/video_engine/test/auto_test/automated/vie_rtp_fuzz_test.cc @@ -10,17 +10,17 @@ #include -#include "gtest/gtest.h" #include "gflags/gflags.h" -#include "test/libtest/include/bit_flip_encryption.h" -#include "test/libtest/include/random_encryption.h" -#include "video_engine/test/auto_test/automated/two_windows_fixture.h" -#include "video_engine/test/auto_test/interface/vie_window_creator.h" -#include "video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h" -#include "video_engine/test/auto_test/primitives/general_primitives.h" -#include "video_engine/test/libvietest/include/tb_capture_device.h" -#include "video_engine/test/libvietest/include/tb_interfaces.h" -#include "video_engine/test/libvietest/include/tb_video_channel.h" +#include "gtest/gtest.h" +#include "webrtc/test/libtest/include/bit_flip_encryption.h" +#include "webrtc/test/libtest/include/random_encryption.h" +#include "webrtc/video_engine/test/auto_test/automated/two_windows_fixture.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_window_creator.h" +#include "webrtc/video_engine/test/auto_test/primitives/general_primitives.h" +#include "webrtc/video_engine/test/libvietest/include/tb_capture_device.h" +#include "webrtc/video_engine/test/libvietest/include/tb_interfaces.h" +#include "webrtc/video_engine/test/libvietest/include/tb_video_channel.h" namespace { @@ -28,7 +28,7 @@ DEFINE_int32(rtp_fuzz_test_rand_seed, 0, "The rand seed to use for " "the RTP fuzz test. Defaults to time(). 0 cannot be specified."); class ViERtpFuzzTest : public TwoWindowsFixture { - protected: +protected: TbVideoChannel* video_channel_; TbInterfaces* video_engine_; TbCaptureDevice* capture_device_; diff --git a/webrtc/video_engine/test/auto_test/automated/vie_standard_integration_test.cc b/webrtc/video_engine/test/auto_test/automated/vie_standard_integration_test.cc index e85b6e4cb6..4f90aace81 100644 --- a/webrtc/video_engine/test/auto_test/automated/vie_standard_integration_test.cc +++ b/webrtc/video_engine/test/auto_test/automated/vie_standard_integration_test.cc @@ -8,24 +8,22 @@ * be found in the AUTHORS file in the root of the source tree. */ -/* - * This file contains the "standard" suite of integration tests, implemented - * as a GUnit test. This file is a part of the effort to try to automate all - * tests in this section of the code. Currently, this code makes no attempt - * to verify any video output - it only checks for direct errors. - */ +// This file contains the "standard" suite of integration tests, implemented +// as a GUnit test. This file is a part of the effort to try to automate all +// tests in this section of the code. Currently, this code makes no attempt +// to verify any video output - it only checks for direct errors. #include #include "gflags/gflags.h" #include "gtest/gtest.h" -#include "legacy_fixture.h" -#include "testsupport/metrics/video_metrics.h" -#include "vie_autotest.h" -#include "vie_autotest_window_manager_interface.h" -#include "vie_to_file_renderer.h" -#include "vie_window_creator.h" -#include "testsupport/metrics/video_metrics.h" +#include "webrtc/test/testsupport/metrics/video_metrics.h" +#include "webrtc/test/testsupport/metrics/video_metrics.h" +#include "webrtc/video_engine/test/auto_test/automated/legacy_fixture.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h" +#include "webrtc/video_engine/test/auto_test/interface/vie_window_creator.h" +#include "webrtc/video_engine/test/libvietest/include/vie_to_file_renderer.h" namespace { diff --git a/webrtc/video_engine/test/auto_test/automated/vie_video_verification_test.cc b/webrtc/video_engine/test/auto_test/automated/vie_video_verification_test.cc index 12aa621b99..e35f17c1d4 100644 --- a/webrtc/video_engine/test/auto_test/automated/vie_video_verification_test.cc +++ b/webrtc/video_engine/test/auto_test/automated/vie_video_verification_test.cc @@ -11,8 +11,8 @@ #include #include "gtest/gtest.h" -#include "testsupport/fileutils.h" -#include "testsupport/metrics/video_metrics.h" +#include "webrtc/test/testsupport/fileutils.h" +#include "webrtc/test/testsupport/metrics/video_metrics.h" #include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h" #include "webrtc/video_engine/test/auto_test/interface/vie_file_based_comparison_tests.h" #include "webrtc/video_engine/test/auto_test/primitives/framedrop_primitives.h" diff --git a/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h b/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h index c65ea6a350..77d8305621 100644 --- a/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h +++ b/webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h @@ -15,6 +15,7 @@ #include "common_types.h" #include "engine_configurations.h" +#include "test/testsupport/gtest_disable.h" #include "voice_engine/include/voe_audio_processing.h" #include "voice_engine/include/voe_base.h" #include "voice_engine/include/voe_call_report.h" @@ -39,25 +40,6 @@ #include "gtest/gtest.h" #include "gmock/gmock.h" -// Helper macros for platform disables. These can be chained. -#ifdef WEBRTC_LINUX -#define DISABLED_ON_LINUX(test) DISABLED_##test -#else -#define DISABLED_ON_LINUX(test) test -#endif - -#ifdef WEBRTC_MAC -#define DISABLED_ON_MAC(test) DISABLED_##test -#else -#define DISABLED_ON_MAC(test) test -#endif - -#ifdef _WIN32 -#define DISABLED_ON_WIN(test) DISABLED_##test -#else -#define DISABLED_ON_WIN(test) test -#endif - // This convenient fixture sets up all voice engine interfaces automatically for // use by testing subclasses. It allocates each interface and releases it once // which means that if a tests allocates additional interfaces from the voice