Skip to content

Commit

Permalink
Fix HeapSnapshotTest when using MallocGC
Browse files Browse the repository at this point in the history
Summary:
Hades overrides snapshotAddGCNativeEdges()/snapshotAddGCNativeNodes()
while MallocGC does not, so in `HeaderTest`, we should use different
node/edge numbers for them.

Reviewed By: neildhar

Differential Revision: D58454132

fbshipit-source-id: 5716f703209512052034c9107c105cd4e1a64011
  • Loading branch information
lavenzg authored and facebook-github-bot committed Jun 12, 2024
1 parent 2aafa0f commit f8c9fcb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions unittests/VMRuntime/HeapSnapshotTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,15 @@ TEST(HeapSnapshotTest, HeaderTest) {

JSONObject *snapshot = llvh::cast<JSONObject>(root->at("snapshot"));

// Hades overrides snapshotAddGCNativeEdges()/snapshotAddGCNativeNodes(),
// which adds 2 more nodes and edges, while MallocGC does not.
#ifdef HERMESVM_GC_MALLOC
EXPECT_EQ(llvh::cast<JSONNumber>(snapshot->at("node_count"))->getValue(), 9);
EXPECT_EQ(llvh::cast<JSONNumber>(snapshot->at("edge_count"))->getValue(), 4);
#else
EXPECT_EQ(llvh::cast<JSONNumber>(snapshot->at("node_count"))->getValue(), 11);
EXPECT_EQ(llvh::cast<JSONNumber>(snapshot->at("edge_count"))->getValue(), 6);
#endif
EXPECT_EQ(
llvh::cast<JSONNumber>(snapshot->at("trace_function_count"))->getValue(),
0);
Expand Down

0 comments on commit f8c9fcb

Please sign in to comment.