Open and close reporting files.
parent
01470b8c34
commit
bfa3465cb9
|
@ -40,6 +40,10 @@ func TestFlushFS(t *testing.T) { RunTests(t) }
|
||||||
type flushFSTest struct {
|
type flushFSTest struct {
|
||||||
samples.SubprocessTest
|
samples.SubprocessTest
|
||||||
|
|
||||||
|
// Files to which mount_sample is writing reported flushes and fsyncs.
|
||||||
|
flushes *os.File
|
||||||
|
fsyncs *os.File
|
||||||
|
|
||||||
// File handles that are closed in TearDown if non-nil.
|
// File handles that are closed in TearDown if non-nil.
|
||||||
f1 *os.File
|
f1 *os.File
|
||||||
f2 *os.File
|
f2 *os.File
|
||||||
|
@ -52,7 +56,11 @@ func (t *flushFSTest) setUp(
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
// Set up files to receive flush and fsync reports.
|
// Set up files to receive flush and fsync reports.
|
||||||
panic("TODO")
|
t.flushes, err = ioutil.TempFile("", "")
|
||||||
|
AssertEq(nil, err)
|
||||||
|
|
||||||
|
t.fsyncs, err = ioutil.TempFile("", "")
|
||||||
|
AssertEq(nil, err)
|
||||||
|
|
||||||
// Set up test config.
|
// Set up test config.
|
||||||
t.MountType = "flushfs"
|
t.MountType = "flushfs"
|
||||||
|
@ -74,7 +82,15 @@ func (t *flushFSTest) setUp(
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *FlushFSTest) TearDown() {
|
func (t *FlushFSTest) TearDown() {
|
||||||
// Close files if non-nil.
|
// Unlink reporting files.
|
||||||
|
os.Remove(t.flushes.Name())
|
||||||
|
os.Remove(t.fsyncs.Name())
|
||||||
|
|
||||||
|
// Close reporting files.
|
||||||
|
t.flushes.Close()
|
||||||
|
t.fsyncs.Close()
|
||||||
|
|
||||||
|
// Close test files if non-nil.
|
||||||
if t.f1 != nil {
|
if t.f1 != nil {
|
||||||
ExpectEq(nil, t.f1.Close())
|
ExpectEq(nil, t.f1.Close())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue