aboutsummaryrefslogtreecommitdiff
path: root/tests/defaults/main_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-23 22:55:07 +0200
committerJakob Unterwurzacher2020-07-23 22:55:07 +0200
commit9cd24d79a2a5499eefc3403516eba9d9fcbf1079 (patch)
treeffb6551b91e1fc614eff04ebaede6143a1cf2a5b /tests/defaults/main_test.go
parent8915785acf7e6e7908b32103406620f243093931 (diff)
v2api: implement Lseek
This also fixes the last remaining tests/fsck failure.
Diffstat (limited to 'tests/defaults/main_test.go')
-rw-r--r--tests/defaults/main_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go
index 51f5cd2..f59ea38 100644
--- a/tests/defaults/main_test.go
+++ b/tests/defaults/main_test.go
@@ -7,6 +7,7 @@ import (
"io/ioutil"
"os"
"os/exec"
+ "path/filepath"
"runtime"
"strings"
"sync"
@@ -261,3 +262,34 @@ func TestCpWarnings(t *testing.T) {
t.Fatalf("Got warnings from cp -a:\n%s", string(out))
}
}
+
+func TestSeekData(t *testing.T) {
+ fn := filepath.Join(test_helpers.DefaultPlainDir, t.Name())
+ f, err := os.Create(fn)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var oneTiB int64 = 1024 * 1024 * 1024 * 1024
+ if _, err = f.Seek(oneTiB, 0); err != nil {
+ t.Fatal(err)
+ }
+ if _, err = f.Write([]byte("foo")); err != nil {
+ t.Fatal(err)
+ }
+ f.Close()
+
+ const SEEK_DATA = 3
+
+ f, err = os.Open(fn)
+ if err != nil {
+ t.Fatal(err)
+ }
+ off, err := f.Seek(1024*1024, SEEK_DATA)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if off < oneTiB-1024*1024 {
+ t.Errorf("off=%d, expected=%d\n", off, oneTiB)
+ }
+ f.Close()
+}