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
R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/15786004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14809 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yurys@chromium.org 2013-05-24 16:19:06 +00:00
parent 2952a77d0b
commit 77d93014ae
2 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -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");
}
}