Debian Codegraph @

src/test/pmem_memmove/TEST0

raw
1 #!/usr/bin/env bash
2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright 2015-2022, Intel Corporation
4
5 #
6 # src/test/pmem_memmove/TEST0 -- unit test for pmem_memmove
7 #
8
9 . ../unittest/unittest.sh
10
11 require_test_type medium
12
13 require_fs_type pmem non-pmem
14
15 setup
16
17 function test() {
18 rm -f $DIR/testfile1
19 truncate -s 4M $DIR/testfile1
20 expect_normal_exit ./pmem_memmove$EXESUFFIX $DIR/testfile1 $@
21 }
22
23 function test_all() {
24 # No offset, no overlap
25 test b:4096
26
27 # aligned dest, unaligned source, no overlap
28 test s:7 b:4096
29
30 # unaligned dest, unaligned source, no overlap
31 test d:7 s:13 b:4096
32
33 # all aligned, src overlaps dest
34 test b:4096 s:23 o:1
35
36 # unaligned destination
37 test b:4096 d:21
38
39 # unaligned source and dest
40 test b:4096 d:21 s:7
41
42 # overlap of src, aligned src and dest
43 test b:4096 o:1 s:20
44
45 # overlap of src, aligned src, unaligned dest
46 test b:4096 d:13 o:1 s:20
47
48 # dest overlaps src, unaligned dest, aligned src
49 test b:2048 d:33 o:1
50
51 # dest overlaps src, aligned dest and src
52 test b:4096 o:1 d:20
53
54 # aligned dest, no overlap, small length
55 test b:8
56
57 # small length, offset 1 byte from 64 byte boundary
58 test b:4 d:63
59
60 # overlap, src < dest, small length (ensures a copy backwards,
61 # with number of bytes to align < length)
62 test o:1 d:2 b:8
63 }
64
65 test_all
66
67 export PMEM_AVX512F=0
68
69 test_all
70
71 export PMEM_AVX=0
72
73 test_all
74
75 export PMEM_NO_MOVNT=1
76
77 test_all
78
79 export PMEM_NO_GENERIC_MEMCPY=1
80
81 test_all
82
83 export PMEM_MOVDIR64B=1
84
85 test_all
86
87 pass