Best Python code snippet using autotest_python
qemu.py
Source:qemu.py
...38 extra_args=[]):39 qemu_path = get_qemu(qemu)40 logging.info('Using qemu version %s.%s' % get_qemu_version(qemu_path))41 if vmlinux is None:42 vmlinux = get_vmlinux()43 l = [44 get_qemu(qemu),45 '-nographic',46 '-vga', 'none',47 '-M', machine,48 '-smp', str(smp),49 '-m', mem,50 '-accel', accel,51 '-kernel', vmlinux,52 net,53 ]54 if initrd is None and drive is None:55 if qemu == 'qemu-system-ppc':56 subarch = 'ppc'57 elif get_endian(vmlinux) == 'little':58 subarch = 'ppc64le'59 else:60 subarch = 'ppc64'61 initrd = f'{subarch}-rootfs.cpio.gz'62 if initrd:63 l.append('-initrd')64 l.append(get_root_disk(initrd))65 if drive:66 l.append(drive)67 if host_mount:68 bus = ''69 if 'powernv' in machine:70 bus = ',bus=pcie.0'71 l.append(f'-fsdev local,id=fsdev0,path={host_mount},security_model=none')72 l.append(f'-device virtio-9p-pci,fsdev=fsdev0,mount_tag=host{bus}')73 if cpu is not None:74 l.append('-cpu')75 l.append(cpu)76 if len(cmdline):77 l.append('-append')78 l.append(f'"{cmdline}"')79 if gdb:80 l.append(gdb)81 l.extend(extra_args)82 logging.debug(l)83 return ' '.join(l)84def qemu_net_setup(p, iface='eth0'):85 p.cmd('ip addr show')86 p.cmd('ls -l /sys/class/net')87 p.cmd(f'ip addr add dev {iface} 10.0.2.15/24')88 p.cmd(f'ip link set {iface} up')89 p.cmd('ip addr show')90 p.cmd('route add default gw 10.0.2.2')91 p.cmd('route -n')92def qemu_main(qemu_machine, cpuinfo_platform, cpu, net, args):93 expected_release = get_expected_release()94 if expected_release is None:95 return False96 vmlinux = get_vmlinux()97 if vmlinux is None:98 return False99 accel = get_env_var('ACCEL', 'tcg')100 smp = get_env_var('SMP', None)101 if smp is None:102 if accel == 'tcg':103 smp = 2104 else:105 smp = 8106 cmdline = 'noreboot '107 cloud_image = os.environ.get('CLOUD_IMAGE', False)108 if cloud_image:109 # Create snapshot image110 rdpath = get_root_disk_path()...
qemu-g3beige
Source:qemu-g3beige
...32 setup_timeout(60)33 expected_release = get_expected_release()34 if expected_release is None:35 return False36 vmlinux = get_vmlinux()37 if vmlinux is None:38 return False39 p = PexpectHelper()40 cmd = qemu_command(qemu='qemu-system-ppc', machine='g3beige', vmlinux=vmlinux, cmdline='noreboot')41 p.spawn(cmd, logfile=open('console.log', 'w'))42 standard_boot(p)43 p.send("echo -n 'booted-revision: '; uname -r")44 p.expect(f'booted-revision: {expected_release}')45 p.expect_prompt()46 p.send('cat /proc/cpuinfo')47 p.expect('AAPL,PowerMac G3 MacRISC')48 p.expect_prompt()49 if os.environ.get('QEMU_NET_TESTS', True) != '0':50 qemu_net_setup(p)...
qemu-44x
Source:qemu-44x
...24 setup_timeout(60)25 expected_release = get_expected_release()26 if expected_release is None:27 return False28 vmlinux = get_vmlinux()29 if vmlinux is None:30 return False31 p = PexpectHelper()32 cmd = qemu_command(qemu='qemu-system-ppc', machine='bamboo', vmlinux=vmlinux,33 cmdline='noreboot')34 p.spawn(cmd, logfile=open('console.log', 'w'))35 standard_boot(p)36 p.send("echo -n 'booted-revision: '; uname -r")37 p.expect(f'booted-revision: {expected_release}')38 p.expect_prompt()39 p.send('cat /proc/cpuinfo')40 p.expect("PowerPC 44x Platform")41 p.expect_prompt()42 if os.environ.get('QEMU_NET_TESTS', True) != '0':...
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!!