summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-18 16:45:44 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-18 16:45:44 +0000
commit6483c506b91d0093af96f361d6756853fac26972 (patch)
tree742c39c325dec4666739da9eef699cd2c2a2324b
parent6710296b7a597b0741b0559f2cefc3997986de40 (diff)
downloadlibguestfs-6483c506b91d0093af96f361d6756853fac26972.tar.gz
libguestfs-6483c506b91d0093af96f361d6756853fac26972.tar.xz
libguestfs-6483c506b91d0093af96f361d6756853fac26972.zip
lua: Add another test to prove that the handles are really independent.
-rw-r--r--lua/Makefile.am2
-rwxr-xr-xlua/tests/027-create-multiple.lua41
2 files changed, 43 insertions, 0 deletions
diff --git a/lua/Makefile.am b/lua/Makefile.am
index e642a130..e2daceee 100644
--- a/lua/Makefile.am
+++ b/lua/Makefile.am
@@ -53,6 +53,7 @@ TESTS = \
tests/010-load.lua \
tests/020-create.lua \
tests/025-create-flags.lua \
+ tests/027-create-multiple.lua \
tests/030-config.lua \
tests/070-optargs.lua
@@ -66,6 +67,7 @@ EXTRA_DIST += \
tests/010-load.lua \
tests/020-create.lua \
tests/025-create-flags.lua \
+ tests/027-create-multiple.lua \
tests/030-config.lua \
tests/050-lvcreate.lua \
tests/060-readdir.lua \
diff --git a/lua/tests/027-create-multiple.lua b/lua/tests/027-create-multiple.lua
new file mode 100755
index 00000000..30ce6155
--- /dev/null
+++ b/lua/tests/027-create-multiple.lua
@@ -0,0 +1,41 @@
+#!/usr/bin/lua
+-- libguestfs Lua bindings -*- lua -*-
+-- Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+require "guestfs"
+
+g1 = Guestfs.create ()
+g2 = Guestfs.create ()
+g3 = Guestfs.create ()
+
+-- Check that each handle is independent.
+g1:set_path ("1")
+g2:set_path ("2")
+g3:set_path ("3")
+
+if g1:get_path () ~= "1" then
+ error (string.format ("incorrect path in g1, expected '1', got '%s'",
+ g1:get_path ()))
+end
+if g2:get_path () ~= "2" then
+ error (string.format ("incorrect path in g2, expected '2', got '%s'",
+ g2:get_path ()))
+end
+if g3:get_path () ~= "3" then
+ error (string.format ("incorrect path in g3, expected '3', got '%s'",
+ g3:get_path ()))
+end