How to use getprop method in Airtest

Best Python code snippet using Airtest

releasetools.py

Source:releasetools.py Github

copy

Full Screen

...14# limitations under the License.15#16"""Custom OTA commands for klte devices"""17def FullOTA_InstallEnd(info):18 info.script.AppendExtra('ifelse(is_substring("G900A", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/gsm/* /system/lib/"));')19 info.script.AppendExtra('ifelse(is_substring("G900A", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')20 info.script.AppendExtra('ifelse(is_substring("G900T", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/gsm/* /system/lib/"));')21 info.script.AppendExtra('ifelse(is_substring("G900T", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')22 info.script.AppendExtra('ifelse(is_substring("G900D", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/gsm/* /system/lib/"));')23 info.script.AppendExtra('ifelse(is_substring("G900D", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')24 info.script.AppendExtra('ifelse(is_substring("G9005", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/gsm/* /system/lib/"));')25 info.script.AppendExtra('ifelse(is_substring("G9005", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')26 info.script.AppendExtra('ifelse(is_substring("G900F", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/gsm/* /system/lib/"));')27 info.script.AppendExtra('ifelse(is_substring("G900F", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')28 info.script.AppendExtra('ifelse(is_substring("G900W", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/gsm/* /system/lib/"));')29 info.script.AppendExtra('ifelse(is_substring("G900W", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')30 info.script.AppendExtra('ifelse(is_substring("G900I", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/gsm/* /system/lib/"));')31 info.script.AppendExtra('ifelse(is_substring("G900I", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')32 info.script.AppendExtra('ifelse(is_substring("G900M", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/gsm/* /system/lib/"));')33 info.script.AppendExtra('ifelse(is_substring("G900M", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')34 info.script.AppendExtra('ifelse(is_substring("G900V", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/cdma/* /system/lib/"));')35 info.script.AppendExtra('ifelse(is_substring("G900V", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')36 info.script.AppendExtra('ifelse(is_substring("G900P", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/cdma/* /system/lib/"));')37 info.script.AppendExtra('ifelse(is_substring("G900P", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/spr/* /system/lib/hw/"));')38 info.script.AppendExtra('ifelse(is_substring("G900R4", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/cdma/* /system/lib/"));')39 info.script.AppendExtra('ifelse(is_substring("G900R4", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')40 info.script.AppendExtra('ifelse(is_substring("G900R6", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/cdma/* /system/lib/"));')41 info.script.AppendExtra('ifelse(is_substring("G900R6", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')42 info.script.AppendExtra('ifelse(is_substring("G900R7", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/cdma/* /system/lib/"));')43 info.script.AppendExtra('ifelse(is_substring("G900R7", getprop("ro.bootloader")), run_program("/sbin/sh", "-c", "busybox cp /system/lib/hw/gsm/* /system/lib/hw/"));')44 info.script.AppendExtra('delete_recursive("/system/lib/hw/gsm/");')45 info.script.AppendExtra('delete_recursive("/system/lib/hw/spr/");')46 info.script.AppendExtra('delete_recursive("/system/lib/gsm/");')...

Full Screen

Full Screen

test_ext.py

Source:test_ext.py Github

copy

Full Screen

...10def dumpe2fs_run(builddir, image):11 cmd = ["host/sbin/dumpe2fs", os.path.join("images", image)]12 ret = infra.run_cmd_on_host(builddir, cmd)13 return ret.strip().splitlines()14def dumpe2fs_getprop(out, prop):15 for line in out:16 fields = line.split(": ")17 if fields[0] == prop:18 return fields[1].strip()19def boot_img_and_check_fs_type(emulator, builddir, fs_type):20 img = os.path.join(builddir, "images", "rootfs.{}".format(fs_type))21 emulator.boot(arch="armv7",22 kernel="builtin",23 kernel_cmdline=["root=/dev/mmcblk0",24 "rootfstype={}".format(fs_type)],25 options=["-drive", "file={},if=sd".format(img)])26 emulator.login()27 _, exit_code = emulator.run(CHECK_FS_TYPE_CMD.format(fs_type))28 return exit_code29class TestExt2(infra.basetest.BRTest):30 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \31 """32 BR2_TARGET_ROOTFS_EXT2=y33 BR2_TARGET_ROOTFS_EXT2_2r0=y34 BR2_TARGET_ROOTFS_EXT2_LABEL="foobaz"35 # BR2_TARGET_ROOTFS_TAR is not set36 """37 def test_run(self):38 out = dumpe2fs_run(self.builddir, "rootfs.ext2")39 self.assertEqual(dumpe2fs_getprop(out, VOLNAME_PROP), "foobaz")40 self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "0 (original)")41 exit_code = boot_img_and_check_fs_type(self.emulator,42 self.builddir, "ext2")43 self.assertEqual(exit_code, 0)44class TestExt2r1(infra.basetest.BRTest):45 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \46 """47 BR2_TARGET_ROOTFS_EXT2=y48 BR2_TARGET_ROOTFS_EXT2_2r1=y49 BR2_TARGET_ROOTFS_EXT2_LABEL="foobar"50 # BR2_TARGET_ROOTFS_TAR is not set51 """52 def test_run(self):53 out = dumpe2fs_run(self.builddir, "rootfs.ext2")54 self.assertEqual(dumpe2fs_getprop(out, VOLNAME_PROP), "foobar")55 self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")56 self.assertNotIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))57 exit_code = boot_img_and_check_fs_type(self.emulator,58 self.builddir, "ext2")59 self.assertEqual(exit_code, 0)60class TestExt3(infra.basetest.BRTest):61 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \62 """63 BR2_TARGET_ROOTFS_EXT2=y64 BR2_TARGET_ROOTFS_EXT2_3=y65 # BR2_TARGET_ROOTFS_TAR is not set66 """67 def test_run(self):68 out = dumpe2fs_run(self.builddir, "rootfs.ext3")69 self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")70 self.assertIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))71 self.assertNotIn("extent", dumpe2fs_getprop(out, FEATURES_PROP))72 exit_code = boot_img_and_check_fs_type(self.emulator,73 self.builddir, "ext3")74 self.assertEqual(exit_code, 0)75class TestExt4(infra.basetest.BRTest):76 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \77 """78 BR2_TARGET_ROOTFS_EXT2=y79 BR2_TARGET_ROOTFS_EXT2_4=y80 BR2_TARGET_ROOTFS_EXT2_SIZE="16384"81 BR2_TARGET_ROOTFS_EXT2_INODES=300082 BR2_TARGET_ROOTFS_EXT2_RESBLKS=1083 # BR2_TARGET_ROOTFS_TAR is not set84 """85 def test_run(self):86 out = dumpe2fs_run(self.builddir, "rootfs.ext4")87 self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")88 self.assertEqual(dumpe2fs_getprop(out, BLOCKCNT_PROP), "16384")89 # Yes there are 8 more inodes than requested90 self.assertEqual(dumpe2fs_getprop(out, INODECNT_PROP), "3008")91 self.assertEqual(dumpe2fs_getprop(out, RESBLKCNT_PROP), "1638")92 self.assertIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))93 self.assertIn("extent", dumpe2fs_getprop(out, FEATURES_PROP))94 exit_code = boot_img_and_check_fs_type(self.emulator,95 self.builddir, "ext4")...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful