diff options
author | Clément Bénier <clement.benier@iot.bzh> | 2018-08-20 15:43:22 +0200 |
---|---|---|
committer | Clément Bénier <clement.benier@iot.bzh> | 2018-08-21 11:08:36 +0200 |
commit | 83fad88204387d196f755c718de40828c08dc7ac (patch) | |
tree | c943126bf4baac0a365652505a283df664f2ea85 /test/exec_test.go | |
parent | cf3266b208d3ba0fb8f172c29725768bbd41d509 (diff) |
test exec/sdk: use sdk for building exec project
source sdk before building helloworld project
fix sdks misconfiguration and multiple sdk installs
Change-Id: I019e6b6e2704737774e93f08fb79d2f4a84a12b9
Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
Diffstat (limited to 'test/exec_test.go')
-rw-r--r-- | test/exec_test.go | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/test/exec_test.go b/test/exec_test.go index f2d48ce..ff67322 100644 --- a/test/exec_test.go +++ b/test/exec_test.go @@ -53,6 +53,15 @@ func flushChannelExec(channel chan xsapiv1.ExecOutMsg, ms time.Duration) { } func TestExec(t *testing.T) { helloworldDir := InitExec(t) + chSdks := make(chan xsapiv1.SDK) + defer close(chSdks) + sdk := xsapiv1.SDKInstallArgs{ + ID: "", + Filename: sdkFileName, + Force: false, + } + ConnectSDKStateChange(t, sCli, chSdks) + sdkRes := installFakeSdk(t, sdk, chSdks) var cfgArray []xsapiv1.FolderConfig assert.Nil(t, HTTPCli.Get("/folders", &cfgArray)) @@ -77,7 +86,12 @@ func TestExec(t *testing.T) { chExec <- ev }) - cmd := "cd " + fPrj.ClientPath + sdkSourceFile := path.Join(sdkRes.Path, "environment-setup-corei7-64-native-linux") + cmd := "source " + sdkSourceFile + cmd = cmd + " && " + cmd = cmd + "unset SDKTARGETSYSROOT" + cmd = cmd + " && " + cmd = cmd + "cd " + fPrj.ClientPath cmd = cmd + " && " cmd = cmd + "mkdir -p build" cmd = cmd + " && " @@ -93,7 +107,11 @@ func TestExec(t *testing.T) { assert.Nil(t, HTTPCli.Post("/exec", exec, &execRes)) flushChannelExec(chExec, 1000) - cmd = "cd " + fPrj.ClientPath + cmd = "source " + sdkSourceFile + cmd = cmd + " && " + cmd = cmd + "unset SDKTARGETSYSROOT" + cmd = cmd + " && " + cmd = cmd + "cd " + fPrj.ClientPath cmd = cmd + "&&" cmd = cmd + "cd build" cmd = cmd + "&&" @@ -107,4 +125,7 @@ func TestExec(t *testing.T) { assert.Nil(t, err) assert.Nil(t, HTTPCli.Delete("/folders/"+cfg.ID, &cfg)) + + RemoveSdk(t, sdkRes, chSdks) + DisconnectSDKStateChange(t, sCli) } |