Reviewers: Michael Starzinger,
Message:
This is the approach you suggested. Please take a look.
Description:
Fix cctests using Sockets to be able to run in parallel
BUG=v8:945
Please review this at https://chromiumcodereview.appspot.com/11015008/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M test/cctest/cctest.h
M test/cctest/cctest.status
M test/cctest/test-debug.cc
M test/cctest/test-sockets.cc
Index: test/cctest/cctest.h
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index
4e8b7324d46639420b193eec8cae48db282b579f..f3961a4adc5a4752234b58891e2f25eaa15c89c6
100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -213,6 +213,7 @@ static inline v8::Local<v8::Value> CompileRun(const
char* source) {
return v8::Script::Compile(v8::String::New(source))->Run();
}
+
// Helper function that compiles and runs the source with given origin.
static inline v8::Local<v8::Value> CompileRunWithOrigin(const char* source,
const char*
origin_url,
@@ -225,4 +226,11 @@ static inline v8::Local<v8::Value>
CompileRunWithOrigin(const char* source,
}
+// Pick a slightly different port to allow tests to be run in parallel.
+static inline int FlagDependentPortOffset() {
+ return ::v8::internal::FLAG_crankshaft == false ? 100 :
+ ::v8::internal::FLAG_always_opt ? 200 : 0;
+}
+
+
#endif // ifndef CCTEST_H_
Index: test/cctest/cctest.status
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
index
df2c520567756786e19f3e7b0342c24c8b146414..c55fc2a8db65836e796a72151141883782cc1009
100644
--- a/test/cctest/cctest.status
+++ b/test/cctest/cctest.status
@@ -68,11 +68,6 @@ test-api/OutOfMemoryNested: SKIP
# BUG(355): Test crashes on ARM.
test-log/ProfLazyMode: SKIP
-# BUG(945): Tests using Socket cannot be run in parallel.
-test-debug/DebuggerAgent: SKIP
-test-debug/DebuggerAgentProtocolOverflowHeader: SKIP
-test-sockets/Socket: SKIP
-
# BUG(1075): Unresolved crashes.
test-serialize/Deserialize: SKIP
test-serialize/DeserializeFromSecondSerializationAndRunScript2: SKIP
@@ -89,8 +84,3 @@ test-log/ProfLazyMode: SKIP
# platform-tls.h does not contain an ANDROID-related header.
test-platform-tls/FastTLS: SKIP
-
-# BUG(945): Tests using Socket cannot be run in parallel.
-test-debug/DebuggerAgent: SKIP
-test-debug/DebuggerAgentProtocolOverflowHeader: SKIP
-test-sockets/Socket: SKIP
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index
234b6df72217ef11d510e17c348dca9375920bc4..60d5f0e450b62d232c65a0bc6cab0fc389bc2db7
100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -5833,9 +5833,9 @@ TEST(DebuggerAgent) {
i::Debugger* debugger = i::Isolate::Current()->debugger();
// Make sure these ports is not used by other tests to allow tests to
run in
// parallel.
- const int kPort1 = 5858;
- const int kPort2 = 5857;
- const int kPort3 = 5856;
+ const int kPort1 = 5858 + FlagDependentPortOffset();
+ const int kPort2 = 5857 + FlagDependentPortOffset();
+ const int kPort3 = 5856 + FlagDependentPortOffset();
// Make a string with the port2 number.
const int kPortBufferLen = 6;
@@ -5934,7 +5934,7 @@ void DebuggerAgentProtocolServerThread::Run() {
TEST(DebuggerAgentProtocolOverflowHeader) {
// Make sure this port is not used by other tests to allow tests to run
in
// parallel.
- const int kPort = 5860;
+ const int kPort = 5860 + FlagDependentPortOffset();
static const char* kLocalhost = "localhost";
// Make a string with the port number.
Index: test/cctest/test-sockets.cc
diff --git a/test/cctest/test-sockets.cc b/test/cctest/test-sockets.cc
index
ad7354002ff2bd43863291030e1a3b90e0d37899..2f7941c6ede179c817a3276089d9151c4fdf8625
100644
--- a/test/cctest/test-sockets.cc
+++ b/test/cctest/test-sockets.cc
@@ -124,7 +124,7 @@ static void SendAndReceive(int port, char *data, int
len) {
TEST(Socket) {
// Make sure this port is not used by other tests to allow tests to run
in
// parallel.
- static const int kPort = 5859;
+ static const int kPort = 5859 + FlagDependentPortOffset();
bool ok;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev