Browse Source

Merge pull request #1111 from lpereira/master

tests.append(lwan)
Hamilton Turner 10 years ago
parent
commit
c19016cf9e

+ 1 - 0
.travis.yml

@@ -24,6 +24,7 @@ env:
     #   find . -type d -depth 2 | sed 's|./|    - "TESTDIR=|' | sed 's/$/"/g'
     #
     #  
+    - "TESTDIR=C/lwan"
     - "TESTDIR=C/duda"
     - "TESTDIR=C/onion"
     - "TESTDIR=C#/aspnet"

+ 35 - 0
frameworks/C/lwan/README.md

@@ -0,0 +1,35 @@
+# Lwan
+
+This is the configuration files to benchmark the [Lwan](http://lwan.ws)
+web server/framework.
+
+## Requirements
+
+GCC, SQLite 3.7, Linux 3.0, optionally jemalloc or tcmalloc.
+
+## Tests available
+
+### 1. JSON serialization
+
+URL: /json
+
+### 2. Single database query
+
+URL: /db
+
+### 3. Multiple database queries
+
+URL: /queries?queries=N
+
+### 4. Fortunes
+
+URL: /fortunes
+
+### 6. Plaintext
+
+URL: /plaintext
+
+
+## Contact
+
+Leandro Pereira <[email protected]>

+ 0 - 0
frameworks/C/lwan/__init__.py


+ 4 - 0
frameworks/C/lwan/bash_profile.sh

@@ -0,0 +1,4 @@
+#!/bin/bash
+
+export LWAN_ROOT=${IROOT}/lwan
+export LWAN_BUILD=${LWAN_ROOT}/build

+ 27 - 0
frameworks/C/lwan/benchmark_config

@@ -0,0 +1,27 @@
+{
+  "framework": "lwan",
+  "tests": [{
+    "raw": {
+      "setup_file": "setup",
+      "db_url": "/db",
+      "query_url": "/queries?queries=",
+      "fortune_url": "/fortunes",
+      "plaintext_url": "/plaintext",
+      "json_url": "/json",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "SQLite",
+      "framework": "lwan",
+      "language": "C",
+      "orm": "Raw",
+      "platform": "Lwan",
+      "webserver": "Lwan",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "Lwan",
+      "notes": "",
+      "versus": ""
+    }
+  }]
+}

+ 19 - 0
frameworks/C/lwan/install.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+
+REV='aa6c15fbdf63d9db722ddc72bd736b23381331be'
+
+INSTALLED_FILE="${IROOT}/lwan-${REV}.installed"
+RETCODE=$(fw_exists ${INSTALLED_FILE})
+[ ! "$RETCODE" == 0 ] || { return 0; }
+
+# Lwan is only built during installation as a dependency sanity check.
+sudo apt-get update && \
+	sudo apt-get install libjemalloc-dev && \
+	git clone git://github.com/lpereira/lwan.git && \
+        cd lwan && \
+        git checkout ${REV} && \
+        mkdir build && \
+        cd build && \
+        cmake .. -DCMAKE_BUILD_TYPE=Release && \
+        make techempower && \
+        touch ${INSTALLED_FILE}

+ 23 - 0
frameworks/C/lwan/setup.py

@@ -0,0 +1,23 @@
+import subprocess
+import sys
+import os
+
+def start(args, logfile, errfile):
+  subprocess.call('rm -rf ${LWAN_BUILD}', shell=True, stderr=errfile, stdout=logfile)
+  subprocess.call('mkdir -p ${LWAN_BUILD}', shell=True, stderr=errfile, stdout=logfile)
+  subprocess.call('cmake ${LWAN_ROOT} -DCMAKE_BUILD_TYPE=Release && make techempower',
+      cwd=os.environ['LWAN_BUILD'], shell=True, stderr=errfile, stdout=logfile)
+
+  db_dir = os.path.join(os.environ['LWAN_ROOT'], 'techempower')
+  exe_path = os.path.join(os.environ['LWAN_BUILD'], 'techempower', 'techempower')
+  subprocess.Popen(exe_path, cwd=db_dir, stderr=errfile, stdout=logfile, shell=True)
+
+  return 0
+
+def stop(logfile, errfile):
+  p = subprocess.Popen(['pgrep', 'techempower'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+      pid = int(line)
+      os.kill(pid, 2)
+  return 0

+ 2 - 1
toolset/benchmark/framework_test.py

@@ -378,7 +378,8 @@ class FrameworkTest:
       parser = FortuneHTMLParser()
       parser.feed(htmlString)
 
-      return (parser.isValidFortune(out), )
+      valid = parser.isValidFortune(out)
+      return (valid, '' if valid else 'Did not pass validation')
     except:
       print "Got exception when trying to validate the fortune test: {exception} ".format(exception=traceback.format_exc())
     return (False, err_str)

+ 6 - 7
toolset/run-ci.py

@@ -33,6 +33,8 @@ class CIRunnner:
   
   Only verifies the first test in each directory 
   '''
+
+  SUPPORTED_DATABASES = "mysql postgres mongodb cassandra sqlite none".split()
   
   def __init__(self, mode, testdir=None):
     '''
@@ -192,13 +194,10 @@ class CIRunnner:
                   and (t.database_os.lower() == "linux" or t.database_os.lower() == "none")]
     
     # Our Travis-CI only has some databases supported
-    validtests = [t for t in osvalidtests if t.database.lower() == "mysql"
-                  or t.database.lower() == "postgres"
-                  or t.database.lower() == "mongodb"
-                  or t.database.lower() == "cassandra"
-                  or t.database.lower() == "none"]
-    log.info("Found %s usable tests (%s valid for linux, %s valid for linux and {mysql,postgres,mongodb,cassandra,none}) in directory '%s'", 
-      len(dirtests), len(osvalidtests), len(validtests), '$FWROOT/frameworks/' + testdir)
+    validtests = [t for t in osvalidtests if t.database.lower() in self.SUPPORTED_DATABASES]
+    supported_databases = ','.join(self.SUPPORTED_DATABASES)
+    log.info("Found %s usable tests (%s valid for linux, %s valid for linux and {%s}) in directory '%s'",
+      len(dirtests), len(osvalidtests), len(validtests), supported_databases, '$FWROOT/frameworks/' + testdir)
     if len(validtests) == 0:
       log.critical("Found no test that is possible to run in Travis-CI! Aborting!")
       if len(osvalidtests) != 0: