forked from TrungNguyen1909/qemu-t8030
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Note that it launches two instances, as sharing memory is the purpose of ivshmem. Cc: Cam Macdonell <[email protected]> Cc: Marc-André Lureau <[email protected]> Signed-off-by: Andreas Färber <[email protected]> [ Remove Nahanni codename, add test to pci set - Marc-André ] Signed-off-by: Marc-André Lureau <[email protected]>
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* QTest testcase for ivshmem | ||
* | ||
* Copyright (c) 2014 SUSE LINUX Products GmbH | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
* See the COPYING file in the top-level directory. | ||
*/ | ||
|
||
#include <glib.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
#include "libqtest.h" | ||
#include "qemu/osdep.h" | ||
|
||
static char dev_shm_path[] = "/dev/shm/qtest.XXXXXX"; | ||
|
||
/* Tests only initialization so far. TODO: Replace with functional tests */ | ||
static void nop(void) | ||
{ | ||
} | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
QTestState *s1, *s2; | ||
char *cmd; | ||
int ret, fd; | ||
|
||
g_test_init(&argc, &argv, NULL); | ||
qtest_add_func("/ivshmem/nop", nop); | ||
|
||
fd = mkstemp(dev_shm_path); | ||
g_assert(fd >= 0); | ||
close(fd); | ||
unlink(dev_shm_path); | ||
|
||
cmd = g_strdup_printf("-device ivshmem,shm=%s,size=1M", &dev_shm_path[9]); | ||
s1 = qtest_start(cmd); | ||
s2 = qtest_start(cmd); | ||
g_free(cmd); | ||
|
||
ret = g_test_run(); | ||
|
||
qtest_quit(s1); | ||
qtest_quit(s2); | ||
|
||
unlink(dev_shm_path); | ||
|
||
return ret; | ||
} |