summaryrefslogtreecommitdiff
path: root/libparted/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-07-11 16:48:56 +0200
committerJim Meyering <meyering@redhat.com>2009-07-24 15:04:41 +0200
commitb7e20ae715d64adea363b90de9cb691a44574382 (patch)
treea0b92f06d18b9b4ef2f63f30c5553dd56f294c57 /libparted/tests
parent378c8892f2af1c4798f9933d2b2647b1d2e97b92 (diff)
downloadparted-b7e20ae715d64adea363b90de9cb691a44574382.tar.gz
label.c tests: don't skip dvh, now that it works; clean up
Diffstat (limited to 'libparted/tests')
-rw-r--r--libparted/tests/label.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/libparted/tests/label.c b/libparted/tests/label.c
index ed626f8..fb61e2e 100644
--- a/libparted/tests/label.c
+++ b/libparted/tests/label.c
@@ -8,6 +8,8 @@
#include "common.h"
#include "progname.h"
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
static char* temporary_disk;
static void
@@ -37,9 +39,9 @@ START_TEST (test_create_label)
for (type = ped_disk_type_get_next (NULL); type;
type = ped_disk_type_get_next (type)) {
fprintf (stderr, "create label: %s\n", type->name); fflush (stderr);
- if (strcmp (type->name, "sun") == 0
- || strcmp (type->name, "pc98") == 0)
- continue;
+ if (strcmp (type->name, "sun") == 0) continue;
+ if (strcmp (type->name, "pc98") == 0) continue;
+
if (!_implemented_disk_label (type->name))
continue;
@@ -66,12 +68,9 @@ START_TEST (test_probe_label)
fprintf (stderr, "PROBE label: %s\n", type->name); fflush (stderr);
if (!_implemented_disk_label (type->name))
continue;
- if (strcmp (type->name, "dvh") == 0
- || strcmp (type->name, "mac") == 0
- || strcmp (type->name, "pc98") == 0
- || strcmp (type->name, "sun") == 0
- )
- continue;
+ if (strcmp (type->name, "mac") == 0) continue;
+ if (strcmp (type->name, "pc98") == 0) continue;
+ if (strcmp (type->name, "sun") == 0) continue;
disk = _create_disk_label (dev, type);
ped_disk_destroy (disk);
@@ -81,9 +80,10 @@ START_TEST (test_probe_label)
fail_if (!probed,
"Failed to probe the just created label of type: %s",
type->name);
- fail_if (strcmp (probed->name, type->name) != 0,
- "Probe returned label of type: %s as type: %s",
- type->name, probed->name);
+ if (probed && !STREQ (probed->name, type->name))
+ fail_if (1,
+ "Probe returned label of type: %s as type: %s",
+ type->name, probed->name);
}
ped_device_destroy (dev);
}
@@ -104,13 +104,10 @@ START_TEST (test_read_label)
fprintf (stderr, "read label: %s\n", type->name); fflush (stderr);
if (!_implemented_disk_label (type->name))
continue;
- if (strcmp (type->name, "dvh") == 0
- || strcmp (type->name, "pc98") == 0 // segfault
- || strcmp (type->name, "sun") == 0 // failed assertion
- || strcmp (type->name, "mac") == 0 // unrecog label
- || strcmp (type->name, "loop") == 0 // FIXME unrecog label
- )
- continue;
+ if (strcmp (type->name, "pc98") == 0) continue; // segfault
+ if (strcmp (type->name, "sun") == 0) continue; // failed assertion
+ if (strcmp (type->name, "mac") == 0) continue; // unrecog label
+ if (strcmp (type->name, "loop") == 0) continue; // FIXME unrecog label
disk = _create_disk_label (dev, type);
ped_disk_destroy (disk);
@@ -120,9 +117,10 @@ START_TEST (test_read_label)
fail_if (!disk,
"Failed to read the just created label of type: %s",
type->name);
- fail_if (strcmp (disk->type->name, type->name) != 0,
- "Read returned label of type: %s as type: %s",
- type->name, disk->type->name);
+ if (disk && !STREQ (disk->type->name, type->name))
+ fail_if (1,
+ "Read returned label of type: %s as type: %s",
+ type->name, disk->type->name);
ped_disk_destroy (disk);
}
@@ -138,8 +136,6 @@ START_TEST (test_clone_label)
return;
PedDiskType* type;
- PedDisk* clone;
- PedDisk* disk;
for (type = ped_disk_type_get_next (NULL); type;
type = ped_disk_type_get_next (type)) {
@@ -149,17 +145,16 @@ START_TEST (test_clone_label)
/* FIXME: skip this test temporarily, while we wait
for someone to find the cycles to fix the bug. */
- if (strcmp (type->name, "dvh") == 0
- || strcmp (type->name, "mac") == 0 // overlapping
+ if (strcmp (type->name, "mac") == 0 // overlapping
|| strcmp (type->name, "pc98") == 0 // segfault
|| strcmp (type->name, "sun") == 0 // segfault
)
continue;
- disk = _create_disk_label (dev, type);
+ PedDisk* disk = _create_disk_label (dev, type);
/* Try to clone the disk label. */
- clone = ped_disk_duplicate (disk);
+ PedDisk* clone = ped_disk_duplicate (disk);
fail_if (!clone,
"Failed to clone the just created label of type: %s",
type->name);