How to use disk_block_size method in autotest

Best Python code snippet using autotest_python Github


Full Screen

1# This file is part of curtin. See LICENSE file for copyright and license info.2from . import (VMBaseClass)3from .releases import base_vm_classes as relbase4from .releases import centos_base_vm_classes as centos_relbase5import textwrap6class TestBasicAbs(VMBaseClass):7 interactive = False8 test_type = 'storage'9 arch_skip = ["s390x"]10 conf_file = "examples/tests/uefi_basic.yaml"11 extra_disks = ['4G']12 uefi = True13 disk_to_check = [('main_disk', 1), ('main_disk', 2)]14 extra_collect_scripts = [textwrap.dedent("""15 cd OUTPUT_COLLECT_D16 ls /sys/firmware/efi/ | cat >ls_sys_firmware_efi17 cp /sys/class/block/vda/queue/logical_block_size vda_lbs18 cp /sys/class/block/vda/queue/physical_block_size vda_pbs19 blockdev --getsz /dev/vda | cat >vda_blockdev_getsz20 blockdev --getss /dev/vda | cat >vda_blockdev_getss21 blockdev --getpbsz /dev/vda | cat >vda_blockdev_getpbsz22 blockdev --getbsz /dev/vda | cat >vda_blockdev_getbsz23 exit 024 """)]25 def test_sys_firmware_efi(self):26 self.output_files_exist(["ls_sys_firmware_efi"])27 sys_efi_possible = [28 'config_table',29 'efivars',30 'fw_platform_size',31 'fw_vendor',32 'runtime',33 'runtime-map',34 'systab',35 'vars',36 ]37 efi_lines = self.load_collect_file(38 "ls_sys_firmware_efi").strip().split('\n')39 # sys/firmware/efi contents differ based on kernel and configuration40 for efi_line in efi_lines:41 self.assertIn(efi_line, sys_efi_possible)42 def test_disk_block_sizes(self):43 """ Test disk logical and physical block size are match44 the class block size.45 """46 blocksize_files = ['vda_' + bs for bs in ['lbs', 'pbs']]47 self.output_files_exist(blocksize_files)48 for bs_file in blocksize_files:49 size = int(self.load_collect_file(bs_file))50 self.assertEqual(self.disk_block_size, size)51 def test_disk_block_size_with_blockdev(self):52 """ validate maas setting53 --getsz get size in 512-byte sectors54 --getss get logical block (sector) size55 --getpbsz get physical block (sector) size56 --getbsz get blocksize57 """58 bdev_files = ['vda_blockdev_' + sc for sc in ['getss', 'getpbsz']]59 self.output_files_exist(bdev_files)60 for sc_file in bdev_files:61 size = int(self.load_collect_file(sc_file))62 self.assertEqual(self.disk_block_size, size)63class Centos70UefiTestBasic(centos_relbase.centos70_xenial, TestBasicAbs):64 __test__ = True65class PreciseUefiTestBasic(relbase.precise, TestBasicAbs):66 __test__ = False67 def test_ptable(self):68 print("test_ptable does not work for Precise")69 def test_dname(self):70 print("test_dname does not work for Precise")71class PreciseHWETUefiTestBasic(relbase.precise_hwe_t, PreciseUefiTestBasic):72 __test__ = False73class XenialGAUefiTestBasic(relbase.xenial_ga, TestBasicAbs):74 __test__ = True75class XenialHWEUefiTestBasic(relbase.xenial_hwe, TestBasicAbs):76 __test__ = True77class XenialEdgeUefiTestBasic(relbase.xenial_edge, TestBasicAbs):78 __test__ = True79class BionicUefiTestBasic(relbase.bionic, TestBasicAbs):80 __test__ = True81class CosmicUefiTestBasic(relbase.cosmic, TestBasicAbs):82 __test__ = True83class DiscoUefiTestBasic(relbase.disco, TestBasicAbs):84 __test__ = True85class EoanUefiTestBasic(relbase.eoan, TestBasicAbs):86 __test__ = True87class Centos70UefiTestBasic4k(centos_relbase.centos70_xenial, TestBasicAbs):88 __test__ = True89 disk_block_size = 409690class XenialGAUefiTestBasic4k(relbase.xenial_ga, TestBasicAbs):91 __test__ = True92 disk_block_size = 409693class BionicUefiTestBasic4k(relbase.bionic, TestBasicAbs):94 __test__ = True95 disk_block_size = 409696class CosmicUefiTestBasic4k(relbase.cosmic, TestBasicAbs):97 __test__ = True98 disk_block_size = 409699class DiscoUefiTestBasic4k(relbase.disco, TestBasicAbs):100 __test__ = True101 disk_block_size = 4096102class EoanUefiTestBasic4k(relbase.eoan, TestBasicAbs):103 __test__ = True104 disk_block_size = 4096...

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:


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

Run autotest 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?