tests/matrix: add -xchacha test

This commit is contained in:
Jakob Unterwurzacher 2021-08-23 16:00:21 +02:00
parent 97d8340bd8
commit 2fb1d52746
2 changed files with 19 additions and 2 deletions

View File

@ -156,7 +156,13 @@ func TestFallocate(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
err = syscallcompat.Fallocate(fd, FALLOC_DEFAULT, 0, 8110) var plain int64 = 8110
if testcase.isSet("-xchacha") {
// xchacha has 24 byte ivs instead of 16. 8kiB are two blocks, so
// 2x8=16 bytes more.
plain = plain - 16
}
err = syscallcompat.Fallocate(fd, FALLOC_DEFAULT, 0, plain)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -39,6 +39,16 @@ type testcaseMatrix struct {
extraArgs []string extraArgs []string
} }
// isSet finds out if `extraArg` is set in `tc.extraArgs`
func (tc *testcaseMatrix) isSet(extraArg string) bool {
for _, v := range tc.extraArgs {
if v == extraArg {
return true
}
}
return false
}
var matrix = []testcaseMatrix{ var matrix = []testcaseMatrix{
// Normal // Normal
{false, "auto", false, false, nil}, {false, "auto", false, false, nil},
@ -56,6 +66,7 @@ var matrix = []testcaseMatrix{
{false, "auto", false, false, []string{"-serialize_reads"}}, {false, "auto", false, false, []string{"-serialize_reads"}},
{false, "auto", false, false, []string{"-sharedstorage"}}, {false, "auto", false, false, []string{"-sharedstorage"}},
{false, "auto", false, false, []string{"-deterministic-names"}}, {false, "auto", false, false, []string{"-deterministic-names"}},
{false, "auto", false, true, []string{"-xchacha"}},
} }
// This is the entry point for the tests // This is the entry point for the tests
@ -73,7 +84,7 @@ func TestMain(m *testing.M) {
createDirIV := true createDirIV := true
if testcase.plaintextnames { if testcase.plaintextnames {
createDirIV = false createDirIV = false
} else if len(testcase.extraArgs) == 1 && testcase.extraArgs[0] == "-deterministic-names" { } else if testcase.isSet("-deterministic-names") {
createDirIV = false createDirIV = false
} }
test_helpers.ResetTmpDir(createDirIV) test_helpers.ResetTmpDir(createDirIV)