summaryrefslogtreecommitdiffstats
path: root/ruby/tests
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-16 22:13:20 +0100
committerRichard Jones <rjones@redhat.com>2009-04-16 22:13:20 +0100
commita5f68bd57d887c8c8818dbb92a9f8b7643f67827 (patch)
treefc9004be7e62c8cadb54eeff1b7ad5b763ff4073 /ruby/tests
parent5a6da98c943be987441673a590c151f15573b6cc (diff)
downloadlibguestfs-a5f68bd57d887c8c8818dbb92a9f8b7643f67827.tar.gz
libguestfs-a5f68bd57d887c8c8818dbb92a9f8b7643f67827.tar.xz
libguestfs-a5f68bd57d887c8c8818dbb92a9f8b7643f67827.zip
Ruby bindings.
Diffstat (limited to 'ruby/tests')
-rw-r--r--ruby/tests/tc_010_load.rb28
-rw-r--r--ruby/tests/tc_050_lvcreate.rb49
2 files changed, 77 insertions, 0 deletions
diff --git a/ruby/tests/tc_010_load.rb b/ruby/tests/tc_010_load.rb
new file mode 100644
index 00000000..6d882db8
--- /dev/null
+++ b/ruby/tests/tc_010_load.rb
@@ -0,0 +1,28 @@
+# libguestfs Ruby bindings -*- ruby -*-
+# Copyright (C) 2009 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+require 'test/unit'
+$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
+$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
+require 'guestfs'
+
+class TestLoad < Test::Unit::TestCase
+ def test_load
+ g = Guestfs::create()
+ assert_not_nil (g)
+ end
+end
diff --git a/ruby/tests/tc_050_lvcreate.rb b/ruby/tests/tc_050_lvcreate.rb
new file mode 100644
index 00000000..ea87e398
--- /dev/null
+++ b/ruby/tests/tc_050_lvcreate.rb
@@ -0,0 +1,49 @@
+# libguestfs Ruby bindings -*- ruby -*-
+# Copyright (C) 2009 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+require 'test/unit'
+$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
+$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
+require 'guestfs'
+
+class TestLoad < Test::Unit::TestCase
+ def test_lvcreate
+ g = Guestfs::create()
+
+ File.open("test.img", "w") {
+ |f| f.seek(500*1024*1024); f.write("\0")
+ }
+
+ g.add_drive("test.img")
+ g.launch()
+ g.wait_ready()
+
+ g.pvcreate("/dev/sda")
+ g.vgcreate("VG", ["/dev/sda"]);
+ g.lvcreate("LV1", "VG", 200);
+ g.lvcreate("LV2", "VG", 200);
+
+ lvs = g.lvs()
+ if lvs != ["/dev/VG/LV1", "/dev/VG/LV2"]
+ raise "incorrect lvs returned"
+ end
+
+ g.sync()
+
+ File.unlink("test.img")
+ end
+end