Browse Source

Updated the Lua tests

msmith-techempower 10 years ago
parent
commit
80e7091d69

+ 0 - 28
frameworks/Lua/lapis/setup.py

@@ -1,28 +0,0 @@
-import subprocess
-import sys
-import setup_util
-import os
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("lapis/config.lua", "DBHOSTNAME", args.database_host)
-  setup_util.replace_text("lapis/nginx.conf", "DBHOSTNAME", args.database_host)
-  #subprocess.Popen('/usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -g "worker_processes ' + str((args.max_threads)) + ';"', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)
-  subprocess.Popen('lapis server production', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)
-
-  return 0
-
-def stop(logfile, errfile):
-  #subprocess.Popen('/usr/local/openresty/nginx/sbin/nginx -c `pwd`/nginx.conf -s stop', shell=True, cwd="lapis", stderr=errfile, stdout=logfile)
-
-  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-  out, err = p.communicate()
-  for line in out.splitlines():
-    if 'nginx: master' in line:
-      try:
-        pid = int(line.split(None, 2)[1])
-        os.kill(pid, 15)
-      except OSError:
-        pass
-
-
-  return 0

+ 6 - 0
frameworks/Lua/lapis/setup.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+sed -i 's|DBHOSTNAME|'"${DBHOST}"'|g' config.lua
+sed -i 's|DBHOSTNAME|'"${DBHOST}"'|g' nginx.conf
+
+lapis server production &

+ 0 - 16
frameworks/Lua/openresty/setup.py

@@ -1,16 +0,0 @@
-import subprocess
-import sys
-import setup_util
-import os
-
-def start(args, logfile, errfile):
-  setup_util.replace_text("openresty/nginx.conf", "CWD", args.troot)
-  setup_util.replace_text("openresty/app.lua", "DBHOSTNAME", args.database_host)
-  subprocess.Popen('sudo /usr/local/openresty/nginx/sbin/nginx -c $TROOT/nginx.conf -g "worker_processes ' + str((args.max_threads)) + ';"', shell=True, cwd="openresty", stderr=errfile, stdout=logfile)
-
-  return 0
-
-def stop(logfile, errfile):
-  subprocess.Popen('sudo /usr/local/openresty/nginx/sbin/nginx -c $TROOT/nginx.conf -s stop', shell=True, cwd="openresty", stderr=errfile, stdout=logfile)
-
-  return 0

+ 8 - 0
frameworks/Lua/openresty/setup.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+export PWD=$(pwd)
+
+sed -i 's|CWD|'"${PWD}"'|g' nginx.conf
+sed -i 's|DBHOSTNAME|'"${DBHOST}"'|g' app.lua
+
+sudo /usr/local/openresty/nginx/sbin/nginx -c $TROOT/nginx.conf -g "worker_processes '$MAX_THREADS';" &

+ 2 - 2
toolset/setup/linux/languages/lua.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists lua.installed)
+RETCODE=$(fw_exists ${IROOT}/lua5.1.installed)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
 # Eventually, we should also install lua5.2 and luajit
@@ -11,4 +11,4 @@ RETCODE=$(fw_exists lua.installed)
 # left them out
 sudo apt-get install -y lua5.1 luarocks
 
-touch lua.installed
+touch ${IROOT}/lua5.1.installed

+ 2 - 2
toolset/setup/linux/webservers/openresty.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists openresty.installed)
+RETCODE=$(fw_exists ${IROOT}/openresty-1.7.4.1.installed)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
 fw_depends nginx lua
@@ -13,4 +13,4 @@ cd ngx_openresty-1.7.4.1
 make -j4
 sudo make install
 
-touch $IROOT/openresty.installed
+touch ${IROOT}/openresty-1.7.4.1.installed