libgocryptfs/gocryptfs-xray/xray_tests/xray_test.go
Jakob Unterwurzacher 30a8fda0a1 xray: add tests and example aes-gcm fs
The single test compares the gocryptfs-xray output with the expected output.
2019-01-04 19:02:36 +01:00

27 lines
521 B
Go

package xray_tests
import (
"bytes"
"fmt"
"io/ioutil"
"os/exec"
"testing"
)
func TestAesgcmXray(t *testing.T) {
expected, err := ioutil.ReadFile("aesgcm_fs.xray.txt")
if err != nil {
t.Fatal(err)
}
cmd := exec.Command("../gocryptfs-xray", "aesgcm_fs/fRtDWUFQK9vDAtAJrTbbWg")
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatal(err)
}
if bytes.Compare(out, expected) != 0 {
t.Errorf("Unexpected output")
fmt.Printf("expected:\n%s", string(expected))
fmt.Printf("have:\n%s", string(out))
}
}