aboutsummaryrefslogtreecommitdiff
path: root/tests/reverse/main_test.go
blob: 3d10750adbf791d23f7b948d4c0c9ffe0cc02339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package reverse_test

import (
	"os"
	"testing"

	"github.com/rfjakob/gocryptfs/tests/test_helpers"
)

var dirA, dirB, dirC string

func TestMain(m *testing.M) {
	dirA = test_helpers.TmpDir + "/a"
	dirB = test_helpers.TmpDir + "/b"
	dirC = test_helpers.TmpDir + "/c"
	if err := os.Mkdir(dirA, 0700); err != nil {
		panic(err)
	}
	if err := os.Mkdir(dirB, 0700); err != nil {
		panic(err)
	}
	if err := os.Mkdir(dirC, 0700); err != nil {
		panic(err)
	}
	test_helpers.MountOrExit(dirA, dirB, "-zerokey", "-reverse")
	test_helpers.MountOrExit(dirB, dirC, "-zerokey", "-gcmsiv")
	r := m.Run()
	test_helpers.UnmountPanic(dirC)
	test_helpers.UnmountPanic(dirB)
	os.RemoveAll(test_helpers.TmpDir)
	os.Exit(r)
}