Best Python code snippet using autotest_python
test_external.py
Source:test_external.py  
...36    toolchain_prefix = "arm-none-linux-gnueabi"37    def test_run(self):38        TestExternalToolchain.common_check(self)39        # Check the architecture variant40        arch = infra.get_file_arch(self.builddir,41                                   self.toolchain_prefix,42                                   "lib/libc.so.6")43        self.assertEqual(arch, "v4T")44        # Check the sysroot symlink45        symlink = os.path.join(self.builddir, "staging", "armv4t")46        self.assertTrue(os.path.exists(symlink))47        self.assertEqual(os.readlink(symlink), "./")48        # Boot the system49        img = os.path.join(self.builddir, "images", "rootfs.cpio")50        self.emulator.boot(arch="armv5",51                           kernel="builtin",52                           options=["-initrd", img])53        self.emulator.login()54class TestExternalToolchainSourceryArmv5(TestExternalToolchain):55    config = BASIC_CONFIG + \56        """57        BR2_arm=y58        BR2_TOOLCHAIN_EXTERNAL=y59        BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y60        """61    toolchain_prefix = "arm-none-linux-gnueabi"62    def test_run(self):63        TestExternalToolchain.common_check(self)64        # Check the architecture variant65        arch = infra.get_file_arch(self.builddir,66                                   self.toolchain_prefix,67                                   "lib/libc.so.6")68        self.assertEqual(arch, "v5TE")69        # Boot the system70        img = os.path.join(self.builddir, "images", "rootfs.cpio")71        self.emulator.boot(arch="armv5",72                           kernel="builtin",73                           options=["-initrd", img])74        self.emulator.login()75class TestExternalToolchainSourceryArmv7(TestExternalToolchain):76    config = BASIC_CONFIG + \77        """78        BR2_arm=y79        BR2_cortex_a8=y80        BR2_ARM_EABI=y81        BR2_ARM_INSTRUCTIONS_THUMB2=y82        BR2_TOOLCHAIN_EXTERNAL=y83        BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM=y84        """85    toolchain_prefix = "arm-none-linux-gnueabi"86    def test_run(self):87        TestExternalToolchain.common_check(self)88        # Check the architecture variant89        arch = infra.get_file_arch(self.builddir,90                                   self.toolchain_prefix,91                                   "lib/libc.so.6")92        self.assertEqual(arch, "v7")93        isa = infra.get_elf_arch_tag(self.builddir,94                                     self.toolchain_prefix,95                                     "lib/libc.so.6",96                                     "Tag_THUMB_ISA_use")97        self.assertEqual(isa, "Thumb-2")98        # Check we have the sysroot symlink99        symlink = os.path.join(self.builddir, "staging", "thumb2")100        self.assertTrue(os.path.exists(symlink))101        self.assertEqual(os.readlink(symlink), "./")102        # Boot the system103        img = os.path.join(self.builddir, "images", "rootfs.cpio")104        self.emulator.boot(arch="armv7",105                           kernel="builtin",106                           options=["-initrd", img])107        self.emulator.login()108class TestExternalToolchainLinaroArm(TestExternalToolchain):109    config = BASIC_CONFIG + \110        """111        BR2_arm=y112        BR2_cortex_a8=y113        BR2_TOOLCHAIN_EXTERNAL=y114        BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM=y115        """116    toolchain_prefix = "arm-linux-gnueabihf"117    def test_run(self):118        TestExternalToolchain.common_check(self)119        # Check the architecture variant120        arch = infra.get_file_arch(self.builddir,121                                   self.toolchain_prefix,122                                   "lib/libc.so.6")123        self.assertEqual(arch, "v7")124        isa = infra.get_elf_arch_tag(self.builddir,125                                     self.toolchain_prefix,126                                     "lib/libc.so.6",127                                     "Tag_THUMB_ISA_use")128        self.assertEqual(isa, "Thumb-2")129        # Boot the system130        img = os.path.join(self.builddir, "images", "rootfs.cpio")131        self.emulator.boot(arch="armv7",132                           kernel="builtin",133                           options=["-initrd", img])134        self.emulator.login()...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!!
