Author: olehougaard
Date: Tue Feb 3 00:35:03 2009
New Revision: 1214
Modified:
branches/bleeding_edge/test/cctest/cctest.cc
branches/bleeding_edge/test/cctest/cctest.h
branches/bleeding_edge/test/cctest/test-serialize.cc
branches/bleeding_edge/test/cctest/testcfg.py
branches/bleeding_edge/tools/test.py
Log:
Fixing the flakiness of the serialization tests by assuring that
serialization is run before every deserialization test.
Review URL: http://codereview.chromium.org/19541
Modified: branches/bleeding_edge/test/cctest/cctest.cc
==============================================================================
--- branches/bleeding_edge/test/cctest/cctest.cc (original)
+++ branches/bleeding_edge/test/cctest/cctest.cc Tue Feb 3 00:35:03 2009
@@ -35,9 +35,9 @@
CcTest* CcTest::last_ = NULL;
-CcTest::CcTest(TestFunction* callback, const char* file,
- const char* name, bool enabled)
- : callback_(callback), name_(name), prev_(last_) {
+CcTest::CcTest(TestFunction* callback, const char* file, const char* name,
+ const char* dependency, bool enabled)
+ : callback_(callback), name_(name), dependency_(dependency),
prev_(last_) {
// Find the base name of this test (const_cast required on Windows).
char *basename = strrchr(const_cast<char *>(file), '/');
if (!basename) {
@@ -62,7 +62,11 @@
static void PrintTestList(CcTest* current) {
if (current == NULL) return;
PrintTestList(current->prev());
- printf("%s/%s\n", current->file(), current->name());
+ if (current->dependency() != NULL) {
+ printf("%s/%s<%s\n", current->file(), current->name(),
current->dependency());
+ } else {
+ printf("%s/%s<\n", current->file(), current->name());
+ }
}
Modified: branches/bleeding_edge/test/cctest/cctest.h
==============================================================================
--- branches/bleeding_edge/test/cctest/cctest.h (original)
+++ branches/bleeding_edge/test/cctest/cctest.h Tue Feb 3 00:35:03 2009
@@ -29,16 +29,23 @@
#define CCTEST_H_
#ifndef TEST
-#define TEST(Name) \
- static void Test##Name(); \
- CcTest register_test_##Name(Test##Name, __FILE__, #Name, true); \
+#define TEST(Name) \
+ static void Test##Name(); \
+ CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, true); \
+ static void Test##Name()
+#endif
+
+#ifndef DEPENDENT_TEST
+#define DEPENDENT_TEST(Name, Dep) \
+ static void Test##Name(); \
+ CcTest register_test_##Name(Test##Name, __FILE__, #Name, #Dep, true); \
static void Test##Name()
#endif
#ifndef DISABLED_TEST
-#define DISABLED_TEST(Name) \
- static void Test##Name(); \
- CcTest register_test_##Name(Test##Name, __FILE__, #Name, false); \
+#define DISABLED_TEST(Name) \
+ static void Test##Name(); \
+ CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, false); \
static void Test##Name()
#endif
@@ -46,18 +53,20 @@
public:
typedef void (TestFunction)();
CcTest(TestFunction* callback, const char* file, const char* name,
- bool enabled);
+ const char* dependency, bool enabled);
void Run() { callback_(); }
static int test_count();
static CcTest* last() { return last_; }
CcTest* prev() { return prev_; }
const char* file() { return file_; }
const char* name() { return name_; }
+ const char* dependency() { return dependency_; }
bool enabled() { return enabled_; }
private:
TestFunction* callback_;
const char* file_;
const char* name_;
+ const char* dependency_;
bool enabled_;
static CcTest* last_;
CcTest* prev_;
Modified: branches/bleeding_edge/test/cctest/test-serialize.cc
==============================================================================
--- branches/bleeding_edge/test/cctest/test-serialize.cc (original)
+++ branches/bleeding_edge/test/cctest/test-serialize.cc Tue Feb 3
00:35:03 2009
@@ -221,7 +221,7 @@
}
-TEST(Deserialize) {
+DEPENDENT_TEST(Deserialize, Serialize) {
v8::HandleScope scope;
Deserialize();
@@ -229,7 +229,7 @@
SanityCheck();
}
-TEST(DeserializeAndRunScript) {
+DEPENDENT_TEST(DeserializeAndRunScript, Serialize) {
v8::HandleScope scope;
Deserialize();
@@ -241,7 +241,7 @@
}
-TEST(DeserializeNatives) {
+DEPENDENT_TEST(DeserializeNatives, Serialize) {
v8::HandleScope scope;
Deserialize();
@@ -254,7 +254,7 @@
}
-TEST(DeserializeExtensions) {
+DEPENDENT_TEST(DeserializeExtensions, Serialize) {
v8::HandleScope scope;
Deserialize();
Modified: branches/bleeding_edge/test/cctest/testcfg.py
==============================================================================
--- branches/bleeding_edge/test/cctest/testcfg.py (original)
+++ branches/bleeding_edge/test/cctest/testcfg.py Tue Feb 3 00:35:03 2009
@@ -36,26 +36,38 @@
class CcTestCase(test.TestCase):
- def __init__(self, path, executable, mode, raw_name, context):
+ def __init__(self, path, executable, mode, raw_name, dependency,
context):
super(CcTestCase, self).__init__(context, path)
self.executable = executable
self.mode = mode
self.raw_name = raw_name
+ self.dependency = dependency
def GetLabel(self):
return "%s %s %s" % (self.mode, self.path[-2], self.path[-1])
def GetName(self):
return self.path[-1]
-
- def GetCommand(self):
+
+ def BuildCommand(self, name):
serialization_file = join('obj', 'test', self.mode, 'serdes')
serialization_option = '--testing_serialization_file=' +
serialization_file
- result = [ self.executable, self.raw_name, serialization_option ]
+ result = [ self.executable, name, serialization_option ]
if self.mode == 'debug':
result += DEBUG_FLAGS
return result
+ def GetCommand(self):
+ return self.BuildCommand(self.raw_name)
+
+ def Run(self):
+ if self.dependency != '':
+ dependent_command = self.BuildCommand(self.dependency)
+ output = self.RunCommand(dependent_command)
+ if output.HasFailed():
+ return output
+ return test.TestCase.Run(self)
+
class CcTestConfiguration(test.TestConfiguration):
@@ -75,10 +87,14 @@
print output.stderr
return []
result = []
- for raw_test in output.stdout.strip().split():
- full_path = current_path + raw_test.split('/')
+ for test_desc in output.stdout.strip().split():
+ raw_test, dependency = test_desc.split('<')
+ relative_path = raw_test.split('/')
+ full_path = current_path + relative_path
+ if dependency != '':
+ dependency = relative_path[0] + '/' + dependency
if self.Contains(path, full_path):
- result.append(CcTestCase(full_path, executable, mode, raw_test,
self.context))
+ result.append(CcTestCase(full_path, executable, mode, raw_test,
dependency, self.context))
return result
def GetTestStatus(self, sections, defs):
Modified: branches/bleeding_edge/tools/test.py
==============================================================================
--- branches/bleeding_edge/tools/test.py (original)
+++ branches/bleeding_edge/tools/test.py Tue Feb 3 00:35:03 2009
@@ -345,12 +345,14 @@
def GetSource(self):
return "(no source available)"
-
- def Run(self):
- command = self.GetCommand()
+
+ def RunCommand(self, command):
full_command = self.context.processor(command)
output = Execute(full_command, self.context, self.context.timeout)
return TestOutput(self, full_command, output)
+
+ def Run(self):
+ return self.RunCommand(self.GetCommand())
class TestOutput(object):
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---