aboutsummaryrefslogtreecommitdiff
path: root/tests/hd-geo-test.c
diff options
context:
space:
mode:
authorCornelia Huck <cohuck@redhat.com>2018-07-06 15:06:20 +0200
committerKevin Wolf <kwolf@redhat.com>2018-07-10 14:36:12 +0200
commit6703db131f832d6af58fa629be11c5efa5a6adb8 (patch)
treec9326a22cfbfab46dcd29c273ecc40665abd0332 /tests/hd-geo-test.c
parent75f4cd297922e1ac352625badf548d4a1bb96089 (diff)
Revert "block: Remove deprecated -drive geometry options"
This reverts commit a7aff6dd10b16b67e8b142d0c94c5d92c3fe88f6. Hold off removing this for one more QEMU release (current libvirt release still uses it.) Signed-off-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/hd-geo-test.c')
-rw-r--r--tests/hd-geo-test.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c
index ce665f1f83..24870b38f4 100644
--- a/tests/hd-geo-test.c
+++ b/tests/hd-geo-test.c
@@ -201,7 +201,7 @@ static void setup_mbr(int img_idx, MBRcontents mbr)
static int setup_ide(int argc, char *argv[], int argv_sz,
int ide_idx, const char *dev, int img_idx,
- MBRcontents mbr)
+ MBRcontents mbr, const char *opts)
{
char *s1, *s2, *s3;
@@ -216,7 +216,7 @@ static int setup_ide(int argc, char *argv[], int argv_sz,
s3 = g_strdup(",media=cdrom");
}
argc = append_arg(argc, argv, argv_sz,
- g_strdup_printf("%s%s%s", s1, s2, s3));
+ g_strdup_printf("%s%s%s%s", s1, s2, s3, opts));
g_free(s1);
g_free(s2);
g_free(s3);
@@ -260,7 +260,7 @@ static void test_ide_mbr(bool use_device, MBRcontents mbr)
for (i = 0; i < backend_last; i++) {
cur_ide[i] = &hd_chst[i][mbr];
dev = use_device ? (is_hd(cur_ide[i]) ? "ide-hd" : "ide-cd") : NULL;
- argc = setup_ide(argc, argv, ARGV_SIZE, i, dev, i, mbr);
+ argc = setup_ide(argc, argv, ARGV_SIZE, i, dev, i, mbr, "");
}
args = g_strjoinv(" ", argv);
qtest_start(args);
@@ -327,12 +327,16 @@ static void test_ide_drive_user(const char *dev, bool trans)
const CHST expected_chst = { secs / (4 * 32) , 4, 32, trans };
argc = setup_common(argv, ARGV_SIZE);
- opts = g_strdup_printf("%s,%scyls=%d,heads=%d,secs=%d",
- dev, trans ? "bios-chs-trans=lba," : "",
+ opts = g_strdup_printf("%s,%s%scyls=%d,heads=%d,secs=%d",
+ dev ?: "",
+ trans && dev ? "bios-chs-" : "",
+ trans ? "trans=lba," : "",
expected_chst.cyls, expected_chst.heads,
expected_chst.secs);
cur_ide[0] = &expected_chst;
- argc = setup_ide(argc, argv, ARGV_SIZE, 0, opts, backend_small, mbr_chs);
+ argc = setup_ide(argc, argv, ARGV_SIZE,
+ 0, dev ? opts : NULL, backend_small, mbr_chs,
+ dev ? "" : opts);
g_free(opts);
args = g_strjoinv(" ", argv);
qtest_start(args);
@@ -343,6 +347,22 @@ static void test_ide_drive_user(const char *dev, bool trans)
}
/*
+ * Test case: IDE device (if=ide) with explicit CHS
+ */
+static void test_ide_drive_user_chs(void)
+{
+ test_ide_drive_user(NULL, false);
+}
+
+/*
+ * Test case: IDE device (if=ide) with explicit CHS and translation
+ */
+static void test_ide_drive_user_chst(void)
+{
+ test_ide_drive_user(NULL, true);
+}
+
+/*
* Test case: IDE device (if=none) with explicit CHS
*/
static void test_ide_device_user_chs(void)
@@ -372,7 +392,8 @@ static void test_ide_drive_cd_0(void)
for (i = 0; i <= backend_empty; i++) {
ide_idx = backend_empty - i;
cur_ide[ide_idx] = &hd_chst[i][mbr_blank];
- argc = setup_ide(argc, argv, ARGV_SIZE, ide_idx, NULL, i, mbr_blank);
+ argc = setup_ide(argc, argv, ARGV_SIZE,
+ ide_idx, NULL, i, mbr_blank, "");
}
args = g_strjoinv(" ", argv);
qtest_start(args);
@@ -401,6 +422,8 @@ int main(int argc, char **argv)
qtest_add_func("hd-geo/ide/drive/mbr/blank", test_ide_drive_mbr_blank);
qtest_add_func("hd-geo/ide/drive/mbr/lba", test_ide_drive_mbr_lba);
qtest_add_func("hd-geo/ide/drive/mbr/chs", test_ide_drive_mbr_chs);
+ qtest_add_func("hd-geo/ide/drive/user/chs", test_ide_drive_user_chs);
+ qtest_add_func("hd-geo/ide/drive/user/chst", test_ide_drive_user_chst);
qtest_add_func("hd-geo/ide/drive/cd_0", test_ide_drive_cd_0);
qtest_add_func("hd-geo/ide/device/mbr/blank", test_ide_device_mbr_blank);
qtest_add_func("hd-geo/ide/device/mbr/lba", test_ide_device_mbr_lba);