X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=test%2Fexec_test.go;fp=test%2Fexec_test.go;h=ff67322021399d10a9241ea0e92a69f03d684f36;hb=83fad88204387d196f755c718de40828c08dc7ac;hp=f2d48ce79d698ac6cb6ec12e407d8212a5b224e0;hpb=cf3266b208d3ba0fb8f172c29725768bbd41d509;p=src%2Fxds%2Fxds-server.git 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) }