From 2860b21ee1b86d6c944308a8be181c91bc07fd03 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 30 Nov 2010 14:10:40 +0000 Subject: haskell: Combine tests to reduce number of launches. --- .gitignore | 3 +-- haskell/Guestfs010Basic.hs | 39 +++++++++++++++++++++++++++++++++++++++ haskell/Guestfs010Launch.hs | 31 ------------------------------- haskell/Guestfs050LVCreate.hs | 41 ----------------------------------------- haskell/Makefile.am | 11 ++++------- 5 files changed, 44 insertions(+), 81 deletions(-) create mode 100644 haskell/Guestfs010Basic.hs delete mode 100644 haskell/Guestfs010Launch.hs delete mode 100644 haskell/Guestfs050LVCreate.hs diff --git a/.gitignore b/.gitignore index 21ddd265..ac540a28 100644 --- a/.gitignore +++ b/.gitignore @@ -113,8 +113,7 @@ guestfsd-in-wine.log haskell/Bindtests haskell/Bindtests.hs haskell/Guestfs005Load -haskell/Guestfs010Launch -haskell/Guestfs050LVCreate +haskell/Guestfs010Basic haskell/Guestfs.hs *.hi html/guestfish.1.html diff --git a/haskell/Guestfs010Basic.hs b/haskell/Guestfs010Basic.hs new file mode 100644 index 00000000..6454d69c --- /dev/null +++ b/haskell/Guestfs010Basic.hs @@ -0,0 +1,39 @@ +{- libguestfs Haskell bindings + Copyright (C) 2009-2010 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. +-} + +module Guestfs010Basic where +import qualified Guestfs +import System.IO (openFile, hClose, hSetFileSize, IOMode(WriteMode)) +import System.Posix.Files (removeLink) + +main = do + g <- Guestfs.create + fd <- openFile "test.img" WriteMode + hSetFileSize fd (500 * 1024 * 1024) + hClose fd + Guestfs.add_drive g "test.img" + Guestfs.launch g + + Guestfs.pvcreate g "/dev/sda" + Guestfs.vgcreate g "VG" ["/dev/sda"] + -- Guestfs.lvcreate g "LV1" "VG" 200 + -- Guestfs.lvcreate g "LV2" "VG" 200 + + -- Guestfs.lvs g and check returned list + + removeLink "test.img" diff --git a/haskell/Guestfs010Launch.hs b/haskell/Guestfs010Launch.hs deleted file mode 100644 index 930d6665..00000000 --- a/haskell/Guestfs010Launch.hs +++ /dev/null @@ -1,31 +0,0 @@ -{- libguestfs Haskell bindings - 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. --} - -module Guestfs010Launch where -import qualified Guestfs -import System.IO (openFile, hClose, hSetFileSize, IOMode(WriteMode)) -import System.Posix.Files (removeLink) - -main = do - g <- Guestfs.create - fd <- openFile "test.img" WriteMode - hSetFileSize fd (500 * 1024 * 1024) - hClose fd - Guestfs.add_drive g "test.img" - Guestfs.launch g - removeLink "test.img" diff --git a/haskell/Guestfs050LVCreate.hs b/haskell/Guestfs050LVCreate.hs deleted file mode 100644 index 502f6b2c..00000000 --- a/haskell/Guestfs050LVCreate.hs +++ /dev/null @@ -1,41 +0,0 @@ -{- libguestfs Haskell bindings - 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. --} - -module Guestfs050LVCreate where -import qualified Guestfs -import System.IO (openFile, hClose, hSetFileSize, IOMode(WriteMode)) -import System.Posix.Files (removeLink) - -main = do - g <- Guestfs.create - fd <- openFile "test.img" WriteMode - hSetFileSize fd (500 * 1024 * 1024) - hClose fd - Guestfs.add_drive g "test.img" - Guestfs.launch g - - Guestfs.pvcreate g "/dev/sda" - Guestfs.vgcreate g "VG" ["/dev/sda"] - -- Guestfs.lvcreate g "LV1" "VG" 200 - -- Guestfs.lvcreate g "LV2" "VG" 200 - - -- Guestfs.lvs g and check returned list - - Guestfs.sync g - - removeLink "test.img" diff --git a/haskell/Makefile.am b/haskell/Makefile.am index 2524617a..4406712f 100644 --- a/haskell/Makefile.am +++ b/haskell/Makefile.am @@ -32,13 +32,13 @@ TESTS_ENVIRONMENT = \ LIBGUESTFS_PATH=$(top_builddir)/appliance \ $(VG) -TESTS = run-bindtests Guestfs005Load Guestfs010Launch Guestfs050LVCreate +TESTS = run-bindtests Guestfs005Load Guestfs010Basic check_DATA = Bindtests GHCFLAGS = -I$(top_builddir)/src -L$(top_builddir)/src/.libs -all_targets = Bindtests Guestfs005Load Guestfs010Launch Guestfs050LVCreate +all_targets = Bindtests Guestfs005Load Guestfs010Basic $(all_targets): $(top_builddir)/src/libguestfs.la all: $(all_targets) @@ -52,12 +52,9 @@ Bindtests: Bindtests.hs Guestfs.o Guestfs005Load: Guestfs005Load.hs Guestfs.o $(GHC) $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs -Guestfs010Launch: Guestfs010Launch.hs Guestfs.o +Guestfs010Basic: Guestfs010Basic.hs Guestfs.o $(GHC) $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs -Guestfs050LVCreate: Guestfs050LVCreate.hs Guestfs.o - $(GHC) $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs - -CLEANFILES = $(all_targets) *~ Guestfs.o +CLEANFILES = $(all_targets) *~ *.hi *.o endif -- cgit