Browse Source

Merge pull request #1579 from hamiltont/fix-setup-bugs-merge-play2

Toolset: Fix setup script calling
Hamilton Turner 10 years ago
parent
commit
f1b0f583ed

+ 2 - 1
frameworks/Scala/play2-scala/benchmark_config.json

@@ -18,7 +18,8 @@
         "notes": "", 
         "versus": "netty", 
         "port": "9000", 
-        "json_url": "/json"
+        "json_url": "/json",
+        "plaintext_url": "/plaintext"
       }, 
       "activate": {
         "display_name": "play2-scala-activate", 

+ 10 - 0
frameworks/Scala/play2-scala/play2-scala/app/controllers/Application.scala

@@ -9,4 +9,14 @@ object Application extends Controller {
     Ok(Json.obj("message" -> "Hello, World!"))
   }
 
+  def plaintext() = Action {
+    import java.util.Date
+    import java.text.SimpleDateFormat
+
+    val sdf = new SimpleDateFormat("EEE, MMM d yyyy HH:MM:ss z")
+    Ok("Hello, World!")
+      .withHeaders(
+        DATE -> sdf.format(new Date()),
+        SERVER -> "Play Framework 2.3.3")
+  }
 }

+ 1 - 0
frameworks/Scala/play2-scala/play2-scala/conf/routes

@@ -4,6 +4,7 @@
 
 # Home page
 GET     /json                           controllers.Application.json
+GET     /plaintext                      controllers.Application.plaintext
 
 # Map static resources from the /public folder to the /assets URL path
 GET     /assets/*file                   controllers.Assets.at(path="/public", file)

+ 3 - 2
toolset/benchmark/benchmarker.py

@@ -715,13 +715,14 @@ class Benchmarker:
   # shutdown properly.
   ############################################################
   def __is_port_bound(self, port):
+    port = int(port)
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     try:
       # Try to bind to all IP addresses, this port
       s.bind(("", port))
       # If we get here, we were able to bind successfully,
       # which means the port is free.
-    except Exception:
+    except socket.error:
       # If we get an exception, it might be because the port is still bound
       # which would be bad, or maybe it is a privileged port (<1024) and we
       # are not running as root, or maybe the server is gone, but sockets are
@@ -732,7 +733,7 @@ class Benchmarker:
         # If we get here, we were able to connect to something, which means
         # that the port is still bound.
         return True
-      except Exception:
+      except socket.error:
         # An exception means that we couldn't connect, so a server probably
         # isn't still running on the port.
         pass

+ 10 - 6
toolset/benchmark/framework_test.py

@@ -256,7 +256,7 @@ class FrameworkTest:
       "%s: %s.sh and framework processes have terminated" % (self.name, self.setup_file))
 
     # Set a limit on total execution time of setup.sh
-    timeout = datetime.now() + timedelta(minutes = 20)
+    timeout = datetime.now() + timedelta(minutes = 105)
     time_remaining = timeout - datetime.now()
 
     # Need to print to stdout once every 10 minutes or Travis-CI will abort
@@ -274,9 +274,9 @@ class FrameworkTest:
     # output to the pipes. 
     #
     prefix = "Setup %s: " % self.name
-    while not (p.poll() 
-      or self.benchmarker.is_port_bound(self.port)
-      or time_remaining.total_seconds() < 0):
+    while (p.poll() is None
+      and not self.benchmarker.is_port_bound(self.port)
+      and not time_remaining.total_seconds() < 0):
       
       # The conditions above are slow to check, so 
       # we will delay output substantially if we only
@@ -301,6 +301,8 @@ class FrameworkTest:
 
       if (travis_timeout - datetime.now()).total_seconds() < 0:
         sys.stdout.write(prefix + 'Printing so Travis-CI does not time out\n')
+        sys.stdout.write(prefix + "Status: Poll: %s, Port %s bound: %s, Time Left: %s\n" % (
+          p.poll(), self.port, self.benchmarker.is_port_bound(self.port), time_remaining))
         sys.stdout.flush()
         travis_timeout = datetime.now() + timedelta(minutes = 5)
 
@@ -313,8 +315,10 @@ class FrameworkTest:
     # What's our return code? 
     # If setup.sh has terminated, use that code
     # Otherwise, detect if the port was bound
-    retcode = (p.poll() or 0 if self.benchmarker.is_port_bound(self.port) else 1)
-    if p.poll():
+    tee_output(prefix, "Status: Poll: %s, Port %s bound: %s, Time Left: %s\n" % (
+      p.poll(), self.port, self.benchmarker.is_port_bound(self.port), time_remaining))
+    retcode = (p.poll() if p.poll() is not None else 0 if self.benchmarker.is_port_bound(self.port) else 1)
+    if p.poll() is not None:
       tee_output(prefix, "%s.sh process exited naturally with %s\n" % (self.setup_file, p.poll()))
     elif self.benchmarker.is_port_bound(self.port):
       tee_output(prefix, "Bound port detected on %s\n" % self.port)

+ 0 - 9
toolset/setup/linux/frameworks/vertx.sh

@@ -1,9 +0,0 @@
-#!/bin/bash
-
-RETCODE=$(fw_exists ${IROOT}/vert.x-2.1.5.installed)
-[ ! "$RETCODE" == 0 ] || { return 0; }
-
-fw_get http://dl.bintray.com/vertx/downloads/vert.x-2.1.5.tar.gz?direct=true -O vert.x-2.1.5.tar.gz
-fw_untar vert.x-2.1.5.tar.gz
-
-touch ${IROOT}/vert.x-2.1.5.installed