summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-05-21 16:03:31 +0100
committerRichard Jones <rjones@redhat.com>2009-05-21 16:03:31 +0100
commit2a042d9844ca203ccea28a5d533c18f2dbdfcfa7 (patch)
treef6768b773e312bc9c3dc885b25954c6172303283
parentd215800f10314dd5019d8d171961f8b97a35e817 (diff)
downloadlibguestfs-2a042d9844ca203ccea28a5d533c18f2dbdfcfa7.tar.gz
libguestfs-2a042d9844ca203ccea28a5d533c18f2dbdfcfa7.tar.xz
libguestfs-2a042d9844ca203ccea28a5d533c18f2dbdfcfa7.zip
Fix pvremove, vgremove, lvremove tests (RHBZ 502007).
-rwxr-xr-xsrc/generator.ml46
-rw-r--r--tests.c134
2 files changed, 150 insertions, 30 deletions
diff --git a/src/generator.ml b/src/generator.ml
index e6199a42..5eb61223 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -1662,22 +1662,25 @@ to find out what you can do.");
("lvremove", (RErr, [String "device"]), 77, [],
[InitEmpty, Always, TestOutputList (
- [["pvcreate"; "/dev/sda"];
- ["vgcreate"; "VG"; "/dev/sda"];
+ [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","];
+ ["pvcreate"; "/dev/sda1"];
+ ["vgcreate"; "VG"; "/dev/sda1"];
["lvcreate"; "LV1"; "VG"; "50"];
["lvcreate"; "LV2"; "VG"; "50"];
["lvremove"; "/dev/VG/LV1"];
["lvs"]], ["/dev/VG/LV2"]);
InitEmpty, Always, TestOutputList (
- [["pvcreate"; "/dev/sda"];
- ["vgcreate"; "VG"; "/dev/sda"];
+ [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","];
+ ["pvcreate"; "/dev/sda1"];
+ ["vgcreate"; "VG"; "/dev/sda1"];
["lvcreate"; "LV1"; "VG"; "50"];
["lvcreate"; "LV2"; "VG"; "50"];
["lvremove"; "/dev/VG"];
["lvs"]], []);
InitEmpty, Always, TestOutputList (
- [["pvcreate"; "/dev/sda"];
- ["vgcreate"; "VG"; "/dev/sda"];
+ [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","];
+ ["pvcreate"; "/dev/sda1"];
+ ["vgcreate"; "VG"; "/dev/sda1"];
["lvcreate"; "LV1"; "VG"; "50"];
["lvcreate"; "LV2"; "VG"; "50"];
["lvremove"; "/dev/VG"];
@@ -1692,15 +1695,17 @@ the VG name, C</dev/VG>.");
("vgremove", (RErr, [String "vgname"]), 78, [],
[InitEmpty, Always, TestOutputList (
- [["pvcreate"; "/dev/sda"];
- ["vgcreate"; "VG"; "/dev/sda"];
+ [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","];
+ ["pvcreate"; "/dev/sda1"];
+ ["vgcreate"; "VG"; "/dev/sda1"];
["lvcreate"; "LV1"; "VG"; "50"];
["lvcreate"; "LV2"; "VG"; "50"];
["vgremove"; "VG"];
["lvs"]], []);
InitEmpty, Always, TestOutputList (
- [["pvcreate"; "/dev/sda"];
- ["vgcreate"; "VG"; "/dev/sda"];
+ [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","];
+ ["pvcreate"; "/dev/sda1"];
+ ["vgcreate"; "VG"; "/dev/sda1"];
["lvcreate"; "LV1"; "VG"; "50"];
["lvcreate"; "LV2"; "VG"; "50"];
["vgremove"; "VG"];
@@ -1714,28 +1719,31 @@ group (if any).");
("pvremove", (RErr, [String "device"]), 79, [],
[InitEmpty, Always, TestOutputList (
- [["pvcreate"; "/dev/sda"];
- ["vgcreate"; "VG"; "/dev/sda"];
+ [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","];
+ ["pvcreate"; "/dev/sda1"];
+ ["vgcreate"; "VG"; "/dev/sda1"];
["lvcreate"; "LV1"; "VG"; "50"];
["lvcreate"; "LV2"; "VG"; "50"];
["vgremove"; "VG"];
- ["pvremove"; "/dev/sda"];
+ ["pvremove"; "/dev/sda1"];
["lvs"]], []);
InitEmpty, Always, TestOutputList (
- [["pvcreate"; "/dev/sda"];
- ["vgcreate"; "VG"; "/dev/sda"];
+ [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","];
+ ["pvcreate"; "/dev/sda1"];
+ ["vgcreate"; "VG"; "/dev/sda1"];
["lvcreate"; "LV1"; "VG"; "50"];
["lvcreate"; "LV2"; "VG"; "50"];
["vgremove"; "VG"];
- ["pvremove"; "/dev/sda"];
+ ["pvremove"; "/dev/sda1"];
["vgs"]], []);
InitEmpty, Always, TestOutputList (
- [["pvcreate"; "/dev/sda"];
- ["vgcreate"; "VG"; "/dev/sda"];
+ [["sfdisk"; "/dev/sda"; "0"; "0"; "0"; ","];
+ ["pvcreate"; "/dev/sda1"];
+ ["vgcreate"; "VG"; "/dev/sda1"];
["lvcreate"; "LV1"; "VG"; "50"];
["lvcreate"; "LV2"; "VG"; "50"];
["vgremove"; "VG"];
- ["pvremove"; "/dev/sda"];
+ ["pvremove"; "/dev/sda1"];
["pvs"]], [])],
"remove an LVM physical volume",
"\
diff --git a/tests.c b/tests.c
index a4e7d476..547575cd 100644
--- a/tests.c
+++ b/tests.c
@@ -2936,6 +2936,20 @@ static int test_pvremove_0 (void)
{
char device[] = "/dev/sda";
device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
r = guestfs_pvcreate (g, device);
@@ -2944,7 +2958,7 @@ static int test_pvremove_0 (void)
}
{
char volgroup[] = "VG";
- char physvols_0[] = "/dev/sda";
+ char physvols_0[] = "/dev/sda1";
physvols_0[5] = devchar;
char *physvols[] = {
physvols_0,
@@ -2983,7 +2997,7 @@ static int test_pvremove_0 (void)
return -1;
}
{
- char device[] = "/dev/sda";
+ char device[] = "/dev/sda1";
device[5] = devchar;
int r;
suppress_error = 0;
@@ -3040,6 +3054,20 @@ static int test_pvremove_1 (void)
{
char device[] = "/dev/sda";
device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
r = guestfs_pvcreate (g, device);
@@ -3048,7 +3076,7 @@ static int test_pvremove_1 (void)
}
{
char volgroup[] = "VG";
- char physvols_0[] = "/dev/sda";
+ char physvols_0[] = "/dev/sda1";
physvols_0[5] = devchar;
char *physvols[] = {
physvols_0,
@@ -3087,7 +3115,7 @@ static int test_pvremove_1 (void)
return -1;
}
{
- char device[] = "/dev/sda";
+ char device[] = "/dev/sda1";
device[5] = devchar;
int r;
suppress_error = 0;
@@ -3144,6 +3172,20 @@ static int test_pvremove_2 (void)
{
char device[] = "/dev/sda";
device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
r = guestfs_pvcreate (g, device);
@@ -3152,7 +3194,7 @@ static int test_pvremove_2 (void)
}
{
char volgroup[] = "VG";
- char physvols_0[] = "/dev/sda";
+ char physvols_0[] = "/dev/sda1";
physvols_0[5] = devchar;
char *physvols[] = {
physvols_0,
@@ -3191,7 +3233,7 @@ static int test_pvremove_2 (void)
return -1;
}
{
- char device[] = "/dev/sda";
+ char device[] = "/dev/sda1";
device[5] = devchar;
int r;
suppress_error = 0;
@@ -3248,6 +3290,20 @@ static int test_vgremove_0 (void)
{
char device[] = "/dev/sda";
device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
r = guestfs_pvcreate (g, device);
@@ -3256,7 +3312,7 @@ static int test_vgremove_0 (void)
}
{
char volgroup[] = "VG";
- char physvols_0[] = "/dev/sda";
+ char physvols_0[] = "/dev/sda1";
physvols_0[5] = devchar;
char *physvols[] = {
physvols_0,
@@ -3343,6 +3399,20 @@ static int test_vgremove_1 (void)
{
char device[] = "/dev/sda";
device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
r = guestfs_pvcreate (g, device);
@@ -3351,7 +3421,7 @@ static int test_vgremove_1 (void)
}
{
char volgroup[] = "VG";
- char physvols_0[] = "/dev/sda";
+ char physvols_0[] = "/dev/sda1";
physvols_0[5] = devchar;
char *physvols[] = {
physvols_0,
@@ -3438,6 +3508,20 @@ static int test_lvremove_0 (void)
{
char device[] = "/dev/sda";
device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
r = guestfs_pvcreate (g, device);
@@ -3446,7 +3530,7 @@ static int test_lvremove_0 (void)
}
{
char volgroup[] = "VG";
- char physvols_0[] = "/dev/sda";
+ char physvols_0[] = "/dev/sda1";
physvols_0[5] = devchar;
char *physvols[] = {
physvols_0,
@@ -3545,6 +3629,20 @@ static int test_lvremove_1 (void)
{
char device[] = "/dev/sda";
device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
r = guestfs_pvcreate (g, device);
@@ -3553,7 +3651,7 @@ static int test_lvremove_1 (void)
}
{
char volgroup[] = "VG";
- char physvols_0[] = "/dev/sda";
+ char physvols_0[] = "/dev/sda1";
physvols_0[5] = devchar;
char *physvols[] = {
physvols_0,
@@ -3640,6 +3738,20 @@ static int test_lvremove_2 (void)
{
char device[] = "/dev/sda";
device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
r = guestfs_pvcreate (g, device);
@@ -3648,7 +3760,7 @@ static int test_lvremove_2 (void)
}
{
char volgroup[] = "VG";
- char physvols_0[] = "/dev/sda";
+ char physvols_0[] = "/dev/sda1";
physvols_0[5] = devchar;
char *physvols[] = {
physvols_0,