From 83fad88204387d196f755c718de40828c08dc7ac Mon Sep 17 00:00:00 2001 From: Clément Bénier Date: Mon, 20 Aug 2018 15:43:22 +0200 Subject: test exec/sdk: use sdk for building exec project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit source sdk before building helloworld project fix sdks misconfiguration and multiple sdk installs Change-Id: I019e6b6e2704737774e93f08fb79d2f4a84a12b9 Signed-off-by: Clément Bénier --- test/exec_test.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'test/exec_test.go') 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) } -- cgit 1.2.3-korg