Skip to content

Commit

Permalink
tests/x86: Use 'pc' machine type for old hardware tests
Browse files Browse the repository at this point in the history
For tests that rely on old hardware, e.g. floppies or IDE drives,
explicitly select the 'pc' machine type.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
  • Loading branch information
dagrh authored and huth committed Feb 21, 2022
1 parent e670f6d commit fedcc37
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/qtest/fdc-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ int main(int argc, char **argv)
/* Run the tests */
g_test_init(&argc, &argv, NULL);

qtest_start("-device floppy,id=floppy0");
qtest_start("-machine pc -device floppy,id=floppy0");
qtest_irq_intercept_in(global_qtest, "ioapic");
qtest_add_func("/fdc/cmos", test_cmos);
qtest_add_func("/fdc/no_media_on_start", test_no_media_on_start);
Expand Down
12 changes: 9 additions & 3 deletions tests/qtest/hd-geo-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,15 @@ static int append_arg(int argc, char *argv[], int argv_sz, char *arg)

static int setup_common(char *argv[], int argv_sz)
{
int new_argc;
memset(cur_ide, 0, sizeof(cur_ide));
return append_arg(0, argv, argv_sz,
g_strdup("-nodefaults"));
new_argc = append_arg(0, argv, argv_sz,
g_strdup("-nodefaults"));
new_argc = append_arg(new_argc, argv, argv_sz,
g_strdup("-machine"));
new_argc = append_arg(new_argc, argv, argv_sz,
g_strdup("pc"));
return new_argc;
}

static void setup_mbr(int img_idx, MBRcontents mbr)
Expand Down Expand Up @@ -697,7 +703,7 @@ static void test_override(TestArgs *args, CHSResult expected[])

joined_args = g_strjoinv(" ", args->argv);

qts = qtest_init(joined_args);
qts = qtest_initf("-machine pc %s", joined_args);
fw_cfg = pc_fw_cfg_init(qts);

read_bootdevices(fw_cfg, expected);
Expand Down
2 changes: 1 addition & 1 deletion tests/qtest/i440fx-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static QPCIBus *test_start_get_bus(const TestData *s)
{
char *cmdline;

cmdline = g_strdup_printf("-smp %d", s->num_cpus);
cmdline = g_strdup_printf("-machine pc -smp %d", s->num_cpus);
qtest_start(cmdline);
g_free(cmdline);
return qpci_new_pc(global_qtest, NULL);
Expand Down
3 changes: 2 additions & 1 deletion tests/qtest/ide-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,11 @@ static char debug_path[] = "/tmp/qtest-blkdebug.XXXXXX";
static QTestState *ide_test_start(const char *cmdline_fmt, ...)
{
QTestState *qts;
g_autofree char *full_fmt = g_strdup_printf("-machine pc %s", cmdline_fmt);
va_list ap;

va_start(ap, cmdline_fmt);
qts = qtest_vinitf(cmdline_fmt, ap);
qts = qtest_vinitf(full_fmt, ap);
va_end(ap);

pc_alloc_init(&guest_malloc, qts, 0);
Expand Down

0 comments on commit fedcc37

Please sign in to comment.