Reviewers: Jakob, Sven Panne, loislo, alph,
Description:
Un-flake test-cpu-profiler/SampleWhenFrameIsNotSetup
It is OK for FindChild to return NULL. If the child must
exist GetChild should be used to force the assertion.
BUG=v8:2628
Please review this at https://codereview.chromium.org/15786004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M test/cctest/cctest.status
M test/cctest/test-cpu-profiler.cc
Index: test/cctest/cctest.status
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
index
d1925dc25798aff4e8c0bcf3930aa3aa5853e1e5..731e54d07c212cd26125ef5e9e7479d7c48f1fb0
100644
--- a/test/cctest/cctest.status
+++ b/test/cctest/cctest.status
@@ -39,9 +39,6 @@ test-api/ApplyInterruption: PASS || TIMEOUT
# when snapshot is on, so I am marking it PASS || FAIL
test-heap-profiler/HeapSnapshotsDiff: PASS || FAIL
-# BUG(2628): These tests are flaky and sometimes fail, but should not
crash.
-test-cpu-profiler/SampleWhenFrameIsNotSetup: PASS || FAIL
-
# These tests always fail. They are here to test test.py. If
# they don't fail then test.py has failed.
test-serialize/TestThatAlwaysFails: FAIL
Index: test/cctest/test-cpu-profiler.cc
diff --git a/test/cctest/test-cpu-profiler.cc
b/test/cctest/test-cpu-profiler.cc
index
22af9e75b3e3e4135548c3528b31889a41dfe1eb..be745c815a672cdd236d3793f698a6a6ea0e4337
100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -434,17 +434,23 @@ static const v8::CpuProfileNode* FindChild(const
v8::CpuProfileNode* node,
const v8::CpuProfileNode* child = node->GetChild(i);
if (nameHandle->Equals(child->GetFunctionName())) return child;
}
- CHECK(false);
return NULL;
}
+static const v8::CpuProfileNode* GetChild(const v8::CpuProfileNode* node,
+ const char* name) {
+ const v8::CpuProfileNode* result = FindChild(node, name);
+ CHECK(result);
+ return result;
+}
+
+
static void CheckSimpleBranch(const v8::CpuProfileNode* node,
const char* names[], int length) {
for (int i = 0; i < length; i++) {
const char* name = names[i];
- node = FindChild(node, name);
- CHECK(node);
+ node = GetChild(node, name);
int expectedChildrenCount = (i == length - 1) ? 0 : 1;
CHECK_EQ(expectedChildrenCount, node->GetChildrenCount());
}
@@ -535,10 +541,10 @@ TEST(CollectCpuProfile) {
names[2] = v8::String::New("start");
CheckChildrenNames(root, names);
- const v8::CpuProfileNode* startNode = FindChild(root, "start");
+ const v8::CpuProfileNode* startNode = GetChild(root, "start");
CHECK_EQ(1, startNode->GetChildrenCount());
- const v8::CpuProfileNode* fooNode = FindChild(startNode, "foo");
+ const v8::CpuProfileNode* fooNode = GetChild(startNode, "foo");
CHECK_EQ(3, fooNode->GetChildrenCount());
const char* barBranch[] = { "bar", "delay", "loop" };
@@ -612,10 +618,10 @@ TEST(SampleWhenFrameIsNotSetup) {
// check there.
if (startNode && startNode->GetChildrenCount() > 0) {
CHECK_EQ(1, startNode->GetChildrenCount());
- const v8::CpuProfileNode* delayNode = FindChild(startNode, "delay");
+ const v8::CpuProfileNode* delayNode = GetChild(startNode, "delay");
if (delayNode->GetChildrenCount() > 0) {
CHECK_EQ(1, delayNode->GetChildrenCount());
- FindChild(delayNode, "loop");
+ GetChild(delayNode, "loop");
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.