Browse Source

Some modifications to the setup files for onion.

Patrick Falls 12 years ago
parent
commit
478006e17d
4 changed files with 14 additions and 7 deletions
  1. 1 1
      installer.py
  2. 7 2
      onion/benchmark_config
  3. 2 2
      onion/hello.c
  4. 4 2
      onion/setup.py

+ 1 - 1
installer.py

@@ -22,7 +22,7 @@ class Installer:
     #######################################
     self.__run_command("sudo apt-get update", True)
     self.__run_command("sudo apt-get upgrade", True)    
-    self.__run_command("sudo apt-get install build-essential libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev python-software-properties unzip git-core libcurl4-openssl-dev libbz2-dev libmysqlclient-dev mongodb-clients libreadline6-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev libgdbm-dev ncurses-dev automake libffi-dev htop libtool bison libevent-dev libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 liborc-0.4-0 libwxbase2.8-0 libwxgtk2.8-0", True)
+    self.__run_command("sudo apt-get install build-essential libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev python-software-properties unzip git-core libcurl4-openssl-dev libbz2-dev libmysqlclient-dev mongodb-clients libreadline6-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev libgdbm-dev ncurses-dev automake libffi-dev htop libtool bison libevent-dev libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 liborc-0.4-0 libwxbase2.8-0 libwxgtk2.8-0 libgnutls-dev libjson0-dev", True)
 
     self.__run_command("cp ../config/benchmark_profile ../../.bash_profile")
 

+ 7 - 2
onion/benchmark_config

@@ -1,13 +1,18 @@
 {
-  "framework": "onion-raw",
+  "framework": "onion",
   "tests": [{
     "default": {
       "setup_file": "setup",
       "json_url": "/",
+      "port": 8080,
+      "sort": 42
+    },
+    "raw": {
+      "setup_file": "setup",
       "db_url": "/db",
       "query_url": "/db?queries=",
       "port": 8080,
-      "sort": 37
+      "sort": 43
     }
   }]
 }

+ 2 - 2
onion/hello.c

@@ -203,8 +203,8 @@ int main(void){
 			ONION_ERROR("Cant create db connection: %s", mysql_error(data.db[i]));
 			return 1;
 		}
-		if (mysql_real_connect(data.db[i], "localhost", "benchmarkdbuser", 
-		                       "benchmarkdbpass", "hello_world", 0, NULL, 0) == NULL) {
+		if (mysql_real_connect(data.db[i], "localhost", 
+                        "benchmarkdbuser", "benchmarkdbpass", "hello_world", 0, NULL, 0) == NULL) {
 			ONION_ERROR("Error %u: %s\n", mysql_errno(data.db[i]), mysql_error(data.db[i]));
 			return 1;
 		}

+ 4 - 2
onion/setup.py

@@ -1,10 +1,12 @@
 import subprocess
 import sys
 import os
+import setup_util 
 
 def start(args):
-	os.putenv("ONION_LOG","noinfo")
-  os.system("make && ./hello &")
+  setup_util.replace_text("onion/hello.c", "mysql_real_connect\(data.db\[i\], \".*\",", "mysql_real_connect(data.db[i], \"" + args.database_host + "\",")
+  os.putenv("ONION_LOG","noinfo")
+  subprocess.Popen("make && ./hello", shell=True, cwd="onion")
   return 0
 
 def stop():