Skip to content

Commit

Permalink
FuseboxTracer: fix internal and oss tests
Browse files Browse the repository at this point in the history
Summary: # Changelog: [Internal]

Differential Revision: D58586169
  • Loading branch information
hoxyq authored and facebook-github-bot committed Jun 14, 2024
1 parent 39774fd commit b06a1ef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ target_link_libraries(jsinspector
glog
react_featureflags
runtimeexecutor
reactperflogger
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ add_compile_options(
-Wall
-Wpedantic)

file(GLOB reactperflogger_SRC CONFIGURE_DEPENDS reactperflogger/*.cpp)
file(GLOB reactperflogger_SRC CONFIGURE_DEPENDS
reactperflogger/*.cpp
reactperflogger/fusebox/*.cpp)
add_library(reactperflogger STATIC ${reactperflogger_SRC})

target_include_directories(reactperflogger PUBLIC .)
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@

#include "reactperflogger/FuseboxTracer.h"

folly::dynamic stopTracingAndCollect() {
folly::dynamic trace = folly::dynamic::array;
FuseboxTracer::stopTracing([&trace](const folly::dynamic& eventsChunk) {
for (const auto& event : eventsChunk) {
trace.push_back(event);
}
});
return trace;
}
namespace facebook::react {

namespace {

class FuseboxTracerTest : public ::testing::Test {
protected:
Expand All @@ -32,8 +26,20 @@ class FuseboxTracerTest : public ::testing::Test {
void TearDown() override {
stopTracingAndCollect();
}

folly::dynamic stopTracingAndCollect() {
folly::dynamic trace = folly::dynamic::array;
FuseboxTracer::stopTracing([&trace](const folly::dynamic& eventsChunk) {
for (const auto& event : eventsChunk) {
trace.push_back(event);
}
});
return trace;
}
};

} // namespace

TEST_F(FuseboxTracerTest, TracingOffByDefault) {
EXPECT_FALSE(FuseboxTracer::isTracing());
}
Expand Down Expand Up @@ -70,3 +76,5 @@ TEST_F(FuseboxTracerTest, MultiEvents) {
EXPECT_GE(stopTracingAndCollect().size(), 10);
EXPECT_EQ(stopTracingAndCollect().size(), 0);
}

} // namespace facebook::react

0 comments on commit b06a1ef

Please sign in to comment.