aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-05-10 23:18:16 +0200
committerJakob Unterwurzacher2018-05-10 23:26:00 +0200
commitf7a6f4d46858dcd049bcf671509bdf42e5d26d09 (patch)
tree426755a1bad2ad0cae19e1951687538b257cc658
parenta41ec2028cf2ad24eafb531d661ea1fe0f751f39 (diff)
fsck: update testcases with binary xattrs
-rw-r--r--tests/fsck/fsck_test.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/fsck/fsck_test.go b/tests/fsck/fsck_test.go
index 657ce89..2faed97 100644
--- a/tests/fsck/fsck_test.go
+++ b/tests/fsck/fsck_test.go
@@ -1,6 +1,7 @@
package fsck
import (
+ "encoding/base64"
"os"
"os/exec"
"strings"
@@ -12,20 +13,28 @@ import (
"github.com/rfjakob/gocryptfs/tests/test_helpers"
)
+func dec64(in string) (out []byte) {
+ out, err := base64.RawURLEncoding.DecodeString(in)
+ if err != nil {
+ panic(err)
+ }
+ return out
+}
+
func TestBrokenFsV14(t *testing.T) {
// git does not save extended attributes, so we apply them here.
// xattr_good
xattr.Set("broken_fs_v1.4/6nGs4Ugr3EAHd0KzkyLZ-Q",
"user.gocryptfs.0a5e7yWl0SGUGeWB0Sy2Kg",
- []byte("hxnZvXSkDicfwVS9w4r1yYkFF61Qou6NaL-VhObYEdu6kuM"))
+ dec64("hxnZvXSkDicfwVS9w4r1yYkFF61Qou6NaL-VhObYEdu6kuM"))
// xattr_corrupt_name
xattr.Set("broken_fs_v1.4/CMyUifVTjW5fsgXonWBT_RDkvLkdGrLttkZ45T3Oi3A",
"user.gocryptfs.0a5e7yWl0SGUGeWB0Sy2K0",
- []byte("QHUMDTgbnl8Sv_A2dFQic_G2vN4_gmDna3651JAhF7OZ-YI"))
+ dec64("QHUMDTgbnl8Sv_A2dFQic_G2vN4_gmDna3651JAhF7OZ-YI"))
// xattr_corrupt_value
xattr.Set("broken_fs_v1.4/b00sbnGXGToadr01GHZaYQn8tjyRhe1OXNBZoQtMlcQ",
"user.gocryptfs.0a5e7yWl0SGUGeWB0Sy2Kg",
- []byte("A0hvCePeKpL8bCpijhDKtf7cIijXYQsPnEbNJ84M2ONW0dd"))
+ dec64("A0hvCePeKpL8bCpijhDKtf7cIijXYQsPnEbNJ84M2ONW0dd"))
cmd := exec.Command(test_helpers.GocryptfsBinary, "-fsck", "-extpass", "echo test", "broken_fs_v1.4")
outBin, err := cmd.CombinedOutput()