[Parted-commits] GNU Parted Official Repository: Changes to
'stable-1.8.x'
Otavio Salvador
otavio at alioth.debian.org
Mon Apr 23 15:38:42 UTC 2007
libparted/tests/label.c | 39 +++++++++++++++++++++++++++++++++++++++
parted/parted.c | 7 +++----
2 files changed, 42 insertions(+), 4 deletions(-)
New commits:
commit 6f04f317301b505079f492d57977f46c1e745ed2
Author: Debarshi Ray <rishi at gnu.org>
Date: Sat Apr 21 00:59:15 2007 +0530
[tests] New test for probing of disk labels.
(cherry picked from commit b40a7a0976280fc861d5afa7563b28f561818b55)
diff --git a/libparted/tests/label.c b/libparted/tests/label.c
index 9338de5..898dbe3 100644
--- a/libparted/tests/label.c
+++ b/libparted/tests/label.c
@@ -52,6 +52,38 @@ START_TEST (test_create_label)
}
END_TEST
+/* TEST: Probe the disk label of a loop device. */
+START_TEST (test_probe_label)
+{
+ PedDevice* dev = ped_device_get (temporary_disk);
+ if (dev == NULL)
+ return;
+
+ PedDiskType* probed;
+ PedDiskType* type;
+ PedDisk* disk;
+
+ for (type = ped_disk_type_get_next (NULL); type;
+ type = ped_disk_type_get_next (type)) {
+ if (!_implemented_disk_label (type->name))
+ continue;
+
+ disk = _create_disk_label (dev, type);
+ ped_disk_destroy (disk);
+
+ /* Try to probe the disk label. */
+ probed = ped_disk_probe (dev);
+ 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);
+ }
+ ped_device_destroy (dev);
+}
+END_TEST
+
/* TEST: Clone the disk label of a loop device. */
START_TEST (test_clone_label)
{
@@ -89,6 +121,7 @@ main (void)
int number_failed;
Suite* suite = suite_create ("Disk Label");
TCase* tcase_basic = tcase_create ("Create");
+ TCase* tcase_probe = tcase_create ("Probe");
TCase* tcase_clone = tcase_create ("Clone");
/* Fail when an exception is raised */
@@ -100,6 +133,12 @@ main (void)
tcase_set_timeout (tcase_basic, 0);
suite_add_tcase (suite, tcase_basic);
+ tcase_add_checked_fixture (tcase_probe, create_disk, destroy_disk);
+ tcase_add_test (tcase_probe, test_probe_label);
+ /* Disable timeout for this test. */
+ tcase_set_timeout (tcase_probe, 0);
+ suite_add_tcase (suite, tcase_probe);
+
tcase_add_checked_fixture (tcase_clone, create_disk, destroy_disk);
tcase_add_test (tcase_clone, test_clone_label);
/* Disable timeout for this test. */
commit 1cba5a2f1ebcae79d710f601b4bb1306d6fa5519
Author: Jim Meyering <jim at meyering.net>
Date: Sat Apr 21 18:59:43 2007 +0200
[PATCH] Avoid warning from -Wformat-security; tweak error diagnostic.
* parted/parted.c (_parse_options): Upon failure, output diagnostic
to stderr, not stdout. Use "program_name" value, not literal "parted".
Signed-off-by: Jim Meyering <jim at meyering.net>
(cherry picked from commit 3b93925f767ee1727898674a6e357b7572157dd8)
diff --git a/parted/parted.c b/parted/parted.c
index c4adde0..ff72dcd 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -97,9 +97,6 @@ int opt_machine_mode = 0;
int disk_is_modified = 0;
int is_toggle_mode = 0;
-static char* short_usage_msg = N_(
-"Usage: parted [-hlmsv] [DEVICE [COMMAND [PARAMETERS]]...]\n");
-
static char* number_msg = N_(
"NUMBER is the partition number used by Linux. On MS-DOS disk labels, the "
"primary partitions number from 1 to 4, logical partitions from 5 onwards.\n");
@@ -2317,7 +2314,9 @@ while (1)
}
if (wrong == 1) {
- printf (_(short_usage_msg));
+ fprintf (stderr,
+ _("Usage: %s [-hlmsv] [DEVICE [COMMAND [PARAMETERS]]...]\n"),
+ program_name);
return 0;
}
More information about the Parted-commits
mailing list