[test] Remove dependent commands.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#34428}
This commit is contained in:
machenbach 2016-03-02 05:12:59 -08:00 committed by Commit bot
parent 9fd5261d7f
commit 76876b9ae9
9 changed files with 72 additions and 112 deletions

View File

@ -51,11 +51,13 @@ v8::base::Atomic32 CcTest::isolate_used_ = 0;
v8::ArrayBuffer::Allocator* CcTest::allocator_ = NULL;
v8::Isolate* CcTest::isolate_ = NULL;
CcTest::CcTest(TestFunction* callback, const char* file, const char* name,
const char* dependency, bool enabled, bool initialize)
: callback_(callback), name_(name), dependency_(dependency),
enabled_(enabled), initialize_(initialize), prev_(last_) {
bool enabled, bool initialize)
: callback_(callback),
name_(name),
enabled_(enabled),
initialize_(initialize),
prev_(last_) {
// Find the base name of this test (const_cast required on Windows).
char *basename = strrchr(const_cast<char *>(file), '/');
if (!basename) {
@ -128,12 +130,7 @@ void CcTest::DisableAutomaticDispose() {
static void PrintTestList(CcTest* current) {
if (current == NULL) return;
PrintTestList(current->prev());
if (current->dependency() != NULL) {
printf("%s/%s<%s\n",
current->file(), current->name(), current->dependency());
} else {
printf("%s/%s<\n", current->file(), current->name());
}
printf("%s/%s\n", current->file(), current->name());
}

View File

@ -34,37 +34,23 @@
#include "src/v8.h"
#ifndef TEST
#define TEST(Name) \
static void Test##Name(); \
CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, true, true); \
#define TEST(Name) \
static void Test##Name(); \
CcTest register_test_##Name(Test##Name, __FILE__, #Name, true, true); \
static void Test##Name()
#endif
#ifndef UNINITIALIZED_TEST
#define UNINITIALIZED_TEST(Name) \
static void Test##Name(); \
CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, true, false); \
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, true); \
static void Test##Name()
#endif
#ifndef UNINITIALIZED_DEPENDENT_TEST
#define UNINITIALIZED_DEPENDENT_TEST(Name, Dep) \
static void Test##Name(); \
CcTest register_test_##Name(Test##Name, __FILE__, #Name, #Dep, true, false); \
#define UNINITIALIZED_TEST(Name) \
static void Test##Name(); \
CcTest register_test_##Name(Test##Name, __FILE__, #Name, true, false); \
static void Test##Name()
#endif
#ifndef DISABLED_TEST
#define DISABLED_TEST(Name) \
static void Test##Name(); \
CcTest register_test_##Name(Test##Name, __FILE__, #Name, NULL, false, true); \
#define DISABLED_TEST(Name) \
static void Test##Name(); \
CcTest register_test_##Name(Test##Name, __FILE__, #Name, false, true); \
static void Test##Name()
#endif
@ -94,14 +80,13 @@ class CcTest {
public:
typedef void (TestFunction)();
CcTest(TestFunction* callback, const char* file, const char* name,
const char* dependency, bool enabled, bool initialize);
bool enabled, bool initialize);
~CcTest() { i::DeleteArray(file_); }
void Run();
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_; }
static v8::Isolate* isolate() {
@ -168,7 +153,6 @@ class CcTest {
TestFunction* callback_;
const char* file_;
const char* name_;
const char* dependency_;
bool enabled_;
bool initialize_;
CcTest* prev_;

View File

@ -39,7 +39,6 @@
# 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],
'test-serialize/DependentTestThatAlwaysFails': [FAIL],
'test-api/SealHandleScope': [FAIL],
# This test always fails. It tests that LiveEdit causes abort when turned off.

View File

@ -34,10 +34,9 @@
#define HEAP_TEST(Name) \
CcTest register_test_##Name(v8::internal::HeapTester::Test##Name, __FILE__, \
#Name, NULL, true, true); \
#Name, true, true); \
void v8::internal::HeapTester::Test##Name()
#define THREADED_HEAP_TEST(Name) \
RegisterThreadedTest register_##Name(v8::internal::HeapTester::Test##Name, \
#Name); \

View File

@ -197,14 +197,15 @@ static void SanityCheck(v8::Isolate* v8_isolate) {
isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("Empty"));
}
UNINITIALIZED_DEPENDENT_TEST(Deserialize, Serialize) {
UNINITIALIZED_TEST(Deserialize) {
// The serialize-deserialize tests only work if the VM is built without
// serialization. That doesn't matter. We don't need to be able to
// serialize a snapshot in a VM that is booted from a snapshot.
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = Deserialize();
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
isolate = Deserialize();
{
v8::HandleScope handle_scope(isolate);
v8::Isolate::Scope isolate_scope(isolate);
@ -217,12 +218,13 @@ UNINITIALIZED_DEPENDENT_TEST(Deserialize, Serialize) {
isolate->Dispose();
}
UNINITIALIZED_DEPENDENT_TEST(DeserializeFromSecondSerialization,
SerializeTwice) {
UNINITIALIZED_TEST(DeserializeFromSecondSerialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = Deserialize();
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
Serialize(isolate);
isolate = Deserialize();
{
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
@ -235,11 +237,12 @@ UNINITIALIZED_DEPENDENT_TEST(DeserializeFromSecondSerialization,
isolate->Dispose();
}
UNINITIALIZED_DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
UNINITIALIZED_TEST(DeserializeAndRunScript2) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = Deserialize();
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
isolate = Deserialize();
{
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
@ -258,12 +261,13 @@ UNINITIALIZED_DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
isolate->Dispose();
}
UNINITIALIZED_DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
SerializeTwice) {
UNINITIALIZED_TEST(DeserializeFromSecondSerializationAndRunScript2) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
v8::Isolate* isolate = Deserialize();
v8::Isolate* isolate = TestIsolate::NewInitialized(true);
Serialize(isolate);
Serialize(isolate);
isolate = Deserialize();
{
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
@ -281,10 +285,7 @@ UNINITIALIZED_DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
isolate->Dispose();
}
UNINITIALIZED_TEST(PartialSerialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
static void PartiallySerialize() {
v8::Isolate* v8_isolate = TestIsolate::NewInitialized(true);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
v8_isolate->Enter();
@ -352,10 +353,16 @@ UNINITIALIZED_TEST(PartialSerialization) {
v8_isolate->Dispose();
}
UNINITIALIZED_DEPENDENT_TEST(PartialDeserialization, PartialSerialization) {
UNINITIALIZED_TEST(PartialSerialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
PartiallySerialize();
}
UNINITIALIZED_TEST(PartialDeserialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
PartiallySerialize();
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
@ -400,10 +407,7 @@ UNINITIALIZED_DEPENDENT_TEST(PartialDeserialization, PartialSerialization) {
v8_isolate->Dispose();
}
UNINITIALIZED_TEST(ContextSerialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
static void SerializeContext() {
v8::Isolate* v8_isolate = TestIsolate::NewInitialized(true);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
Heap* heap = isolate->heap();
@ -465,10 +469,16 @@ UNINITIALIZED_TEST(ContextSerialization) {
v8_isolate->Dispose();
}
UNINITIALIZED_DEPENDENT_TEST(ContextDeserialization, ContextSerialization) {
UNINITIALIZED_TEST(ContextSerialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
SerializeContext();
}
UNINITIALIZED_TEST(ContextDeserialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
SerializeContext();
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
@ -512,10 +522,7 @@ UNINITIALIZED_DEPENDENT_TEST(ContextDeserialization, ContextSerialization) {
v8_isolate->Dispose();
}
UNINITIALIZED_TEST(CustomContextSerialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
static void SerializeCustomContext() {
v8::Isolate* v8_isolate = TestIsolate::NewInitialized(true);
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
{
@ -596,12 +603,17 @@ UNINITIALIZED_TEST(CustomContextSerialization) {
v8_isolate->Dispose();
}
UNINITIALIZED_TEST(CustomContextSerialization) {
DisableTurbofan();
if (DefaultSnapshotAvailable()) return;
SerializeCustomContext();
}
UNINITIALIZED_DEPENDENT_TEST(CustomContextDeserialization,
CustomContextSerialization) {
UNINITIALIZED_TEST(CustomContextDeserialization) {
DisableTurbofan();
FLAG_crankshaft = false;
if (DefaultSnapshotAvailable()) return;
SerializeCustomContext();
int file_name_length = StrLength(FLAG_testing_serialization_file) + 10;
Vector<char> startup_name = Vector<char>::New(file_name_length + 1);
SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file);
@ -869,12 +881,6 @@ TEST(TestThatAlwaysFails) {
}
DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) {
bool ArtificialFailure2 = false;
CHECK(ArtificialFailure2);
}
int CountBuiltins() {
// Check that we have not deserialized any additional builtin.
HeapIterator iterator(CcTest::heap());

View File

@ -65,16 +65,7 @@ class CcTestSuite(testsuite.TestSuite):
return []
tests = []
for test_desc in output.stdout.strip().split():
if test_desc.find('<') < 0:
# Native Client output can contain a few non-test arguments
# before the tests. Skip these.
continue
raw_test, dependency = test_desc.split('<')
if dependency != '':
dependency = raw_test.split('/')[0] + '/' + dependency
else:
dependency = None
test = testcase.TestCase(self, raw_test, dependency=dependency)
test = testcase.TestCase(self, test_desc)
tests.append(test)
tests.sort()
return tests

View File

@ -49,9 +49,8 @@ TEST_DIR = os.path.join(BASE_DIR, "test")
class Instructions(object):
def __init__(self, command, dep_command, test_id, timeout, verbose):
def __init__(self, command, test_id, timeout, verbose):
self.command = command
self.dep_command = dep_command
self.id = test_id
self.timeout = timeout
self.verbose = verbose
@ -112,12 +111,7 @@ def _GetInstructions(test, context):
# the like.
if statusfile.IsSlow(test.outcomes or [statusfile.PASS]):
timeout *= 2
if test.dependency is not None:
dep_command = [ c.replace(test.path, test.dependency) for c in command ]
else:
dep_command = None
return Instructions(
command, dep_command, test.id, timeout, context.verbose)
return Instructions(command, test.id, timeout, context.verbose)
class Job(object):
@ -160,15 +154,6 @@ class TestJob(Job):
return SetupProblem(e, self.test)
start_time = time.time()
if instr.dep_command is not None:
dep_output = commands.Execute(
instr.dep_command, instr.verbose, instr.timeout)
# TODO(jkummerow): We approximate the test suite specific function
# IsFailureOutput() by just checking the exit code here. Currently
# only cctests define dependencies, for which this simplification is
# correct.
if dep_output.exit_code != 0:
return (instr.id, dep_output, time.time() - start_time)
output = commands.Execute(instr.command, instr.verbose, instr.timeout)
return (instr.id, output, time.time() - start_time)

View File

@ -328,7 +328,7 @@ class GoogleTestSuite(TestSuite):
if test_desc.endswith('.'):
test_case = test_desc
elif test_case and test_desc:
test = testcase.TestCase(self, test_case + test_desc, dependency=None)
test = testcase.TestCase(self, test_case + test_desc)
tests.append(test)
tests.sort()
return tests

View File

@ -30,12 +30,11 @@ from . import output
class TestCase(object):
def __init__(self, suite, path, variant='default', flags=None,
dependency=None, override_shell=None):
override_shell=None):
self.suite = suite # TestSuite object
self.path = path # string, e.g. 'div-mod', 'test-api/foo'
self.flags = flags or [] # list of strings, flags specific to this test
self.variant = variant # name of the used testing variant
self.dependency = dependency # |path| for testcase that must be run first
self.override_shell = override_shell
self.outcomes = set([])
self.output = None
@ -45,7 +44,7 @@ class TestCase(object):
def CopyAddingFlags(self, variant, flags):
copy = TestCase(self.suite, self.path, variant, self.flags + flags,
self.dependency, self.override_shell)
self.override_shell)
copy.outcomes = self.outcomes
return copy
@ -56,16 +55,16 @@ class TestCase(object):
"""
assert self.id is not None
return [self.suitename(), self.path, self.variant, self.flags,
self.dependency, self.override_shell, list(self.outcomes or []),
self.override_shell, list(self.outcomes or []),
self.id]
@staticmethod
def UnpackTask(task):
"""Creates a new TestCase object based on packed task data."""
# For the order of the fields, refer to PackTask() above.
test = TestCase(str(task[0]), task[1], task[2], task[3], task[4], task[5])
test.outcomes = set(task[6])
test.id = task[7]
test = TestCase(str(task[0]), task[1], task[2], task[3], task[4])
test.outcomes = set(task[5])
test.id = task[6]
test.run = 1
return test