diff options
| author | Jakob Unterwurzacher | 2025-02-17 21:37:41 +0100 | 
|---|---|---|
| committer | Jakob Unterwurzacher | 2025-02-17 21:37:41 +0100 | 
| commit | 3c82930d4ad22b5be2f644346018a0550dd66aa8 (patch) | |
| tree | f808b21c4647de1b756db29a47bf68aa033094f2 /tests | |
| parent | a245def340de818910acb9e3c845e0381dc313ef (diff) | |
tests: root_test: add TestMain
I will add more tests for https://github.com/rfjakob/gocryptfs/issues/893
soon, these will also use DefaultPlainDir.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/root_test/main_test.go | 18 | ||||
| -rw-r--r-- | tests/root_test/root_test.go | 7 | 
2 files changed, 19 insertions, 6 deletions
| diff --git a/tests/root_test/main_test.go b/tests/root_test/main_test.go new file mode 100644 index 0000000..915c019 --- /dev/null +++ b/tests/root_test/main_test.go @@ -0,0 +1,18 @@ +package root_test + +import ( +	"os" +	"testing" + +	"github.com/rfjakob/gocryptfs/v2/tests/test_helpers" +) + +func TestMain(m *testing.M) { +	test_helpers.ResetTmpDir(true) +	os.Chmod(test_helpers.DefaultCipherDir, 0755) +	test_helpers.MountOrExit(test_helpers.DefaultCipherDir, test_helpers.DefaultPlainDir, "-zerokey", "-allow_other") +	r := m.Run() +	test_helpers.UnmountPanic(test_helpers.DefaultPlainDir) +	os.RemoveAll(test_helpers.TmpDir) +	os.Exit(r) +} diff --git a/tests/root_test/root_test.go b/tests/root_test/root_test.go index 23b44d0..8e1b9b1 100644 --- a/tests/root_test/root_test.go +++ b/tests/root_test/root_test.go @@ -83,16 +83,11 @@ func TestSupplementaryGroups(t *testing.T) {  	if os.Getuid() != 0 {  		t.Skip("must run as root")  	} -	cDir := test_helpers.InitFS(t) -	os.Chmod(cDir, 0755) -	pDir := cDir + ".mnt" -	test_helpers.MountOrFatal(t, cDir, pDir, "-allow_other", "-extpass=echo test") -	defer test_helpers.UnmountPanic(pDir)  	// We need an unrestricted umask  	syscall.Umask(0000) -	dir1 := pDir + "/dir1" +	dir1 := test_helpers.DefaultPlainDir + "/dir1"  	err := os.Mkdir(dir1, 0770)  	if err != nil {  		t.Fatal(err) | 
