0002-disable-crash-reporter-death-test.patch (2323B)
1 diff -U8 b/test/test_duplex.cpp b/test/test_duplex.cpp 2 --- b/test/test_duplex.cpp 3 +++ b/test/test_duplex.cpp 4 @@ -13,16 +13,18 @@ 5 #endif 6 #include "cubeb/cubeb.h" 7 #include <atomic> 8 #include <math.h> 9 #include <memory> 10 #include <stdio.h> 11 #include <stdlib.h> 12 13 +#include "mozilla/gtest/MozHelpers.h" 14 + 15 // #define ENABLE_NORMAL_LOG 16 // #define ENABLE_VERBOSE_LOG 17 #include "common.h" 18 19 #define SAMPLE_FREQUENCY 48000 20 #define STREAM_FORMAT CUBEB_SAMPLE_FLOAT32LE 21 #define INPUT_CHANNELS 1 22 #define INPUT_LAYOUT CUBEB_LAYOUT_MONO 23 @@ -196,16 +198,21 @@ TEST(cubeb, duplex_collection_change) 24 25 duplex_collection_change_impl(ctx); 26 r = cubeb_register_device_collection_changed( 27 ctx, static_cast<cubeb_device_type>(CUBEB_DEVICE_TYPE_INPUT), nullptr, 28 nullptr); 29 ASSERT_EQ(r, CUBEB_OK); 30 } 31 32 +void CauseDeath(cubeb * p) { 33 + mozilla::gtest::DisableCrashReporter(); 34 + cubeb_destroy(p); 35 +} 36 + 37 #ifdef GTEST_HAS_DEATH_TEST 38 TEST(cubeb, duplex_collection_change_no_unregister) 39 { 40 cubeb * ctx; 41 int r; 42 43 r = common_init(&ctx, "Cubeb duplex example with collection change"); 44 ASSERT_EQ(r, CUBEB_OK) << "Error initializing cubeb library"; 45 @@ -213,19 +220,27 @@ TEST(cubeb, duplex_collection_change_no_ 46 /* This test needs an available input device, skip it if this host does not 47 * have one. */ 48 if (!can_run_audio_input_test(ctx)) { 49 cubeb_destroy(ctx); 50 return; 51 } 52 53 std::unique_ptr<cubeb, decltype(&cubeb_destroy)> cleanup_cubeb_at_exit( 54 - ctx, [](cubeb * p) noexcept { EXPECT_DEATH(cubeb_destroy(p), ""); }); 55 + ctx, [](cubeb * p) noexcept { EXPECT_DEATH(CauseDeath(p), ""); }); 56 57 duplex_collection_change_impl(ctx); 58 + 59 +# if defined(XP_MACOSX) && !defined(MOZ_DEBUG) 60 + // For some reason this test hangs on macOS in non-debug builds when the child 61 + // process (death test fork) crashes and the crash reporter is enabled in the 62 + // parent process. There is not much left to do that can cause a crash in the 63 + // parent process anyway, so disable the crash reporter where needed to pass. 64 + mozilla::gtest::DisableCrashReporter(); 65 +# endif 66 } 67 #endif 68 69 long 70 data_cb_input(cubeb_stream * stream, void * user, const void * inputbuffer, 71 void * outputbuffer, long nframes) 72 { 73 if (stream == NULL || inputbuffer == NULL || outputbuffer != NULL) {