2
0
mirror of synced 2025-02-24 14:48:27 +00:00
torrent/main_test.go
Matt Joiner 07679c3895 Remove test temporary directories when finished
They're all grouped together in a parent directory that gets removed. Testing with mmap storage can generate very large files on bad filesystems.
2017-09-18 12:14:16 +10:00

27 lines
348 B
Go

package torrent
import (
"io/ioutil"
"log"
"os"
"testing"
)
var tempDir string
func init() {
log.SetFlags(log.LstdFlags | log.Llongfile)
var err error
tempDir, err = ioutil.TempDir("", "torrent.test")
if err != nil {
panic(err)
}
}
func TestMain(m *testing.M) {
code := m.Run()
os.RemoveAll(tempDir)
// select {}
os.Exit(code)
}