How to use _run_boottool_exit_status method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...74 '''75 Runs a boottool command, return its output76 '''77 return self._run_boottool_cmd(*options).stdout78 def _run_boottool_exit_status(self, *options):79 '''80 Runs a boottool command, return its exit status81 '''82 return self._run_boottool_cmd(*options).exit_status83 def get_bootloader(self):84 """85 Get the bootloader name that is detected on this machine86 :return: name of detected bootloader87 """88 return self._run_boottool_stdout('--bootloader-probe').strip()89 get_type = get_bootloader90 def get_architecture(self):91 '''92 Get the system architecture93 '''94 return self._run_boottool_stdout('--arch-probe').strip()95 arch_probe = get_architecture96 def get_titles(self):97 """98 Returns a list of boot entries titles.99 """100 return [entry.get('title', '')101 for entry in self.get_entries().itervalues()]102 def get_default_index(self):103 """104 Return an int with the # of the default bootloader entry.105 """106 return int(self._run_boottool_stdout('--default').strip())107 get_default = get_default_index108 def set_default_by_index(self, index):109 '''110 Sets the given entry number to be the default on every next boot111 To set a default only for the next boot, use boot_once() instead.112 :param index: entry index number to set as the default.113 '''114 if self._host().job:115 self._host().job.last_boot_tag = None116 return self._run_boottool_exit_status('--set-default=%s' %117 utils.sh_escape(str(index)))118 set_default = set_default_by_index119 def get_default_title(self):120 '''121 Get the default entry title.122 :return: a string of the default entry title.123 '''124 default = self.get_default_index()125 entry = self.get_entry(default)126 if entry.has_key('title'):127 return entry['title']128 elif 'label' in entry:129 return entry['label']130 def get_entry(self, entry):131 """132 Get a single bootloader entry information.133 :param entry: entry index134 :return: a dictionary of key->value where key is the type of entry135 information (ex. 'title', 'args', 'kernel', etc) and value136 is the value for that piece of information.137 """138 output = self._run_boottool_stdout('--info=%s' % entry).strip()139 return parse_entry(output, ":")140 def get_entries(self):141 """142 Get all entries information.143 :return: a dictionary of index -> entry where entry is a dictionary144 of entry information as described for get_entry().145 """146 raw = "\n" + self._run_boottool_stdout('--info=all')147 entries = {}148 for entry_str in raw.split("\nindex"):149 if len(entry_str.strip()) == 0:150 continue151 entry = parse_entry("index" + entry_str, ":")152 entries[entry["index"]] = entry153 return entries154 def add_args(self, kernel, args):155 """156 Add cmdline arguments for the specified kernel.157 :param kernel: can be a position number (index) or title158 :param args: argument to be added to the current list of args159 """160 return self._run_boottool_exit_status('--update-kernel=%s' %161 utils.sh_escape(str(kernel)),162 '--args=%s' %163 utils.sh_escape(args))164 def remove_args(self, kernel, args):165 """166 Removes specified cmdline arguments.167 :param kernel: can be a position number (index) or title168 :param args: argument to be removed of the current list of args169 """170 return self._run_boottool_exit_status('--update-kernel=%s' %171 utils.sh_escape(str(kernel)),172 '--remove-args=%s' %173 utils.sh_escape(args))174 def add_kernel(self, path, title='autoserv', root=None, args=None,175 initrd=None, default=False, position='end'):176 """177 Add a kernel entry to the bootloader (or replace if one exists178 already with the same title).179 :param path: string path to the kernel image file180 :param title: title of this entry in the bootloader config181 :param root: string of the root device182 :param args: string with cmdline args183 :param initrd: string path to the initrd file184 :param default: set to True to make this entry the default one185 (default False)186 :param position: where to insert the new entry in the bootloader187 config file (default 'end', other valid input 'start', or188 # of the title)189 """190 parameters = ['--add-kernel=%s' % path, '--title=%s' % title]191 if args:192 parameters.append('--args=%s' % args)193 if initrd:194 parameters.append('--initrd=%s' % initrd)195 if default:196 parameters.append('--make-default')197 return self._run_boottool_exit_status(parameters)198 def remove_kernel(self, kernel):199 parameters = ['--remove-kernel=%s' % kernel]200 return self._run_boottool_exit_status(parameters)201 def boot_once(self, title):202 if self._host().job:203 self._host().job.last_boot_tag = title204 title_opt = '--title=%s' % utils.sh_escape(title)205 return self._run_boottool_exit_status('--boot-once',...

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?