[Libguestfs] [PATCH v2 9/9] tests: Add a test of btrfs-qgroup-show using the captive daemon.

Richard W.M. Jones
Thu, 25 Jun 2015 14:57:01 -0000

---
 tests/daemon/test-btrfs.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/daemon/test-btrfs.pl b/tests/daemon/test-btrfs.pl
index fff927e..815ab1d 100755
--- a/tests/daemon/test-btrfs.pl
+++ b/tests/daemon/test-btrfs.pl
@@ -62,6 +62,19 @@ EOF
     die unless $r[2]->{btrfssubvolume_top_level_id} == 5;
     die unless $r[2]->{btrfssubvolume_path} eq "test3";

+    # Test btrfs_qgroup_show.
+    my $output = <<EOF;
+qgroupid rfer excl
+-------- ---- ----
+0/5      4096 4096
+EOF
+    set_btrfs_output ($output);
+    my @r = $g->btrfs_qgroup_show ("/");
+    die unless @r == 1;
+    die unless $r[0]->{btrfsqgroup_id} == "0/5";
+    die unless $r[0]->{btrfsqgroup_rfer} == 4096;
+    die unless $r[0]->{btrfsqgroup_excl} == 4096;
+
     # Return true to indicate the test succeeded.
     1;
 }
--
2.3.1