mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
tests: Use new guestfs_add_drive_scratch API where possible in tests.
Replaces code such as: fd = open "test1.img" ftruncate fd, size close fd g.add_drive "test1.img" with the shorter and simpler: g.add_drive_scratch size
This commit is contained in:
@@ -20,7 +20,6 @@ package guestfs
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"os"
|
||||
// "sort"
|
||||
)
|
||||
|
||||
@@ -31,17 +30,7 @@ func Test100Launch (t *testing.T) {
|
||||
}
|
||||
defer g.Close ()
|
||||
|
||||
f, ferr := os.Create ("test.img")
|
||||
if ferr != nil {
|
||||
t.Errorf ("could not create file: %s", ferr)
|
||||
}
|
||||
defer os.Remove ("test.img")
|
||||
if ferr := f.Truncate (500 * 1024 * 1024); ferr != nil {
|
||||
t.Errorf ("could not truncate file: %s", ferr)
|
||||
}
|
||||
f.Close ()
|
||||
|
||||
err := g.Add_drive ("test.img", nil)
|
||||
err := g.Add_drive_scratch (500 * 1024 * 1024, nil);
|
||||
if err != nil {
|
||||
t.Errorf ("%s", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user