Преглед на файлове

fixed fortune test to work alongside db changes. Note that the fortuen test does not use the new db changes

Patrick Falls преди 12 години
родител
ревизия
7ae79af08e
променени са 4 файла, в които са добавени 12 реда и са изтрити 7 реда
  1. 1 1
      benchmarker.py
  2. 2 2
      go/README.md
  3. 7 2
      go/src/hello/hello.go
  4. 2 2
      webgo/README.md

+ 1 - 1
benchmarker.py

@@ -306,7 +306,7 @@ class Benchmarker:
         continue
       
       # If the test does not contain an implementation of the current test-type, skip it
-      if not test.contains_type(self.type):
+      if self.type != 'all' and not test.contains_type(self.type):
         continue
       
       print textwrap.dedent("""

+ 2 - 2
go/README.md

@@ -7,10 +7,10 @@ This is the go portion of a [benchmarking test suite](../) comparing a variety o
 
 ## Versions
 
-* [Go 1.0.3](http://golang.org/)
+* [Go 1.1beta2](http://golang.org/)
 
 ## Test URLs
 
 ### JSON Encoding Test
 
-http://localhost:8080/json
+http://localhost:8080/json

+ 7 - 2
go/src/hello/hello.go

@@ -37,6 +37,7 @@ const (
 
 var (
 	stmts = make(chan *sql.Stmt, MAX_CON)
+	fortuneDB *sql.DB
 )
 
 func jsonHandler(w http.ResponseWriter, r *http.Request) {
@@ -71,7 +72,7 @@ func fortuneHandler(w http.ResponseWriter, r *http.Request) {
 	fortunes := make([]Fortune, 13)
   
 	// Execute the query
-	rows, err := db.Query(DB_FORTUNE_SELECT_SQL)
+	rows, err := fortuneDB.Query(DB_FORTUNE_SELECT_SQL)
 	if err != nil {
 		log.Fatalf("Error preparing statement: %s", err)
 	}
@@ -102,9 +103,13 @@ type ByMessage struct{ Fortunes }
 func (s ByMessage) Less(i, j int) bool { return s.Fortunes[i].Message < s.Fortunes[j].Message }
 
 func main() {
+	var err error
+	if fortuneDB, err = sql.Open("mysql", DB_CONN_STR); err != nil {
+	    log.Fatalf("Error opening database: %s", err)
+	} 
 	http.HandleFunc("/db", dbHandler)
 	http.HandleFunc("/json", jsonHandler)
-  http.HandleFunc("/fortune", fortuneHandler)
+	http.HandleFunc("/fortune", fortuneHandler)
 	http.ListenAndServe(":8080", nil)
 }
 

+ 2 - 2
webgo/README.md

@@ -7,11 +7,11 @@ This is the webgo portion of a [benchmarking test suite](../) comparing a variet
 
 ## Versions
 
-* [Go 1.0.3](http://golang.org/)
+* [Go 1.1beta2](http://golang.org/)
 * [WebGo](https://github.com/hoisie/web)
 
 ## Test URLs
 
 ### JSON Encoding Test
 
-    http://localhost:8080/json
+    http://localhost:8080/json