mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
haskell: Use 'import Guestfs as G' in test code.
The code is equivalent but shorter.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
-}
|
||||
|
||||
module Guestfs010Load where
|
||||
import qualified Guestfs
|
||||
import Guestfs as G
|
||||
|
||||
main = do
|
||||
Guestfs.create
|
||||
G.create
|
||||
|
||||
@@ -17,29 +17,29 @@
|
||||
-}
|
||||
|
||||
module Guestfs030Config where
|
||||
import qualified Guestfs
|
||||
import Guestfs as G
|
||||
import Control.Monad
|
||||
|
||||
main = do
|
||||
g <- Guestfs.create
|
||||
g <- G.create
|
||||
|
||||
Guestfs.set_verbose g True
|
||||
v <- Guestfs.get_verbose g
|
||||
G.set_verbose g True
|
||||
v <- G.get_verbose g
|
||||
when (v /= True) $
|
||||
fail "get_verbose /= True"
|
||||
Guestfs.set_verbose g False
|
||||
v <- Guestfs.get_verbose g
|
||||
G.set_verbose g False
|
||||
v <- G.get_verbose g
|
||||
when (v /= False) $
|
||||
fail "get_verbose /= False"
|
||||
|
||||
Guestfs.set_path g (Just ".")
|
||||
p <- Guestfs.get_path g
|
||||
G.set_path g (Just ".")
|
||||
p <- G.get_path g
|
||||
when (p /= ".") $
|
||||
fail "path not dot"
|
||||
Guestfs.set_path g Nothing
|
||||
p <- Guestfs.get_path g
|
||||
G.set_path g Nothing
|
||||
p <- G.get_path g
|
||||
when (p == "") $
|
||||
fail "path is empty"
|
||||
|
||||
Guestfs.add_drive_ro g "/dev/null"
|
||||
Guestfs.add_drive_ro g "/dev/zero"
|
||||
G.add_drive_ro g "/dev/null"
|
||||
G.add_drive_ro g "/dev/zero"
|
||||
|
||||
@@ -17,25 +17,25 @@
|
||||
-}
|
||||
|
||||
module Guestfs050LVCreate where
|
||||
import qualified Guestfs
|
||||
import Guestfs as G
|
||||
import System.IO (openFile, hClose, hSetFileSize, IOMode(WriteMode))
|
||||
import System.Posix.Files (removeLink)
|
||||
import Control.Monad
|
||||
|
||||
main = do
|
||||
g <- Guestfs.create
|
||||
g <- G.create
|
||||
fd <- openFile "test.img" WriteMode
|
||||
hSetFileSize fd (500 * 1024 * 1024)
|
||||
hClose fd
|
||||
Guestfs.add_drive_ro g "test.img"
|
||||
Guestfs.launch g
|
||||
G.add_drive_ro g "test.img"
|
||||
G.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
|
||||
G.pvcreate g "/dev/sda"
|
||||
G.vgcreate g "VG" ["/dev/sda"]
|
||||
G.lvcreate g "LV1" "VG" 200
|
||||
G.lvcreate g "LV2" "VG" 200
|
||||
|
||||
lvs <- Guestfs.lvs g
|
||||
lvs <- G.lvs g
|
||||
when (lvs /= ["/dev/VG/LV1", "/dev/VG/LV2"]) $
|
||||
fail "invalid list of LVs returned"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user