in microsoft/testsuites/dpdk/dpdknffgo.py [0:0]
def _install(self) -> bool:
node = self.node
git = node.tools[Git]
echo = node.tools[Echo]
wget = node.tools[Wget]
tar = node.tools[Tar]
make = node.tools[Make]
# grab the path, a workaround for the issue mentioned below in run_test
original_path = echo.run(
"$PATH",
shell=True,
expected_exit_code=0,
expected_exit_code_failure_message="failure to grab $PATH via echo",
).stdout
self.new_path = f"{original_path}:/usr/local/go/bin/"
# get nff-go source and go binaries
self.nff_go_path = git.clone(
"https://github.com/intel-go/nff-go.git",
cwd=node.working_path,
dir_name=self.REPO_DIR,
)
go_tar_path = wget.get(
f"https://go.dev/dl/{self.GO_TAR}",
file_path=str(node.working_path),
filename=self.GO_TAR,
)
# unpack and add to path
tar.extract(go_tar_path, "/usr/local")
# download go modules
node.execute(
"go mod download",
cwd=self.nff_go_path,
update_envs={"PATH": self.new_path},
expected_exit_code=0,
expected_exit_code_failure_message=(
"Could not install go modules for nff-go"
),
)
# install needed libraries
if isinstance(node.os, Debian):
node.os.install_packages(
[
"lua5.3-dev",
"linux-headers-generic",
"libnuma-dev",
"libibverbs-dev",
"libpcap-dev",
"libmnl-dev",
]
)
else:
raise UnsupportedDistroException(
node.os, "nff-go test not implemented on this OS"
)
# make main project
make.make(
"",
cwd=self.nff_go_path,
update_envs={
"PATH": self.new_path,
"NFF_GO_NO_BPF_SUPPORT": "1",
},
)
# make dpdk components we need
make.make(
"",
cwd=self.nff_go_path.joinpath("dpdk"),
update_envs={
"NFF_GO_NO_BPF_SUPPORT": "1",
},
)
return True