Skip to content

Commit

Permalink
fix internal and oss tests (#44947)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #44947

# Changelog: [Internal]

Differential Revision: D58586169
  • Loading branch information
hoxyq authored and facebook-github-bot committed Jun 15, 2024
1 parent fa645f2 commit 718398e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 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 @@ -15,7 +15,7 @@

#include <chrono>

#include <fusebox/FuseboxTracer.h>
#include <reactperflogger/fusebox/FuseboxTracer.h>

using namespace std::chrono;
using namespace std::literals::string_view_literals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

#include <cxxreact/JSExecutor.h>
#include <cxxreact/ReactMarker.h>
#include <fusebox/FuseboxTracer.h>
#include <jsi/instrumentation.h>
#include <react/performance/timeline/PerformanceEntryReporter.h>
#include <reactperflogger/fusebox/FuseboxTracer.h>
#include "NativePerformance.h"
#include "Plugins.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ add_compile_options(
-Wall
-Wpedantic)

file(GLOB reactperflogger_SRC CONFIGURE_DEPENDS reactperflogger/*.cpp)

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

target_include_directories(reactperflogger PUBLIC .)

target_link_libraries(reactperflogger folly_runtime)
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ end
folly_config = get_folly_config()
folly_compiler_flags = folly_config[:compiler_flags]
folly_version = folly_config[:version]
boost_compiler_flags = '-Wno-documentation'

use_frameworks = ENV['USE_FRAMEWORKS'] != nil

Pod::Spec.new do |s|
s.name = "React-perflogger"
Expand All @@ -30,7 +31,17 @@ Pod::Spec.new do |s|
s.author = "Meta Platforms, Inc. and its affiliates"
s.platforms = min_supported_versions
s.source = source
s.source_files = "**/*.{cpp,h}"
s.source_files = "reactperflogger/*.{cpp,h}", "fusebox/*.{cpp,h}"
s.header_dir = "reactperflogger"
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++20" }
s.compiler_flags = folly_compiler_flags
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/..\" \"$(PODS_ROOT)/RCT-Folly\"",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
"DEFINES_MODULE" => "YES"
}.merge!(use_frameworks ? {
"PUBLIC_HEADERS_FOLDER_PATH" => "#{module_name}.framework/Headers/#{header_dir}"
} : {})

s.dependency "RCT-Folly", folly_version
end
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <functional>
#include <vector>
#include "folly/json/dynamic.h"
#include "folly/dynamic.h"

namespace facebook::react {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,14 @@

#include <gtest/gtest.h>

#include "fusebox/FuseboxTracer.h"
#include <reactperflogger/fusebox/FuseboxTracer.h>

using namespace ::testing;

namespace facebook::react {

namespace {

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

class FuseboxTracerTest : public ::testing::Test {
protected:
FuseboxTracerTest() = default;
Expand All @@ -39,6 +28,17 @@ class FuseboxTracerTest : public ::testing::Test {
void TearDown() override {
stopTracingAndCollect();
}

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

} // namespace
Expand Down

0 comments on commit 718398e

Please sign in to comment.