summaryrefslogtreecommitdiffstats
path: root/tests/c-api/test-add-drive-opts.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-01-10 16:51:36 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-01-10 16:51:36 +0000
commit39a10c9fabcf7646b3dcb183c22ddba577d2a075 (patch)
treeab2c948a29abaf6db08b4dc1b4392073322a2cb7 /tests/c-api/test-add-drive-opts.c
parent01e717b3c141c509a7200b0a6c560f75815c08f2 (diff)
downloadlibguestfs-39a10c9fabcf7646b3dcb183c22ddba577d2a075.tar.gz
libguestfs-39a10c9fabcf7646b3dcb183c22ddba577d2a075.tar.xz
libguestfs-39a10c9fabcf7646b3dcb183c22ddba577d2a075.zip
Allow /dev/null to be added multiple times.
Change the test for duplicate drives so that you're allowed to add /dev/null multiple times. This corresponds to traditional usage. This amends commit be47b66c3033105a2b880dbc10bfc2b163b7eafe.
Diffstat (limited to 'tests/c-api/test-add-drive-opts.c')
-rw-r--r--tests/c-api/test-add-drive-opts.c32
1 files changed, 3 insertions, 29 deletions
diff --git a/tests/c-api/test-add-drive-opts.c b/tests/c-api/test-add-drive-opts.c
index 0494450e..897c6fac 100644
--- a/tests/c-api/test-add-drive-opts.c
+++ b/tests/c-api/test-add-drive-opts.c
@@ -30,28 +30,6 @@ main (int argc, char *argv[])
{
guestfs_h *g;
int r;
- FILE *fp;
-
- fp = fopen ("test1.img", "w");
- if (fp == NULL) {
- perror ("test1.img");
- exit (EXIT_FAILURE);
- }
- fclose (fp);
-
- fp = fopen ("test2.img", "w");
- if (fp == NULL) {
- perror ("test2.img");
- exit (EXIT_FAILURE);
- }
- fclose (fp);
-
- fp = fopen ("test3.img", "w");
- if (fp == NULL) {
- perror ("test3.img");
- exit (EXIT_FAILURE);
- }
- fclose (fp);
g = guestfs_create ();
if (g == NULL) {
@@ -59,15 +37,15 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
- r = guestfs_add_drive_opts (g, "test1.img", -1);
+ r = guestfs_add_drive_opts (g, "/dev/null", -1);
if (r == -1)
exit (EXIT_FAILURE);
- r = guestfs_add_drive_opts (g, "test2.img",
+ r = guestfs_add_drive_opts (g, "/dev/null",
GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
-1);
if (r == -1)
exit (EXIT_FAILURE);
- r = guestfs_add_drive_opts (g, "test3.img",
+ r = guestfs_add_drive_opts (g, "/dev/null",
GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
-1);
@@ -76,9 +54,5 @@ main (int argc, char *argv[])
guestfs_close (g);
- unlink ("test1.img");
- unlink ("test2.img");
- unlink ("test3.img");
-
exit (EXIT_SUCCESS);
}