diff options
author | Jakob Unterwurzacher | 2016-10-19 22:25:54 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2016-10-19 22:25:54 +0200 |
commit | 589748548f24429bb30a8aafb3cae0d295b07da0 (patch) | |
tree | 24f60b0d7c199e8da75236747c9bf0a0f2d2da5c /tests/defaults | |
parent | 600ceece359d835934ad039bdd0e83cd647c410f (diff) |
tests: add 1980.tar.gz extract test
Test that we get the right timestamp when extracting a tarball.
Also simplify the workaround in doTestUtimesNano() and fix the
fact that it was running no test at all.
Diffstat (limited to 'tests/defaults')
-rw-r--r-- | tests/defaults/main_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go index a623c48..849aa69 100644 --- a/tests/defaults/main_test.go +++ b/tests/defaults/main_test.go @@ -3,6 +3,7 @@ package defaults import ( "os" + "os/exec" "testing" "github.com/rfjakob/gocryptfs/tests/test_helpers" @@ -15,3 +16,22 @@ func TestMain(m *testing.M) { test_helpers.UnmountPanic(test_helpers.DefaultPlainDir) os.Exit(r) } + +// Test that we get the right timestamp when extracting a tarball. +func Test1980Tar(t *testing.T) { + c := exec.Command("tar", "xzf", "1980.tar.gz", "-C", test_helpers.DefaultPlainDir) + c.Stderr = os.Stderr + c.Stdout = os.Stdout + err := c.Run() + if err != nil { + t.Fatal(err) + } + fi, err := os.Stat(test_helpers.DefaultPlainDir + "/1980.txt") + if err != nil { + t.Fatal(err) + } + m := fi.ModTime().Unix() + if m != 315619323 { + t.Errorf("Wrong mtime: %d", m) + } +} |