[Libguestfs] [PATCH 1/3] tests: Increase the size of the /dev/sda and /dev/sdb test devices.
Richard W.M. Jones
rjones at redhat.com
Wed Feb 3 17:24:24 UTC 2016
On Wed, Feb 03, 2016 at 05:18:47PM +0000, Richard W.M. Jones wrote:
> Previously these were rather small - just 500 MB. This is too small
> to create a btrfs device on aarch64 (where page size may be 64K), and
> barely enough even on x86-64. This change makes both these devices
> 10 GB, and adjusts a few tests so they continue to pass.
> ---
> docs/guestfs-hacking.pod | 4 ++--
> generator/actions.ml | 17 +++++++++++------
> tests/c-api/tests-main.c | 6 +++---
> 3 files changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod
> index 32f901d..3ab1981 100644
> --- a/docs/guestfs-hacking.pod
> +++ b/docs/guestfs-hacking.pod
> @@ -105,11 +105,11 @@ The test environment has 4 block devices:
>
> =over 4
>
> -=item F</dev/sda> 500MB
> +=item F</dev/sda> 1GB
>
> General block device for testing.
>
> -=item F</dev/sdb> 500MB
> +=item F</dev/sdb> 1GB
Sorry, just realized I didn't update the documentation correctly.
These should obviously say 10GB.
Rich.
> F</dev/sdb1> is an ext2 filesystem used for testing
> filesystem write operations.
> diff --git a/generator/actions.ml b/generator/actions.ml
> index 4078082..881ec4e 100644
> --- a/generator/actions.ml
> +++ b/generator/actions.ml
> @@ -4779,7 +4779,8 @@ C<blocksize> option of C<guestfs_mkfs>." };
> proc_nr = Some 62;
> tests = [
> InitEmpty, Always, TestResult (
> - [["blockdev_getsz"; "/dev/sda"]], "ret == 1024000"), []
> + [["blockdev_getsz"; "/dev/sda"]],
> + "ret == INT64_C(10)*1024*1024*1024/512"), []
> ];
> shortdesc = "get total size of device in 512-byte sectors";
> longdesc = "\
> @@ -4798,7 +4799,8 @@ This uses the L<blockdev(8)> command." };
> proc_nr = Some 63;
> tests = [
> InitEmpty, Always, TestResult (
> - [["blockdev_getsize64"; "/dev/sda"]], "ret == UINT64_C (524288000)"), []
> + [["blockdev_getsize64"; "/dev/sda"]],
> + "ret == INT64_C (10)*1024*1024*1024"), []
> ];
> shortdesc = "get total size of device in bytes";
> longdesc = "\
> @@ -7395,13 +7397,16 @@ and C<guestfs_setcon>" };
> ["write"; "/new"; "new file contents"];
> ["cat"; "/new"]], "new file contents"), [];
> InitEmpty, Always, TestRun (
> - [["part_disk"; "/dev/sda"; "mbr"];
> + [["part_init"; "/dev/sda"; "mbr"];
> + ["part_add"; "/dev/sda"; "p"; "64"; "204799"];
> ["mkfs_b"; "vfat"; "32768"; "/dev/sda1"]]), [];
> InitEmpty, Always, TestLastFail (
> - [["part_disk"; "/dev/sda"; "mbr"];
> + [["part_init"; "/dev/sda"; "mbr"];
> + ["part_add"; "/dev/sda"; "p"; "64"; "204799"];
> ["mkfs_b"; "vfat"; "32769"; "/dev/sda1"]]), [];
> InitEmpty, Always, TestLastFail (
> - [["part_disk"; "/dev/sda"; "mbr"];
> + [["part_init"; "/dev/sda"; "mbr"];
> + ["part_add"; "/dev/sda"; "p"; "64"; "204799"];
> ["mkfs_b"; "vfat"; "33280"; "/dev/sda1"]]), [];
> InitEmpty, IfAvailable "ntfsprogs", TestRun (
> [["part_disk"; "/dev/sda"; "mbr"];
> @@ -9868,7 +9873,7 @@ device is stopped, but it is not destroyed or zeroed." };
> "check_hash (ret, \"PART_ENTRY_NUMBER\", \"1\") == 0 && "^
> "check_hash (ret, \"PART_ENTRY_TYPE\", \"0x83\") == 0 && "^
> "check_hash (ret, \"PART_ENTRY_OFFSET\", \"128\") == 0 && "^
> - "check_hash (ret, \"PART_ENTRY_SIZE\", \"1023745\") == 0"), [];
> + "check_hash (ret, \"PART_ENTRY_SIZE\", \"20971265\") == 0"), [];
> ];
> shortdesc = "print block device attributes";
> longdesc = "\
> diff --git a/tests/c-api/tests-main.c b/tests/c-api/tests-main.c
> index feec7bc..517d8a3 100644
> --- a/tests/c-api/tests-main.c
> +++ b/tests/c-api/tests-main.c
> @@ -440,17 +440,17 @@ create_handle (void)
> exit (EXIT_FAILURE);
> }
>
> - if (guestfs_add_drive_scratch (g, 524288000, -1) == -1) {
> + if (guestfs_add_drive_scratch (g, INT64_C(10)*1024*1024*1024, -1) == -1) {
> printf ("FAIL: guestfs_add_drive_scratch\n");
> exit (EXIT_FAILURE);
> }
>
> - if (guestfs_add_drive_scratch (g, 524288000, -1) == -1) {
> + if (guestfs_add_drive_scratch (g, INT64_C(10)*1024*1024*1024, -1) == -1) {
> printf ("FAIL: guestfs_add_drive_scratch\n");
> exit (EXIT_FAILURE);
> }
>
> - if (guestfs_add_drive_scratch (g, 10485760, -1) == -1) {
> + if (guestfs_add_drive_scratch (g, INT64_C(10)*1024*1024, -1) == -1) {
> printf ("FAIL: guestfs_add_drive_scratch\n");
> exit (EXIT_FAILURE);
> }
> --
> 2.5.0
>
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Libguestfs
mailing list