def callTool(self, args):
"""Call the raspbian-qemu tool with a check for a kept root.img."""
# Clean up any root images so we can assert whether it's created
# or not after the run.
if os.path.exists(self.ROOT_IMG):
os.unlink(self.ROOT_IMG)
cmd = [TOOL]
# Assume any time the trace function is set it's coverage and make
# sure to spawn the tool under coverage as well.
if sys.gettrace():
cmd = ["python3-coverage", "run", "--parallel-mode"] + cmd
subprocess.check_output(cmd + args, stderr=subprocess.STDOUT)
# Now make sure root.img was created if request but not if it wasn't.
# If created correctly, check its state and then clean it up.
keep_root = "--keep-root" in args
self.assertEqual(os.path.exists(self.ROOT_IMG), keep_root)
if keep_root:
self.assertOnlyUserReadable(self.ROOT_IMG)
os.unlink(self.ROOT_IMG)
评论列表
文章目录