Best Python code snippet using lisa_python
mdadm.py
Source:mdadm.py
...59 else:60 self._install_from_src()61 return self._check_exists()62 def _install_from_src(self) -> None:63 self._install_dep_packages()64 posix_os: Posix = cast(Posix, self.node.os)65 posix_os.install_packages([Gcc])66 tool_path = self.get_tool_path()67 git = self.node.tools[Git]68 git.clone(self._repo, tool_path)69 make = self.node.tools[Make]70 code_path = tool_path.joinpath("mdadm")71 make.make_install(cwd=code_path)72 def _install_dep_packages(self) -> None:73 posix_os: Posix = cast(Posix, self.node.os)74 if isinstance(self.node.os, CBLMariner):75 package_list = [76 "kernel-headers",77 "binutils",78 "glibc-devel",79 "zlib-devel",80 "cmake",81 ]82 elif (83 isinstance(self.node.os, Fedora)84 or isinstance(self.node.os, Debian)85 or isinstance(self.node.os, Suse)86 ):...
netperf.py
Source:netperf.py
...63 def _install(self) -> bool:64 if not self._check_exists():65 self._install_from_src()66 return self._check_exists()67 def _install_dep_packages(self) -> None:68 posix_os: Posix = cast(Posix, self.node.os)69 if isinstance(self.node.os, Redhat):70 package_list = ["sysstat", "wget", "automake"]71 elif isinstance(self.node.os, Debian):72 package_list = ["sysstat", "automake"]73 elif isinstance(self.node.os, Suse):74 package_list = ["sysstat", "automake"]75 elif isinstance(self.node.os, CBLMariner):76 package_list = [77 "kernel-headers",78 "binutils",79 "glibc-devel",80 "zlib-devel",81 "automake",82 "autoconf",83 ]84 else:85 raise LisaException(86 f"tool {self.command} can't be installed in distro {self.node.os.name}."87 )88 for package in list(package_list):89 if posix_os.is_package_in_repo(package):90 posix_os.install_packages(package)91 def _install_from_src(self) -> None:92 self._install_dep_packages()93 tool_path = self.get_tool_path()94 git = self.node.tools[Git]95 git.clone(self.repo, tool_path, ref=self.branch)96 code_path = tool_path.joinpath("netperf")97 make = self.node.tools[Make]98 if self.node.shell.exists(self.node.get_pure_path(f"{code_path}/autogen.sh")):99 self.node.execute("./autogen.sh", cwd=code_path).assert_exit_code()100 self.node.execute("./configure", cwd=code_path).assert_exit_code()101 arguments = ""102 # fix compile issue when gcc version >= 10103 if self.node.tools[Gcc].get_version() >= "10.0.0":104 arguments = "CFLAGS=-fcommon"105 make.make_install(code_path, arguments=arguments)106 self.node.execute(...
modetest.py
Source:modetest.py
...26 self.node.os.install_packages("libdrm-tests")27 if isinstance(self.node.os, Redhat):28 self._install_from_src()29 return self._check_exists()30 def _install_dep_packages(self) -> None:31 if isinstance(self.node.os, Redhat):32 self.node.os.install_packages(33 (34 "git",35 "make",36 "autoconf",37 "automake",38 "libpciaccess-devel.x86_64",39 "libtool",40 "http://mirror.stream.centos.org/9-stream/CRB/x86_64/os/Packages/xorg-x11-util-macros-1.19.3-4.el9.noarch.rpm", # noqa: E50141 "http://mirror.stream.centos.org/9-stream/CRB/x86_64/os/Packages/ninja-build-1.10.2-6.el9.x86_64.rpm", # noqa: E50142 "http://mirror.stream.centos.org/9-stream/CRB/x86_64/os/Packages/meson-0.58.2-1.el9.noarch.rpm", # noqa: E50143 )44 )45 else:46 raise UnsupportedDistroException(self.node.os)47 def _install_from_src(self) -> None:48 self._install_dep_packages()49 tool_path = self.get_tool_path()50 self.node.tools[Git].clone(self.repo, tool_path)51 code_path = tool_path.joinpath("libdrm")52 self.node.execute(53 "./autogen.sh --enable-install-test-programs", cwd=code_path54 ).assert_exit_code()55 self.node.execute(56 "meson builddir/", cwd=code_path, sudo=True57 ).assert_exit_code()58 self.node.execute(59 "ninja -C builddir/ install", cwd=code_path, sudo=True60 ).assert_exit_code()61 self.node.execute(62 f"ln -s {code_path}/builddir/tests/modetest/modetest /usr/bin/modetest",...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!