Skip to content

Commit

Permalink
tests: Increase the size of the /dev/sda and /dev/sdb test devices.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rwmjones committed Feb 3, 2016
1 parent c055f84 commit 8ffad75
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docs/guestfs-hacking.pod
Expand Up @@ -105,16 +105,16 @@ The test environment has 4 block devices:

=over 4

=item F</dev/sda> 500MB
=item F</dev/sda> 10 GB

General block device for testing.

=item F</dev/sdb> 500MB
=item F</dev/sdb> 10 GB

F</dev/sdb1> is an ext2 filesystem used for testing
filesystem write operations.

=item F</dev/sdc> 10MB
=item F</dev/sdc> 10 MB

Used in a few tests where two block devices are needed.

Expand Down
17 changes: 11 additions & 6 deletions generator/actions.ml
Expand Up @@ -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 = "\
Expand All @@ -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 = "\
Expand Down Expand Up @@ -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"];
Expand Down Expand Up @@ -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 = "\
Expand Down
6 changes: 3 additions & 3 deletions tests/c-api/tests-main.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit 8ffad75

Please sign in to comment.