示例#1
0
func TestMain(m *testing.M) {
	testutil.Setup()

	dataDir = filepath.Join(testutil.TempDir, "data")
	if err := os.Mkdir(dataDir, 0700); err != nil {
		log.Fatalf("os.Mkdir: %s", err)
	}

	lorem := bytes.Repeat([]byte("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n"), 1*Megabyte)
	writeFile(dataDir, "lorem.txt", lorem)

	for i := 0; i < 5; i++ {
		x := testutil.RandomBytes(i * Megabyte)
		writeFile(dataDir, fmt.Sprintf("%dMB.data", i), x)
	}

	writeFile(dataDir, "80MB.data", testutil.RandomBytes(80*Megabyte))

	r := m.Run()

	testutil.TearDown()

	os.Exit(r)
}
示例#2
0
func TestMain(m *testing.M) {
	testutil.Setup()
	r := m.Run()
	testutil.TearDown()
	os.Exit(r)
}