[Libguestfs] [PATCH] Fix tests/bigdirs/test-big-dirs.pl to use mke2fs

Wanlong Gao gaowanlong at cn.fujitsu.com
Mon Sep 24 08:49:21 UTC 2012


Let tests/bigdirs/test-big-dirs.pl uses mke2fs to create small
inode ratio files.

Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com>
---
 TODO                           |  6 ------
 tests/bigdirs/test-big-dirs.pl | 18 ++++--------------
 2 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/TODO b/TODO
index 1ff661f..1cde423 100644
--- a/TODO
+++ b/TODO
@@ -565,12 +565,6 @@ the p.o.v of the API and ABI.
 
  - guestfs_readdir
 
-mke2fs
-------
-
-Add a mke2fs API call allowing full configuration of filesystems.
-Then fix tests/bigdirs/test-big-dirs.pl to use it.
-
 hivex
 -----
 
diff --git a/tests/bigdirs/test-big-dirs.pl b/tests/bigdirs/test-big-dirs.pl
index 052163b..35fbc90 100755
--- a/tests/bigdirs/test-big-dirs.pl
+++ b/tests/bigdirs/test-big-dirs.pl
@@ -22,23 +22,12 @@ use warnings;
 
 use Sys::Guestfs;
 
-# Skip this test on 32 bit machines, since we cannot create a large
-# enough file below.
-if (~1 == 4294967294) {
-    print STDERR "$0: tested skipped because this is a 32 bit machine\n";
-    exit 77
-}
-
 my $g = Sys::Guestfs->new ();
 
-# Create a 16 GB test file.  Don't worry, it's sparse.
-#
-# It has to be this big because the 'defaults' configuration of mke2fs
-# will choose a default inode ratio of 16K, and in order to create a
-# million files that means we have to have the disk be >= 16K * 1000000
-# bytes in size.
+# Create a 2 GB test file.  Don't worry, it's sparse.
+
 my $nr_files = 1000000;
-my $image_size = 16*1024*1024*1024;
+my $image_size = 2*1024*1024*1024;
 
 unlink "test.img";
 open FILE, ">test.img" or die "test.img: $!";
@@ -51,6 +40,7 @@ $g->launch ();
 
 $g->part_disk ("/dev/sda", "mbr");
 $g->mkfs ("ext4", "/dev/sda1");
+$g->mke2fs ("/dev/sda1", "fstype:ext4", "bytesperinode:2048");
 $g->mount ("/dev/sda1", "/");
 
 my %df = $g->statvfs ("/");
-- 
1.7.12




More information about the Libguestfs mailing list