diff --git a/go/pserver/cclient/CMakeLists.txt b/go/pserver/cclient/CMakeLists.txt index fff7ae78582732c1b7af7a757c340804e91316d6..65a38ba1add80a5425c6f135ff82b65dec811f03 100644 --- a/go/pserver/cclient/CMakeLists.txt +++ b/go/pserver/cclient/CMakeLists.txt @@ -10,5 +10,6 @@ include(golang) include(flags) go_library(paddle_pserver_cclient STATIC) - -add_subdirectory(test) +if(WITH_TESTING) + add_subdirectory(test) +endif() diff --git a/go/pserver/optimizer.go b/go/pserver/optimizer.go index 5abbca538f243095a72bb4a7335c311f0512d2b7..3ee4c7465284836194c83388d3aa48f111afa2a6 100644 --- a/go/pserver/optimizer.go +++ b/go/pserver/optimizer.go @@ -1,6 +1,7 @@ package pserver /* +#cgo CFLAGS: -I ../../ #include "paddle/optimizer/optimizer.h" */ import "C" diff --git a/go/pserver/optimizer_test.go b/go/pserver/optimizer_test.go index 64d6d092aa1864fbca012214ced5e03e157d4a4c..4930f0d95f9852c17ce867c71980a6df0888daa3 100644 --- a/go/pserver/optimizer_test.go +++ b/go/pserver/optimizer_test.go @@ -3,6 +3,12 @@ package pserver import "testing" func TestSGDCreateRelease(t *testing.T) { + param := pserver.ParameterWithConfig{ + Param : pserver.Parameter{Name : "a", + ElementType: , + Content: , + Length : } + } o := newOptimizer(sgd, 1) o.Cleanup() } diff --git a/go/pserver/service_test.go b/go/pserver/service_test.go index b746d13e1ca71e697c464f84d915af029d37120c..1b2626f7db8ebaf86b7de3f88bee7aac8a72a30a 100644 --- a/go/pserver/service_test.go +++ b/go/pserver/service_test.go @@ -13,7 +13,9 @@ func TestFull(t *testing.T) { s := pserver.NewService() var p pserver.Parameter p.Name = "param_a" - p.Content = []byte{1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0} + ElementValue := []byte{1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0} + p.Content = &ElementValue[0] + p.Length = len(ElementValue) p.ElementType = pserver.Int32 err := s.InitParam(pserver.ParameterWithConfig{Param: p, Config: nil}, nil) if err != nil { @@ -22,7 +24,9 @@ func TestFull(t *testing.T) { var p1 pserver.Parameter p1.Name = "param_b" - p1.Content = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + ElementValue = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + p1.Content = &ElementValue[0] + p1.Length = len(ElementValue) p1.ElementType = pserver.Float32 err = s.InitParam(pserver.ParameterWithConfig{Param: p1, Config: nil}, nil) if err != nil {