Browse Source

Updated JS and Lua tests

As a bonus, removed the apt-get stuff from Lua and reqs
msmith-techempower 10 years ago
parent
commit
e46d280c6f

+ 0 - 3
frameworks/JavaScript/express/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends nodejs

+ 3 - 5
frameworks/JavaScript/express/setup.sh

@@ -1,14 +1,12 @@
 #!/bin/bash
-export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
 
 sed -i 's|mongodb://.*/hello_world|mongodb://'"${DBHOST}"'/hello_world|g' app.js
 sed -i 's|localhost|'"${DBHOST}"'|g' app.js
 
-export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
-export PATH=$PATH:$NODE_HOME/bin
+fw_depends nodejs
 
-${NODE_HOME}/bin/npm install
-${NODE_HOME}/bin/node app &
+npm install
+node app &
 
 # !DO NOT REMOVE!
 #

+ 0 - 3
frameworks/JavaScript/hapi/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends nodejs

+ 4 - 7
frameworks/JavaScript/hapi/setup.sh

@@ -1,14 +1,11 @@
 #!/bin/bash
-export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
 
 sed -i 's|localhost|'"${DBHOST}"'|g' app.js
 
-export NODE_ENV=production
-export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
-export PATH=$PATH:$NODE_HOME/bin
+fw_depends nodejs
 
-${NODE_HOME}/bin/npm install
-${NODE_HOME}/bin/node app &
+npm install
+node app &
 
 # !DO NOT REMOVE!
 #
@@ -17,4 +14,4 @@ ${NODE_HOME}/bin/node app &
 # executing this script will be terminated before the 
 # application has time to awaken and be forked, and 
 # express will fail to be started
-sleep 5
+sleep 5

+ 0 - 5
frameworks/JavaScript/nodejs/install.sh

@@ -1,5 +0,0 @@
-#!/bin/bash
-
-export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
-
-fw_depends nodejs

+ 4 - 7
frameworks/JavaScript/nodejs/setup.sh

@@ -1,15 +1,12 @@
 #!/bin/bash
-export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
 
 sed -i 's|localhost|'"${DBHOST}"'|g' hello.js
 sed -i 's|mongodb//.*/hello_world|mongodb//'"${DBHOST}"'/hello_world|g' hello.js
 
-export NODE_ENV=production
-export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
-export PATH=$PATH:$NODE_HOME/bin
+fw_depends nodejs
 
-${NODE_HOME}/bin/npm install
-${NODE_HOME}/bin/node hello.js &
+npm install
+node hello.js &
 
 # !DO NOT REMOVE!
 #
@@ -18,4 +15,4 @@ ${NODE_HOME}/bin/node hello.js &
 # executing this script will be terminated before the 
 # application has time to awaken and be forked, and 
 # express will fail to be started
-sleep 5
+sleep 5

+ 0 - 3
frameworks/JavaScript/ringojs-convenient/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends java ringojs

+ 9 - 9
frameworks/JavaScript/ringojs-convenient/setup.sh

@@ -2,12 +2,12 @@
 
 sed -i 's|dbHost = \x27.*\x27;|dbHost = \x27'"${DBHOST}"'\x27|g' app/models.js
 
-sudo rm -rf /usr/share/ringojs/packages/*
-sudo ringo-admin install oberhamsi/sql-ringojs-client
-sudo ringo-admin install grob/ringo-sqlstore
-sudo ringo-admin install ringo/stick
-sudo ringo-admin install oberhamsi/reinhardt
-
-sudo mkdir -p /usr/share/ringojs/packages/ringo-sqlstore/jars/
-sudo cp /usr/share/ringojs//packages/sql-ringojs-client/jars/mysql.jar /usr/share/ringojs/packages/ringo-sqlstore/jars/
-ringo --production -J-server -J-Xmx1g -J-Xms1g ringo-main.js &
+fw_depends java ringojs
+
+rm -rf $RINGOJS_HOME/packages/*
+ringo-admin install oberhamsi/sql-ringojs-client
+ringo-admin install grob/ringo-sqlstore
+ringo-admin install ringo/stick
+ringo-admin install oberhamsi/reinhardt
+
+ringo --production -J-server -J-Xmx1g -J-Xms1g ringo-main.js &

+ 0 - 3
frameworks/JavaScript/ringojs/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends java ringojs

+ 5 - 3
frameworks/JavaScript/ringojs/setup.sh

@@ -2,6 +2,8 @@
 
 sed -i 's|dbHost = \x27.*\x27;|dbHost = \x27'"${DBHOST}"'\x27|g' ringo-main.js
 
-sudo rm -rf /usr/share/ringojs/packages/*
-sudo ringo-admin install oberhamsi/sql-ringojs-client
-ringo --production -J-server -J-Xmx1g -J-Xms1g ringo-main.js &
+fw_depends java ringojs
+
+rm -rf $RINGOJS_HOME/packages/*
+ringo-admin install oberhamsi/sql-ringojs-client
+ringo --production -J-server -J-Xmx1g -J-Xms1g ringo-main.js &

+ 0 - 5
frameworks/Lua/lapis/install.sh

@@ -1,5 +0,0 @@
-#!/bin/bash
-
-fw_depends lua nginx openresty
-
-sudo luarocks install --server=http://rocks.moonscript.org lapis

+ 4 - 3
frameworks/Lua/lapis/setup.sh

@@ -4,7 +4,8 @@ sed -i 's|DBHOSTNAME|'"${DBHOST}"'|g' config.lua
 sed -i 's|DBHOSTNAME|'"${DBHOST}"'|g' config.moon
 sed -i 's|DBHOSTNAME|'"${DBHOST}"'|g' nginx.conf
 
-export LAPIS_OPENRESTY=${IROOT}/openresty-1.7.7.1
-export PATH=${LAPIS_OPENRESTY}/nginx/sbin:$PATH
+fw_depends lua luarocks nginx openresty lapis
 
-lapis server production &
+luarocks install lapis
+
+lapis server production &

+ 0 - 3
frameworks/Lua/openresty/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends lua nginx openresty 

+ 3 - 2
frameworks/Lua/openresty/setup.sh

@@ -1,7 +1,8 @@
 #!/bin/bash
-export OPENRESTY_HOME=${IROOT}/openresty-1.7.7.1
 
 sed -i 's|CWD|'"${TROOT}"'|g' nginx.conf
 sed -i 's|DBHOSTNAME|'"${DBHOST}"'|g' app.lua
 
-${OPENRESTY_HOME}/nginx/sbin/nginx -c $TROOT/nginx.conf -g "worker_processes '"${MAX_THREADS}"';" &
+fw_depends lua nginx openresty 
+
+nginx -c $TROOT/nginx.conf -g "worker_processes '"${MAX_THREADS}"';" &

+ 1 - 1
toolset/benchmark/test_types/framework_test_type.py

@@ -83,7 +83,7 @@ class FrameworkTestType:
     # Get response body
     p = subprocess.Popen(["curl", "-m", "15", "-s", url], stdout=PIPE, stderr=PIPE)
     (out, err) = p.communicate()
-    print "  Response (trimmed to 40 bytes): \"%s\"" % out.strip()[:40]
+    print "  Response (trimmed to 40 bytes): \"%s\"" % out.strip().replace('\n','')[:40]
     return out
   
   def verify(self, base_url):

+ 15 - 12
toolset/setup/linux/languages/lua.sh

@@ -1,14 +1,17 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists ${IROOT}/lua5.1.installed)
-[ ! "$RETCODE" == 0 ] || { return 0; }
-
-# Eventually, we should also install lua5.2 and luajit
-#
-# At the moment they seem to cause issues with lapis 
-# being able to compile. Since no Lua test is using 
-# either luajit or lua5.2 at the moment I have just
-# left them out
-sudo apt-get install -y lua5.1 luarocks
-
-touch ${IROOT}/lua5.1.installed
+VERSION="5.1.5"
+LUA=$IROOT/lua$VERSION
+RETCODE=$(fw_exists ${LUA}.installed)
+[ ! "$RETCODE" == 0 ] || { \
+  source $LUA.installed
+  return 0; }
+
+fw_get https://github.com/LuaDist/lua/archive/5.1.5-Ubuntu-x86_64.tar.gz
+fw_untar 5.1.5-Ubuntu-x86_64
+
+LUA_HOME=$IROOT/lua-5.1.5-Ubuntu-x86_64
+echo "export LUA_HOME=${LUA_HOME}" > $LUA.installed
+echo -e "export PATH=${LUA_HOME}/bin:\$PATH" >> $LUA.installed
+
+source $LUA.installed

+ 14 - 8
toolset/setup/linux/languages/nodejs.sh

@@ -1,15 +1,21 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists ${IROOT}/node-v0.10.8.installed)
-[ ! "$RETCODE" == 0 ] || { return 0; }
+VERSION="0.10.8"
+NODE=$IROOT/node-v$VERSION
+NODE_HOME=$NODE-linux-x64
+RETCODE=$(fw_exists ${NODE}.installed)
+[ ! "$RETCODE" == 0 ] || { \
+  source $NODE.installed
+  return 0; }
 
-fw_get http://nodejs.org/dist/v0.10.8/node-v0.10.8-linux-x64.tar.gz
-fw_untar node-v0.10.8-linux-x64.tar.gz
+fw_get http://nodejs.org/dist/v$VERSION/node-v$VERSION-linux-x64.tar.gz
+fw_untar node-v$VERSION-linux-x64.tar.gz
 
 # Upgrade npm to avoid https://github.com/npm/npm/issues/4984
-export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
-export PATH=$PATH:$NODE_HOME/bin
-
 ${NODE_HOME}/bin/npm install -g npm
 
-touch ${IROOT}/node-v0.10.8.installed
+echo "export NODE_HOME=${NODE_HOME}" > $NODE.installed
+echo "export NODE_ENV=production" >> $NODE.installed
+echo -e "export PATH=${NODE_HOME}/bin:\$PATH" >> $NODE.installed
+
+source $NODE.installed

+ 12 - 7
toolset/setup/linux/languages/ringojs.sh

@@ -1,12 +1,17 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists ${IROOT}/ringojs_0.10.installed)
-[ ! "$RETCODE" == 0 ] || { return 0; }
+VERSION="0.10"
+RINGOJS=$IROOT/ringojs_$VERSION
+RINGOJS_HOME=$IROOT/ringojs-$VERSION
+RETCODE=$(fw_exists ${RINGOJS}.installed)
+[ ! "$RETCODE" == 0 ] || { \
+  source $RINGOJS.installed
+  return 0; }
 
-fw_get http://www.ringojs.org/downloads/ringojs_0.10-1_all.deb
-sudo apt-get install -y jsvc
-sudo dpkg -i ringojs_0.10-1_all.deb
+fw_get http://ringojs.org/downloads/ringojs-0.10.tar.gz
+fw_untar ringojs-0.10.tar.gz
 
-rm -f ringojs_0.10-1_all.deb
+echo "export RINGOJS_HOME=${RINGOJS_HOME}" > $RINGOJS.installed
+echo -e "export PATH=${RINGOJS_HOME}/bin:\$PATH" >> $RINGOJS.installed
 
-touch $IROOT/ringojs_0.10.installed
+source $RINGOJS.installed

+ 22 - 0
toolset/setup/linux/systools/luarocks.sh

@@ -0,0 +1,22 @@
+#!/bin/bash
+
+VERSION="2.2.1"
+LUAROCKS=$IROOT/luarocks-$VERSION
+RETCODE=$(fw_exists ${LUAROCKS}.installed)
+[ ! "$RETCODE" == 0 ] || { \
+  source $LUAROCKS.installed
+  return 0; }
+
+fw_depends lua
+
+fw_get http://luarocks.org/releases/luarocks-2.2.1.tar.gz
+fw_untar luarocks-2.2.1.tar.gz
+
+cd $LUAROCKS
+./configure --prefix=$LUAROCKS --with-lua=$LUA_HOME
+make bootstrap
+
+echo "export LUAROCKS_HOME=${LUAROCKS}" > $LUAROCKS.installed
+echo -e "export PATH=${LUAROCKS}/bin:\$PATH" >> $LUAROCKS.installed
+
+source $LUAROCKS.installed

+ 0 - 7
toolset/setup/linux/webservers/lapis.sh

@@ -1,7 +0,0 @@
-#!/bin/bash
-
-RETCODE=$(fw_exists /usr/local/bin/lapis)
-[ ! "$RETCODE" == 0 ] || { return 0; }
-
-sudo apt-get install -y luarocks
-sudo luarocks install http://github.com/leafo/lapis/raw/9e8b92bf40983a830312c1745c73db74db77192d/lapis-dev-1.rockspec

+ 10 - 3
toolset/setup/linux/webservers/openresty.sh

@@ -1,7 +1,11 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists ${IROOT}/openresty-1.7.7.1.installed)
-[ ! "$RETCODE" == 0 ] || { return 0; }
+VERSION="1.7.7.1"
+OPENRESTY=$IROOT/openresty-$VERSION
+RETCODE=$(fw_exists ${OPENRESTY}.installed)
+[ ! "$RETCODE" == 0 ] || { \
+  source $OPENRESTY.installed
+  return 0; }
 
 fw_depends nginx lua
 
@@ -13,4 +17,7 @@ cd ngx_openresty-1.7.7.1
 make -j4
 make install
 
-touch ${IROOT}/openresty-1.7.7.1.installed
+echo "export OPENRESTY_HOME=${OPENRESTY}" > $OPENRESTY.installed
+echo -e "export PATH=${OPENRESTY}/nginx/sbin:\$PATH" >> $OPENRESTY.installed
+
+source $OPENRESTY.installed