Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
| ... | ... |
@@ -12,32 +12,12 @@ import ( |
| 12 | 12 |
"testing" |
| 13 | 13 |
"time" |
| 14 | 14 |
|
| 15 |
- "github.com/docker/docker/pkg/parsers/kernel" |
|
| 16 | 15 |
"github.com/docker/docker/pkg/system" |
| 17 | 16 |
"github.com/gotestyourself/gotestyourself/assert" |
| 18 | 17 |
is "github.com/gotestyourself/gotestyourself/assert/cmp" |
| 19 | 18 |
"golang.org/x/sys/unix" |
| 20 | 19 |
) |
| 21 | 20 |
|
| 22 |
-func TestIsCopyFileRangeSyscallAvailable(t *testing.T) {
|
|
| 23 |
- // Verifies: |
|
| 24 |
- // 1. That copyFileRangeEnabled is being set to true when copy_file_range syscall is available |
|
| 25 |
- // 2. That isCopyFileRangeSyscallAvailable() works on "new" kernels |
|
| 26 |
- v, err := kernel.GetKernelVersion() |
|
| 27 |
- assert.NilError(t, err) |
|
| 28 |
- |
|
| 29 |
- copyWithFileRange := true |
|
| 30 |
- copyWithFileClone := false |
|
| 31 |
- doCopyTest(t, ©WithFileRange, ©WithFileClone) |
|
| 32 |
- |
|
| 33 |
- if kernel.CompareKernelVersion(*v, kernel.VersionInfo{Kernel: 4, Major: 5, Minor: 0}) < 0 {
|
|
| 34 |
- assert.Check(t, !copyWithFileRange) |
|
| 35 |
- } else {
|
|
| 36 |
- assert.Check(t, copyWithFileRange) |
|
| 37 |
- } |
|
| 38 |
- |
|
| 39 |
-} |
|
| 40 |
- |
|
| 41 | 21 |
func TestCopy(t *testing.T) {
|
| 42 | 22 |
copyWithFileRange := true |
| 43 | 23 |
copyWithFileClone := true |