CI updates

This commit is contained in:
John 2018-12-17 18:35:29 +08:00
parent 48dc4ce3e2
commit a85daa5617
5 changed files with 4 additions and 36 deletions

View File

@ -33,6 +33,9 @@ func init() {
db = r
}
// 准备测试数据结构
if _, err := db.Exec("CREATE DATABASE IF NOT EXISTS `test` CHARACTER SET UTF8"); err != nil {
gtest.Fatal(err)
}
if _, err := db.Exec("DROP TABLE `user`"); err != nil {
gtest.Fatal(err)
}

View File

@ -63,8 +63,8 @@ func newMemCache(lruCap...int) *memCache {
closed : gtype.NewBool(),
}
if len(lruCap) > 0 {
c.lru = newMemCacheLru(c)
c.cap = lruCap[0]
c.lru = newMemCacheLru(c)
}
return c
}

View File

@ -1,35 +0,0 @@
// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://gitee.com/johng/gf.
package grpool_test
import (
"testing"
"runtime"
"fmt"
)
func increment() {
for i := 0; i < 100000; i++ {}
}
//func Test_GrpoolMemUsage(t *testing.T) {
// for i := 0; i < n; i++ {
// grpool.Add(increment)
// }
// mem := runtime.MemStats{}
// runtime.ReadMemStats(&mem)
// fmt.Println("mem usage:", mem.TotalAlloc/1024)
//}
func Test_GroroutineMemUsage(t *testing.T) {
for i := 0; i < n; i++ {
go increment()
}
mem := runtime.MemStats{}
runtime.ReadMemStats(&mem)
fmt.Println("mem usage:", mem.TotalAlloc/1024)
}