Skip to content

Commit

Permalink
Fix failing MVSC benchmark builds (#1573)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1573

Noticed a recent stack of commits cause the MVSC builds of benchmark to fail. This was due to forgetting to call `.string()` of a path and trying to escape a character that cannot be escaped.

Reviewed By: philIip

Differential Revision: D53461723

fbshipit-source-id: b6cc034d53b3a61929012965e257a3984c3bff47
  • Loading branch information
joevilches authored and facebook-github-bot committed Feb 6, 2024
1 parent 94960f1 commit a37565f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions benchmark/Benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

#include <filesystem>
#include <fstream>

#include <benchmark/Benchmark.h>
Expand Down Expand Up @@ -138,7 +139,7 @@ YGUnit unitFromJson(json& j) {
std::string unit = j["unit"];
if (unit == "px") {
return YGUnitPoint;
} else if (unit == "\%") {
} else if (unit == "pct") {
return YGUnitPercent;
} else {
throw std::invalid_argument(invalidArgumentMessage(unit, "YGUnit"));
Expand Down Expand Up @@ -382,7 +383,7 @@ void benchmark(std::filesystem::path& capturesDir) {
totalDurations[i] = result.treeCreationDuration + result.layoutDuration;
}

std::string captureName = capture.path().stem();
std::string captureName = capture.path().stem().string();
printBenchmarkResult(captureName + " tree creation", treeCreationDurations);
printBenchmarkResult(captureName + " layout", layoutDurations);
printBenchmarkResult(captureName + " total", totalDurations);
Expand Down
2 changes: 1 addition & 1 deletion capture/NodeToString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static void appendYGValueIfNotDefault(
} else if (value.unit == YGUnitUndefined) {
j["style"][key] = "undefined";
} else {
std::string unit = value.unit == YGUnitPoint ? "px" : "%%";
std::string unit = value.unit == YGUnitPoint ? "px" : "pct";
j["style"][key]["value"] = value.value;
j["style"][key]["unit"] = unit;
}
Expand Down

0 comments on commit a37565f

Please sign in to comment.