* See the COPYING file in the top-level directory.
*/
-#include <glib.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/mman.h>
-#include <stdlib.h>
+#include "qemu/osdep.h"
#include "libqtest.h"
#include "libqos/pci.h"
#define BROKEN 1
-#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
-
typedef struct TestData
{
int num_cpus;
cmdline = g_strdup_printf("-smp %d", s->num_cpus);
qtest_start(cmdline);
g_free(cmdline);
- return qpci_init_pc();
+ return qpci_new_pc(global_qtest, NULL);
}
static void test_i440fx_defaults(gconstpointer opaque)
/* 3.2.26 */
g_assert_cmpint(qpci_config_readb(dev, 0x93), ==, 0x00); /* TRC */
+ g_free(dev);
+ qpci_free_pc(bus);
qtest_end();
}
uint32_t size = end - start + 1;
uint8_t *data;
- data = g_malloc0(size);
+ data = g_malloc(size);
memset(data, value, size);
memwrite(start, data, size);
/* Verify the area is not our new mask */
g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x82));
}
+
+ g_free(dev);
+ qpci_free_pc(bus);
qtest_end();
}
g_assert(fw_pathname != NULL);
/* Better hope the user didn't put metacharacters in TMPDIR and co. */
- cmdline = g_strdup_printf("-S %s %s",
- fixture->is_bios ? "-bios" : "-pflash",
+ cmdline = g_strdup_printf("-S %s%s", fixture->is_bios
+ ? "-bios "
+ : "-drive if=pflash,format=raw,file=",
fw_pathname);
g_test_message("qemu cmdline: %s", cmdline);
qtest_start(cmdline);
g_free(cmdline);
- /* Qemu has loaded the firmware (because qtest_start() only returns after
+ /* QEMU has loaded the firmware (because qtest_start() only returns after
* the QMP handshake completes). We must unlink the firmware blob right
* here, because any assertion firing below would leak it in the
* filesystem. This is also the reason why we recreate the blob every time
void (*setup_fixture)(FirmwareTestFixture *f,
gconstpointer test_data))
{
- g_test_add(testpath, FirmwareTestFixture, NULL, setup_fixture,
- test_i440fx_firmware, NULL);
+ qtest_add(testpath, FirmwareTestFixture, NULL, setup_fixture,
+ test_i440fx_firmware, NULL);
}
static void request_bios(FirmwareTestFixture *fixture,
int main(int argc, char **argv)
{
TestData data;
- int ret;
g_test_init(&argc, &argv, NULL);
data.num_cpus = 1;
- g_test_add_data_func("/i440fx/defaults", &data, test_i440fx_defaults);
- g_test_add_data_func("/i440fx/pam", &data, test_i440fx_pam);
- add_firmware_test("/i440fx/firmware/bios", request_bios);
- add_firmware_test("/i440fx/firmware/pflash", request_pflash);
+ qtest_add_data_func("i440fx/defaults", &data, test_i440fx_defaults);
+ qtest_add_data_func("i440fx/pam", &data, test_i440fx_pam);
+ add_firmware_test("i440fx/firmware/bios", request_bios);
+ add_firmware_test("i440fx/firmware/pflash", request_pflash);
- ret = g_test_run();
- return ret;
+ return g_test_run();
}