Skip to content

Commit

Permalink
Ignore scriptID in various tests to support internal bytecode
Browse files Browse the repository at this point in the history
Summary:
When using internal bytecode, the scriptIDs in the heap snapshot all increase
by one, causing the test to fail. Similarly, some of the lit tests hard coded
script IDs. This diff just ignores them so that the tests pass in both modes.

Reviewed By: dulinriley

Differential Revision: D19586939

fbshipit-source-id: 476afcdd92c93c8a100a8a460d9669f57724b666
  • Loading branch information
willholen authored and facebook-github-bot committed Jan 29, 2020
1 parent a193630 commit 6edd27f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/debugger/throw-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ try {
print('caught');
}

// CHECK: Break on script load in global: {{.*}}[1]:11:1
// CHECK: Break on script load in global: {{.*}}[{{[0-9]+}}]:11:1
// CHECK-NEXT: Set pauseOnThrow: all errors
// CHECK-NEXT: Continuing execution
// CHECK-NEXT: Break on exception in global: {{.*}}[1]:12:3
// CHECK-NEXT: Break on exception in global: {{.*}}[{{[0-9]+}}]:12:3
// CHECK-NEXT: 1
// CHECK-NEXT: Continuing execution
4 changes: 2 additions & 2 deletions test/debugger/throw-throw-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ try {
print("Message: " + e.message);
}

// CHECK: Break on script load in global: {{.*}}[1]:13:1
// CHECK: Break on script load in global: {{.*}}[{{[0-9]+}}]:13:1
// CHECK-NEXT: Set pauseOnThrow: all errors
// CHECK-NEXT: Continuing execution
// CHECK-NEXT: Break on exception in global: {{.*}}[1]:14:3
// CHECK-NEXT: Break on exception in global: {{.*}}[{{[0-9]+}}]:14:3
// CHECK-NEXT: Exception: Error: Bar
// CHECK-NEXT: 0: eval: {{.*}}
// CHECK-NEXT: 1: (native)
Expand Down
10 changes: 6 additions & 4 deletions unittests/VMRuntime/HeapSnapshotTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,9 @@ TEST_F(HeapSnapshotRuntimeTest, FunctionLocationForLazyCode) {
// The location isn't emitted in fully optimized builds.
const JSONArray &locations = *llvm::cast<JSONArray>(root->at("locations"));
Location loc = FIND_LOCATION_FOR_ID(funcID, locations, nodes, strings);
// The location should be the first file, at line 1 column 5 with indenting
EXPECT_EQ(loc, Location(expected, 1, 1, 5));
// The location should be the given file, at line 1 column 5 with indenting
auto scriptId = func->getRuntimeModule()->getScriptID();
EXPECT_EQ(loc, Location(expected, scriptId, 1, 5));
#else
(void)findLocationForID;
#endif
Expand Down Expand Up @@ -724,8 +725,9 @@ TEST_F(HeapSnapshotRuntimeTest, FunctionLocationAndNameTest) {
// The location isn't emitted in fully optimized builds.
const JSONArray &locations = *llvm::cast<JSONArray>(root->at("locations"));
Location loc = FIND_LOCATION_FOR_ID(funcID, locations, nodes, strings);
// The location should be the first file, second line, third column
EXPECT_EQ(loc, Location(expected, 1, 2, 3));
// The location should be the given file, second line, third column
auto scriptId = func->getRuntimeModule()->getScriptID();
EXPECT_EQ(loc, Location(expected, scriptId, 2, 3));
#else
(void)findLocationForID;
#endif
Expand Down

0 comments on commit 6edd27f

Please sign in to comment.