Lines Matching +full:test +full:- +full:path

1 # Test class and utilities for functional tests
5 # Original Author (Avocado-based tests):
12 # later. See the COPYING file in the top-level directory.
16 import os.path
20 """ looks up the full path for @tool, returns None if not found
23 paths=os.getenv('PATH')
24 for p in paths.split(os.path.pathsep):
25 p = os.path.join(p, tool)
30 def is_readable_executable_file(path): argument
31 return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
33 # @test: functional test to fail if @failure is seen
35 # @success: a non-None string to look for
36 # @failure: a string to look for that triggers test failure, or None
48 # If @failure is seen, then mark @test as failed
49 def _console_read_line_until_match(test, vm, success, failure): argument
56 test.fail(
67 test.fail(
81 def _console_interaction(test, success_message, failure_message, argument
87 vm = test.vm
89 test.log.debug(
116 if _console_read_line_until_match(test, vm,
121 def interrupt_interactive_console_until_pattern(test, success_message, argument
136 :param test: a test containing a VM that will have its console
138 :type test: :class:`qemu_test.QemuSystemTest`
139 :param success_message: if this message appears, test succeeds
140 :param failure_message: if this message appears, test fails
145 _console_interaction(test, success_message, failure_message,
148 def wait_for_console_pattern(test, success_message, failure_message=None, argument
153 :param test: a test containing a VM that will have its console
155 :type test: :class:`qemu_test.QemuSystemTest`
156 :param success_message: if this message appears, test succeeds
157 :param failure_message: if this message appears, test fails
160 _console_interaction(test, success_message, failure_message, None, vm=vm)
162 def exec_command(test, command): argument
167 :param test: a test containing a VM.
168 :type test: :class:`qemu_test.QemuSystemTest`
172 _console_interaction(test, None, None, command + '\r')
174 def exec_command_and_wait_for_pattern(test, command, argument
179 content. Mark the test as failed if failure_message is found instead.
181 :param test: a test containing a VM that will have its console
183 :type test: :class:`qemu_test.QemuSystemTest`
185 :param success_message: if this message appears, test succeeds
186 :param failure_message: if this message appears, test fails
189 _console_interaction(test, success_message, failure_message, command + '\r')
191 def get_qemu_img(test): argument
192 test.log.debug('Looking for and selecting a qemu-img binary')
194 # If qemu-img has been built, use it, otherwise the system wide one
196 qemu_img = test.build_file('qemu-img')
197 if os.path.exists(qemu_img):
199 qemu_img = which('qemu-img')
202 test.skipTest(f"qemu-img not found in build dir or '$PATH'")