How to use get_xen_build_ver method in autotest

Best Python code snippet using autotest_python

xen.py

Source: xen.py Github

copy

Full Screen

...62 # also, the vmlinuz is not out in arch/​*/​boot, ARGH! more hackery63 self.kjob.set_build_image(self.job.tmpdir + '/​build/​linux/​vmlinuz')64 self.kjob.build()65 self.job.logging.restore()66 xen_version = self.get_xen_build_ver()67 self.log('BUILD VERSION: Xen: %s Kernel:%s' % \68 (xen_version, self.kjob.get_kernel_build_ver()))69 def build_timed(self, *args, **kwds):70 raise NotImplementedError('build_timed() not implemented')71 def install(self, tag='', prefix = '/​', extraversion='autotest'):72 """make install in the kernel tree"""73 self.log('Installing ...')74 os.chdir(self.build_dir)75 if not os.path.isdir(prefix):76 os.mkdir(prefix)77 self.boot_dir = os.path.join(prefix, 'boot')78 if not os.path.isdir(self.boot_dir):79 os.mkdir(self.boot_dir)80 # remember what we are going to install81 xen_version = '%s-%s' % (self.get_xen_build_ver(), extraversion)82 self.xen_image = self.boot_dir + '/​xen-' + xen_version + '.gz'83 self.xen_syms = self.boot_dir + '/​xen-syms-' + xen_version84 self.log('Installing Xen ...')85 os.environ['XEN_EXTRAVERSION'] = '-unstable-%s'% extraversion86 # install xen87 utils.system('make DESTDIR=%s -C xen install' % prefix)88 # install tools89 utils.system('make DESTDIR=%s -C tools install' % prefix)90 # install kernel91 ktag = self.kjob.get_kernel_build_ver()92 kprefix = prefix93 self.kjob.install(tag=ktag, prefix=kprefix)94 def add_to_bootloader(self, tag='autotest', args=''):95 """ add this kernel to bootloader, taking an96 optional parameter of space separated parameters97 e.g.: kernel.add_to_bootloader('mykernel', 'ro acpi=off')98 """99 # turn on xen mode100 self.job.bootloader.enable_xen_mode()101 # remove existing entry if present102 self.job.bootloader.remove_kernel(tag)103 # add xen and xen kernel104 self.job.bootloader.add_kernel(105 self.kjob.image, tag, initrd=self.kjob.initrd,106 xen_hypervisor=self.xen_image)107 # if no args passed, populate from /​proc/​cmdline108 if not args:109 args = open('/​proc/​cmdline', 'r').readline().strip()110 # add args to entry one at a time111 for a in args.split(' '):112 self.job.bootloader.add_args(tag, a)113 # turn off xen mode114 self.job.bootloader.disable_xen_mode()115 def get_xen_kernel_build_ver(self):116 """Check xen buildconfig for current kernel version"""117 version = patchlevel = sublevel = ''118 extraversion = localversion = ''119 version_file = self.build_dir + '/​buildconfigs/​mk.linux-2.6-xen'120 for line in open(version_file, 'r').readlines():121 if line.startswith('LINUX_VER'):122 start = line.index('=') + 1123 version = line[start:].strip() + "-xen"124 break125 return version126 def fix_up_xen_kernel_makefile(self, kernel_dir):127 """Fix up broken EXTRAVERSION in xen-ified Linux kernel Makefile"""128 xenguest = ''129 makefile = kernel_dir + '/​Makefile'130 for line in open(makefile, 'r').readlines():131 if line.startswith('XENGUEST'):132 start = line.index('=') + 1133 xenguest = line[start:].strip()134 break;135 # change out $XENGUEST in EXTRAVERSION line136 utils.system('sed -i.old "s,\$(XENGUEST),%s," %s' % (xenguest,137 makefile))138 def get_xen_build_ver(self):139 """Check Makefile and .config to return kernel version"""140 version = patchlevel = sublevel = ''141 extraversion = localversion = ''142 for line in open(self.build_dir + '/​xen/​Makefile', 'r').readlines():143 if line.startswith('export XEN_VERSION'):144 start = line.index('=') + 1145 version = line[start:].strip()146 if line.startswith('export XEN_SUBVERSION'):147 start = line.index('=') + 1148 sublevel = line[start:].strip()149 if line.startswith('export XEN_EXTRAVERSION'):150 start = line.index('=') + 1151 extraversion = line[start:].strip()152 return "%s.%s%s" % (version, sublevel, extraversion)

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Why does DevOps recommend shift-left testing principles?

Companies are using DevOps to quickly respond to changing market dynamics and customer requirements.

How to increase and maintain team motivation

The best agile teams are built from people who work together as one unit, where each team member has both the technical and the personal skills to allow the team to become self-organized, cross-functional, and self-motivated. These are all big words that I hear in almost every agile project. Still, the criteria to make a fantastic agile team are practically impossible to achieve without one major factor: motivation towards a common goal.

How to Recognize and Hire Top QA / DevOps Engineers

With the rising demand for new services and technologies in the IT, manufacturing, healthcare, and financial sector, QA/ DevOps engineering has become the most important part of software companies. Below is a list of some characteristics to look for when interviewing a potential candidate.

QA Innovation – Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.

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

Helpful

NotHelpful