summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/defaults/main_test.go1
-rw-r--r--tests/reverse/correctness_test.go38
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go
index 1982c90..8873f8f 100644
--- a/tests/defaults/main_test.go
+++ b/tests/defaults/main_test.go
@@ -263,6 +263,7 @@ func TestCpWarnings(t *testing.T) {
}
}
+// TestSeekData tests that fs.FileLseeker is implemented
func TestSeekData(t *testing.T) {
fn := filepath.Join(test_helpers.DefaultPlainDir, t.Name())
f, err := os.Create(fn)
diff --git a/tests/reverse/correctness_test.go b/tests/reverse/correctness_test.go
index 78c9c4b..9d7a1c8 100644
--- a/tests/reverse/correctness_test.go
+++ b/tests/reverse/correctness_test.go
@@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
+ "path/filepath"
"syscall"
"testing"
@@ -257,3 +258,40 @@ func TestStatfs(t *testing.T) {
t.Errorf("statfs reports size zero: %#v", st)
}
}
+
+// TestSeekData tests that fs.FileLseeker is implemented
+func TestSeekData(t *testing.T) {
+ if !plaintextnames {
+ t.Skip()
+ }
+
+ fn := filepath.Join(dirA, 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
+
+ fn2 := filepath.Join(dirB, t.Name())
+ f, err = os.Open(fn2)
+ 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()
+}