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

21 #include "libqtest-single.h"
25 #include "qapi/qobject-input-visitor.h"
26 #include "qapi/qapi-visit-machine.h"
27 #include "qapi/qapi-visit-qom.h"
28 #include "libqos/libqos-malloc.h"
40 * This function firstly starts QEMU with "-machine none" option,
59 qtest_start("-machine none"); in qos_set_machines_devices_available()
60 response = qmp("{ 'execute': 'query-machines' }"); in qos_set_machines_devices_available()
74 response = qmp("{'execute': 'qom-list-types'," in qos_set_machines_devices_available()
89 static void restart_qemu_or_continue(char *path) in restart_qemu_or_continue() argument
92 qos_printf("Run QEMU with: '%s'\n", path); in restart_qemu_or_continue()
100 if (g_strcmp0(old_path, path)) { in restart_qemu_or_continue()
103 old_path = g_strdup(path); in restart_qemu_or_continue()
104 qtest_start(path); in restart_qemu_or_continue()
117 /* The argument to run_one_test, which is the test function that is registered
119 * line (before it is modified by the test's "before" function), the remaining
120 * items are node names forming the path to the test node.
136 * walks the path invoking all constructors and
139 * Once the test is reached, its function is executed.
143 * that after execution they can be safely free'd. The test's
144 * ->before callback is also welcome to use g_test_queue_destroy.
149 * the test, and the remaining elements represent the actual objects
153 * 1) @before test function as defined in the given QOSGraphTestOptions
157 * 4) start test
164 char **path = (char **) arg; in run_one_test() local
165 GString *cmd_line = g_string_new(path[0]); in run_one_test()
168 /* Before test */ in run_one_test()
169 current_path = path; in run_one_test()
170 test_node = qos_graph_get_node(path[(g_strv_length(path) - 1)]); in run_one_test()
171 test_arg = test_node->u.test.arg; in run_one_test()
172 if (test_node->u.test.before) { in run_one_test()
173 test_arg = test_node->u.test.before(cmd_line, test_arg); in run_one_test()
176 restart_qemu_or_continue(cmd_line->str); in run_one_test()
180 test_node->u.test.function(obj, test_arg, alloc); in run_one_test()
185 const gchar *path = arg; in subprocess_run_one_test() local
186 g_test_trap_subprocess(path, 180 * G_USEC_PER_SEC, in subprocess_run_one_test()
199 * in this function, 2 path will be built:
200 * path_str, a one-string path (ex "pc/i440FX-pcihost/...")
201 * path_vec, a string-array path (ex [0] = "pc", [1] = "i440FX-pcihost").
203 * path_str will be only used to build the test name, and won't need the
206 * path_vec is used to allocate all constructors of the path nodes.
210 * the node, (ex for "x86_64/pc" it will be "pc"), used to build the test
211 * path (see below). After it will contain the command line used to start
216 * and start QEMU with "-M pc". For this reason,
224 QOSGraphNode *path; in walk_path() local
236 char *node_name = orig_path->name, *path_str; in walk_path()
241 path = qos_graph_get_node(node_name); /* root */ in walk_path()
242 node_name = qos_graph_edge_get_dest(path->path_edge); /* machine name */ in walk_path()
248 path = qos_graph_get_node(node_name); in walk_path()
249 if (!path->path_edge) { in walk_path()
253 node_name = qos_graph_edge_get_dest(path->path_edge); in walk_path()
256 if (path->command_line && etype == QEDGE_CONSUMED_BY) { in walk_path()
257 g_string_append(cmd_line, path->command_line); in walk_path()
258 g_string_append(cmd_line, after_device_str->str); in walk_path()
262 path_vec[path_vec_size++] = qos_graph_edge_get_name(path->path_edge); in walk_path()
264 after_cmd = qos_graph_edge_get_after_cmd_line(path->path_edge); in walk_path()
265 after_device = qos_graph_edge_get_extra_device_opts(path->path_edge); in walk_path()
266 before_cmd = qos_graph_edge_get_before_cmd_line(path->path_edge); in walk_path()
267 edge = qos_graph_get_edge(path->name, node_name); in walk_path()
282 g_string_append(cmd_line, after_device_str->str); in walk_path()
285 g_string_append(cmd_line, cmd_line2->str); in walk_path()
289 * The path must not have the <arch>, qtest_add_data_func adds it. in walk_path()
299 if (path->u.test.subprocess) { in walk_path()
319 * - Initializes the glib test framework
320 * - Creates the graph by invoking the various _init constructors
321 * - Starts QEMU to mark the available devices
322 * - Walks the graph, and each path is added to
323 * the glib test framework (walk_path)
324 * - Runs the tests, calling allocate_object() and allocating the
325 * machine/drivers/test objects
326 * - Cleans up everything
333 qos_printf("qos_test running single test in subprocess\n"); in main()