Skip to content

Commit

Permalink
Merge pull request #1141 from lpereira/lwan-mysql
Browse files Browse the repository at this point in the history
Add MySQL tests for Lwan
@hamiltont Dear Travis-CI, I love you.
  • Loading branch information
msmith-techempower committed Oct 28, 2014
2 parents b05bdf6 + a51c049 commit 2f83079
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
24 changes: 23 additions & 1 deletion frameworks/C/lwan/benchmark_config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"framework": "lwan",
"tests": [{
"raw": {
"sqlite": {
"setup_file": "setup",
"db_url": "/db",
"query_url": "/queries?queries=",
Expand All @@ -22,6 +22,28 @@
"display_name": "Lwan",
"notes": "",
"versus": ""
},
"mysql": {
"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": "MySQL",
"framework": "lwan",
"language": "C",
"orm": "Raw",
"platform": "Lwan",
"webserver": "Lwan",
"os": "Linux",
"database_os": "Linux",
"display_name": "Lwan",
"notes": "",
"versus": ""
}
}]
}
6 changes: 4 additions & 2 deletions frameworks/C/lwan/install.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/bash

REV='aa6c15fbdf63d9db722ddc72bd736b23381331be'
REV='eb96604657dd940ecb70b56fef4279077e3f9c21'

INSTALLED_FILE="${IROOT}/lwan-${REV}.installed"
RETCODE=$(fw_exists ${INSTALLED_FILE})
[ ! "$RETCODE" == 0 ] || { return 0; }

[ ! -e ${INSTALLED_FILE} -a -d ${IROOT}/lwan ] && rm -rf ${IROOT}/lwan

# Lwan is only built during installation as a dependency sanity check.
sudo apt-get update && \
sudo apt-get install libjemalloc-dev && \
sudo apt-get install libjemalloc-dev libmysqlclient-dev libsqlite3-dev && \
git clone git://github.com/lpereira/lwan.git && \
cd lwan && \
git checkout ${REV} && \
Expand Down
15 changes: 14 additions & 1 deletion frameworks/C/lwan/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
import sys
import os

def get_env_for_database(args):
if args.database == 'MySQL':
return {
'USE_MYSQL': '1',
'MYSQL_USER': 'benchmarkdbuser',
'MYSQL_PASS': 'benchmarkdbpass',
'MYSQL_HOST': args.database_host,
'MYSQL_DB': 'hello_world'
}
return None

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)
Expand All @@ -10,7 +21,9 @@ def start(args, logfile, errfile):

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)

subprocess.Popen(exe_path, cwd=db_dir, stderr=errfile, stdout=logfile, shell=True,
env = get_env_for_database(args))

return 0

Expand Down

0 comments on commit 2f83079

Please sign in to comment.