tests: run example_filesystems with "-openssl=false" AND "=true"

Run the tests twice, once with openssl and once with Go crypto.
This commit is contained in:
Jakob Unterwurzacher 2016-06-27 23:43:43 +02:00
parent 2720cd7b0d
commit f873d5f0a1
1 changed files with 26 additions and 14 deletions

View File

@ -1,6 +1,10 @@
package example_filesystems
// Mount example filesystems and check that the file "status.txt" is there
// Mount example filesystems, check that the example content (normal file, symlinks)
// is there and test mkdir and rmdir
//
// Runs all the tests twice, once with "-openssl=false" and once with
// "-openssl=true".
import (
"os"
@ -11,16 +15,21 @@ import (
const statusTxtContent = "It works!\n"
var opensslOpt = "-openssl=false"
func TestMain(m *testing.M) {
test_helpers.ResetTmpDir(true)
os.Exit(m.Run())
r := m.Run()
opensslOpt = "-openssl=true"
r2 := m.Run()
os.Exit(r + r2)
}
// This filesystem is not supported anymore.
func TestExampleFSv04(t *testing.T) {
cDir := "v0.4"
pDir := test_helpers.TmpDir + cDir
err := test_helpers.Mount(cDir, pDir, false, "-extpass", "echo test")
err := test_helpers.Mount(cDir, pDir, false, "-extpass", "echo test", opensslOpt)
if err == nil {
t.Errorf("Mounting too old FS should fail")
}
@ -30,7 +39,7 @@ func TestExampleFSv04(t *testing.T) {
func TestExampleFSv05(t *testing.T) {
cDir := "v0.5"
pDir := test_helpers.TmpDir + cDir
err := test_helpers.Mount(cDir, pDir, false, "-extpass", "echo test")
err := test_helpers.Mount(cDir, pDir, false, "-extpass", "echo test", opensslOpt)
if err == nil {
t.Errorf("Mounting too old FS should fail")
}
@ -40,7 +49,7 @@ func TestExampleFSv05(t *testing.T) {
func TestExampleFSv06(t *testing.T) {
cDir := "v0.6"
pDir := test_helpers.TmpDir + cDir
err := test_helpers.Mount(cDir, pDir, false, "-extpass", "echo test")
err := test_helpers.Mount(cDir, pDir, false, "-extpass", "echo test", opensslOpt)
if err == nil {
t.Errorf("Mounting too old FS should fail")
}
@ -50,7 +59,7 @@ func TestExampleFSv06(t *testing.T) {
func TestExampleFSv06PlaintextNames(t *testing.T) {
cDir := "v0.6-plaintextnames"
pDir := test_helpers.TmpDir + cDir
err := test_helpers.Mount(cDir, pDir, false, "-extpass", "echo test")
err := test_helpers.Mount(cDir, pDir, false, "-extpass", "echo test", opensslOpt)
if err == nil {
t.Errorf("Mounting too old FS should fail")
}
@ -66,11 +75,12 @@ func TestExampleFSv07(t *testing.T) {
if err != nil {
t.Fatal(err)
}
test_helpers.MountOrFatal(t, cDir, pDir, "-extpass", "echo test")
test_helpers.MountOrFatal(t, cDir, pDir, "-extpass", "echo test", opensslOpt)
checkExampleFS(t, pDir, true)
test_helpers.Unmount(pDir)
test_helpers.MountOrFatal(t, cDir, pDir, "-masterkey", "ed7f6d83-40cce86c-0e7d79c2-a9438710-"+
"575221bf-30a0eb60-2821fa8f-7f3123bf")
test_helpers.MountOrFatal(t, cDir, pDir, "-masterkey",
"ed7f6d83-40cce86c-0e7d79c2-a9438710-575221bf-30a0eb60-2821fa8f-7f3123bf",
opensslOpt)
checkExampleFS(t, pDir, true)
test_helpers.Unmount(pDir)
err = os.Remove(pDir)
@ -84,12 +94,13 @@ func TestExampleFSv07PlaintextNames(t *testing.T) {
cDir := "v0.7-plaintextnames"
pDir := test_helpers.TmpDir + cDir + ".mnt"
test_helpers.MountOrFatal(t, cDir, pDir, "-extpass", "echo test")
test_helpers.MountOrFatal(t, cDir, pDir, "-extpass", "echo test", opensslOpt)
checkExampleFS(t, pDir, true)
test_helpers.Unmount(pDir)
test_helpers.MountOrFatal(t, cDir, pDir, "-plaintextnames", "-masterkey",
"6d96397b-585631e1-c7cba69d-61e738b6-4d5ad2c2-e21f0fb3-52f60d3a-b08526f7")
"6d96397b-585631e1-c7cba69d-61e738b6-4d5ad2c2-e21f0fb3-52f60d3a-b08526f7",
opensslOpt)
checkExampleFS(t, pDir, true)
test_helpers.Unmount(pDir)
@ -108,11 +119,12 @@ func TestExampleFSv09(t *testing.T) {
if err != nil {
t.Fatal(err)
}
test_helpers.MountOrFatal(t, cDir, pDir, "-extpass", "echo test")
test_helpers.MountOrFatal(t, cDir, pDir, "-extpass", "echo test", opensslOpt)
checkExampleFSLongnames(t, pDir)
test_helpers.Unmount(pDir)
test_helpers.MountOrFatal(t, cDir, pDir, "-masterkey", "1cafe3f4-bc316466-2214c47c-ecd89bf3-"+
"4e078fe4-f5faeea7-8b7cab02-884f5e1c")
test_helpers.MountOrFatal(t, cDir, pDir, "-masterkey",
"1cafe3f4-bc316466-2214c47c-ecd89bf3-4e078fe4-f5faeea7-8b7cab02-884f5e1c",
opensslOpt)
checkExampleFSLongnames(t, pDir)
test_helpers.Unmount(pDir)
err = os.Remove(pDir)