kunit_kernel.py (243180f5924ed27ea417db39feb7f9691777688e) kunit_kernel.py (d992880b3d265597c5a16af3775257999492e957)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Runs UML kernel, collects output, and handles errors.
4#
5# Copyright (C) 2019, Google LLC.
6# Author: Felix Guo <felixguoxiuping@gmail.com>
7# Author: Brendan Higgins <brendanhiggins@google.com>
8

--- 189 unchanged lines hidden (view full) ---

198 self._ops.make_allyesconfig(build_dir, make_options)
199 self._ops.make_olddefconfig(build_dir, make_options)
200 self._ops.make(jobs, build_dir, make_options)
201 except (ConfigError, BuildError) as e:
202 logging.error(e)
203 return False
204 return self.validate_config(build_dir)
205
1# SPDX-License-Identifier: GPL-2.0
2#
3# Runs UML kernel, collects output, and handles errors.
4#
5# Copyright (C) 2019, Google LLC.
6# Author: Felix Guo <felixguoxiuping@gmail.com>
7# Author: Brendan Higgins <brendanhiggins@google.com>
8

--- 189 unchanged lines hidden (view full) ---

198 self._ops.make_allyesconfig(build_dir, make_options)
199 self._ops.make_olddefconfig(build_dir, make_options)
200 self._ops.make(jobs, build_dir, make_options)
201 except (ConfigError, BuildError) as e:
202 logging.error(e)
203 return False
204 return self.validate_config(build_dir)
205
206 def run_kernel(self, args=[], build_dir='', timeout=None) -> Iterator[str]:
206 def run_kernel(self, args=[], build_dir='', filter_glob='', timeout=None) -> Iterator[str]:
207 args.extend(['mem=1G', 'console=tty'])
207 args.extend(['mem=1G', 'console=tty'])
208 if filter_glob:
209 args.append('kunit.filter_glob='+filter_glob)
208 self._ops.linux_bin(args, timeout, build_dir)
209 outfile = get_outfile_path(build_dir)
210 subprocess.call(['stty', 'sane'])
211 with open(outfile, 'r') as file:
212 for line in file:
213 yield line
214
215 def signal_handler(self, sig, frame) -> None:
216 logging.error('Build interruption occurred. Cleaning console.')
217 subprocess.call(['stty', 'sane'])
210 self._ops.linux_bin(args, timeout, build_dir)
211 outfile = get_outfile_path(build_dir)
212 subprocess.call(['stty', 'sane'])
213 with open(outfile, 'r') as file:
214 for line in file:
215 yield line
216
217 def signal_handler(self, sig, frame) -> None:
218 logging.error('Build interruption occurred. Cleaning console.')
219 subprocess.call(['stty', 'sane'])