[Libguestfs] [PATCH] tests: reduce sizes of scratch disks to 2 GB

Pino Toscano ptoscano at redhat.com
Mon Feb 8 15:55:19 UTC 2016


1 GB should be enough to create a btrfs filesystem, even with 64K page
size; hence, make the /dev/sda and /dev/sdb test devices smaller so
there is less space taken during the test run.

Followup of commit 8ffad75e5b610274a664a00f1f1186070b602e18 and
commit 9e9b648770f9b8dbe8f280e4b5d1f80c4d689130.
---
 docs/guestfs-hacking.pod |  4 ++--
 generator/actions.ml     | 10 +++++-----
 tests/c-api/tests-main.c |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod
index 42d7759..ae667c9 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> 10 GB
+=item F</dev/sda> 2 GB
 
 General block device for testing.
 
-=item F</dev/sdb> 10 GB
+=item F</dev/sdb> 2 GB
 
 F</dev/sdb1> is an ext2 filesystem used for testing
 filesystem write operations.
diff --git a/generator/actions.ml b/generator/actions.ml
index 36b8680..eb45392 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -4780,7 +4780,7 @@ C<blocksize> option of C<guestfs_mkfs>." };
     tests = [
       InitEmpty, Always, TestResult (
         [["blockdev_getsz"; "/dev/sda"]],
-          "ret == INT64_C(10)*1024*1024*1024/512"), []
+          "ret == INT64_C(2)*1024*1024*1024/512"), []
     ];
     shortdesc = "get total size of device in 512-byte sectors";
     longdesc = "\
@@ -4800,7 +4800,7 @@ This uses the L<blockdev(8)> command." };
     tests = [
       InitEmpty, Always, TestResult (
         [["blockdev_getsize64"; "/dev/sda"]],
-          "ret == INT64_C(10)*1024*1024*1024"), []
+          "ret == INT64_C(2)*1024*1024*1024"), []
     ];
     shortdesc = "get total size of device in bytes";
     longdesc = "\
@@ -9884,7 +9884,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\", \"20971265\") == 0"), [];
+          "check_hash (ret, \"PART_ENTRY_SIZE\", \"4194049\") == 0"), [];
     ];
     shortdesc = "print block device attributes";
     longdesc = "\
@@ -12712,8 +12712,8 @@ This enable skinny metadata extent refs." };
     tests = [
       InitEmpty, Always, TestRun (
         [["part_init"; "/dev/sda"; "mbr"];
-         ["part_add"; "/dev/sda"; "p"; "64"; "4095999"];
-         ["part_add"; "/dev/sda"; "p"; "4096000"; "8191999"];
+         ["part_add"; "/dev/sda"; "p"; "64"; "2047999"];
+         ["part_add"; "/dev/sda"; "p"; "2048000"; "4095999"];
          ["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""];
          ["mkfs_btrfs"; "/dev/sda2"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""];
          ["mount"; "/dev/sda1"; "/"];
diff --git a/tests/c-api/tests-main.c b/tests/c-api/tests-main.c
index 517d8a3..85208b1 100644
--- a/tests/c-api/tests-main.c
+++ b/tests/c-api/tests-main.c
@@ -440,12 +440,12 @@ create_handle (void)
     exit (EXIT_FAILURE);
   }
 
-  if (guestfs_add_drive_scratch (g, INT64_C(10)*1024*1024*1024, -1) == -1) {
+  if (guestfs_add_drive_scratch (g, INT64_C(2)*1024*1024*1024, -1) == -1) {
     printf ("FAIL: guestfs_add_drive_scratch\n");
     exit (EXIT_FAILURE);
   }
 
-  if (guestfs_add_drive_scratch (g, INT64_C(10)*1024*1024*1024, -1) == -1) {
+  if (guestfs_add_drive_scratch (g, INT64_C(2)*1024*1024*1024, -1) == -1) {
     printf ("FAIL: guestfs_add_drive_scratch\n");
     exit (EXIT_FAILURE);
   }
-- 
2.5.0




More information about the Libguestfs mailing list