From 01d7aad5486bdde112d1fe9f0cce80caca78583f Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Wed, 5 Dec 2018 15:00:35 -0800 Subject: [PATCH] Guard calls to debug features in fabric test Summary: In some setup, buck cxx test for android runs with `NDEBUG` set, hence we can't call debug symbols in the test cases. So guard those callsites with `#ifndef NDEBUG`. Also, some dependencies for this test target depend on Android specific symbols, so we have to mark it as instrumentation test for now (FB-specific). Reviewed By: sahrens Differential Revision: D13337637 fbshipit-source-id: 02ff152df9937f2b0b8596f53789cdee8ee8a539 --- ReactCommon/fabric/uimanager/BUCK | 1 + .../fabric/uimanager/tests/UITemplateProcessorTest.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/ReactCommon/fabric/uimanager/BUCK b/ReactCommon/fabric/uimanager/BUCK index dc23ab77f..c4c0d73df 100644 --- a/ReactCommon/fabric/uimanager/BUCK +++ b/ReactCommon/fabric/uimanager/BUCK @@ -79,6 +79,7 @@ fb_xplat_cxx_test( "-Wall", ], contacts = ["oncall+react_native@xmail.facebook.com"], + fbandroid_use_instrumentation_test = True, platforms = (ANDROID, APPLE), deps = [ "xplat//folly:molly", diff --git a/ReactCommon/fabric/uimanager/tests/UITemplateProcessorTest.cpp b/ReactCommon/fabric/uimanager/tests/UITemplateProcessorTest.cpp index 377e5daa3..bd0176947 100644 --- a/ReactCommon/fabric/uimanager/tests/UITemplateProcessorTest.cpp +++ b/ReactCommon/fabric/uimanager/tests/UITemplateProcessorTest.cpp @@ -111,7 +111,9 @@ TEST(UITemplateProcessorTest, testSimpleBytecode) { *componentDescriptorRegistry, nativeModuleRegistry, mockReactNativeConfig_); +#ifndef NDEBUG LOG(INFO) << std::endl << root1->getDebugDescription(); +#endif auto props1 = std::dynamic_pointer_cast(root1->getProps()); ASSERT_NEAR(props1->opacity, 0.5, 0.001); ASSERT_STREQ(props1->testId.c_str(), "root"); @@ -147,7 +149,9 @@ TEST(UITemplateProcessorTest, testConditionalBytecode) { *componentDescriptorRegistry, nativeModuleRegistry, mockReactNativeConfig_); +#ifndef NDEBUG LOG(INFO) << std::endl << root1->getDebugDescription(); +#endif auto props1 = std::dynamic_pointer_cast(root1->getProps()); ASSERT_STREQ(props1->testId.c_str(), "root"); auto children1 = root1->getChildren();