8753180a80
Options "-p" to not remove topology elements after the test finishes "-v" from now on extra output from tests is hidden by default, this will show it again Type: test Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: I626188561c883534e9004d5130ee2a972d12b4e2
93 lines
2.4 KiB
Go
Executable File
93 lines
2.4 KiB
Go
Executable File
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
func (s *VethsSuite) TestLDPreloadIperfVpp() {
|
|
var clnVclConf, srvVclConf Stanza
|
|
|
|
serverContainer := s.getContainerByName("server-vpp")
|
|
serverVolume := serverContainer.getVolumeByHostDir("/tmp/server")
|
|
srvVcl := serverVolume.containerDir + "/vcl_srv.conf"
|
|
|
|
clientContainer := s.getContainerByName("client-vpp")
|
|
clientVolume := clientContainer.getVolumeByHostDir("/tmp/client")
|
|
clnVcl := clientVolume.containerDir + "/vcl_cln.conf"
|
|
|
|
ldpreload := os.Getenv("HST_LDPRELOAD")
|
|
s.assertNotEqual("", ldpreload)
|
|
|
|
ldpreload = "LD_PRELOAD=" + ldpreload
|
|
|
|
stopServerCh := make(chan struct{}, 1)
|
|
srvCh := make(chan error, 1)
|
|
clnCh := make(chan error)
|
|
|
|
s.log("starting VPPs")
|
|
|
|
originalWorkDir := serverContainer.workDir
|
|
serverContainer.workDir = serverVolume.containerDir
|
|
_, err := serverContainer.execAction("Configure2Veths srv")
|
|
s.assertNil(err)
|
|
serverContainer.workDir = originalWorkDir
|
|
|
|
originalWorkDir = clientContainer.workDir
|
|
clientContainer.workDir = clientVolume.containerDir
|
|
_, err = clientContainer.execAction("Configure2Veths cln")
|
|
s.assertNil(err)
|
|
clientContainer.workDir = originalWorkDir
|
|
|
|
clientAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/2",
|
|
clientVolume.containerDir)
|
|
err = clnVclConf.
|
|
NewStanza("vcl").
|
|
Append("rx-fifo-size 4000000").
|
|
Append("tx-fifo-size 4000000").
|
|
Append("app-scope-local").
|
|
Append("app-scope-global").
|
|
Append("use-mq-eventfd").
|
|
Append(clientAppSocketApi).Close().
|
|
SaveToFile(clnVcl)
|
|
s.assertNil(err)
|
|
|
|
serverAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/1",
|
|
serverVolume.containerDir)
|
|
err = srvVclConf.
|
|
NewStanza("vcl").
|
|
Append("rx-fifo-size 4000000").
|
|
Append("tx-fifo-size 4000000").
|
|
Append("app-scope-local").
|
|
Append("app-scope-global").
|
|
Append("use-mq-eventfd").
|
|
Append(serverAppSocketApi).Close().
|
|
SaveToFile(srvVcl)
|
|
s.assertNil(err)
|
|
|
|
s.log("attaching server to vpp")
|
|
|
|
// FIXME
|
|
time.Sleep(5 * time.Second)
|
|
|
|
srvEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+srvVcl)
|
|
go StartServerApp(srvCh, stopServerCh, srvEnv)
|
|
|
|
err = <-srvCh
|
|
s.assertNil(err)
|
|
|
|
s.log("attaching client to vpp")
|
|
var clnRes = make(chan string, 1)
|
|
clnEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+clnVcl)
|
|
go StartClientApp(clnEnv, clnCh, clnRes)
|
|
s.log(<- clnRes)
|
|
|
|
// wait for client's result
|
|
err = <-clnCh
|
|
s.assertNil(err)
|
|
|
|
// stop server
|
|
stopServerCh <- struct{}{}
|
|
}
|