Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 2 | # SPDX-License-Identifier: GPL-2.0 |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 3 | #please run as root |
| 4 | |
Shuah Khan (Samsung OSG) | a4d7537 | 2018-06-13 21:31:43 -0600 | [diff] [blame] | 5 | # Kselftest framework requirement - SKIP code is 4. |
| 6 | ksft_skip=4 |
| 7 | |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 8 | mnt=./huge |
Joern Engel | 51a1d16 | 2013-07-03 15:09:17 -0700 | [diff] [blame] | 9 | exitcode=0 |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 10 | |
Li Zhijian | 0627be7 | 2018-03-09 15:51:16 -0800 | [diff] [blame] | 11 | #get huge pagesize and freepages from /proc/meminfo |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 12 | while read name size unit; do |
| 13 | if [ "$name" = "HugePages_Free:" ]; then |
| 14 | freepgs=$size |
| 15 | fi |
| 16 | if [ "$name" = "Hugepagesize:" ]; then |
Li Zhijian | 0627be7 | 2018-03-09 15:51:16 -0800 | [diff] [blame] | 17 | hpgsize_KB=$size |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 18 | fi |
| 19 | done < /proc/meminfo |
| 20 | |
Li Zhijian | 0627be7 | 2018-03-09 15:51:16 -0800 | [diff] [blame] | 21 | # Simple hugetlbfs tests have a hardcoded minimum requirement of |
| 22 | # huge pages totaling 256MB (262144KB) in size. The userfaultfd |
| 23 | # hugetlb test requires a minimum of 2 * nr_cpus huge pages. Take |
| 24 | # both of these requirements into account and attempt to increase |
| 25 | # number of huge pages available. |
| 26 | nr_cpus=$(nproc) |
| 27 | hpgsize_MB=$((hpgsize_KB / 1024)) |
| 28 | half_ufd_size_MB=$((((nr_cpus * hpgsize_MB + 127) / 128) * 128)) |
| 29 | needmem_KB=$((half_ufd_size_MB * 2 * 1024)) |
| 30 | |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 31 | #set proper nr_hugepages |
Li Zhijian | 0627be7 | 2018-03-09 15:51:16 -0800 | [diff] [blame] | 32 | if [ -n "$freepgs" ] && [ -n "$hpgsize_KB" ]; then |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 33 | nr_hugepgs=`cat /proc/sys/vm/nr_hugepages` |
Li Zhijian | 0627be7 | 2018-03-09 15:51:16 -0800 | [diff] [blame] | 34 | needpgs=$((needmem_KB / hpgsize_KB)) |
Ben Hutchings | ee00479 | 2015-11-02 12:22:22 +0000 | [diff] [blame] | 35 | tries=2 |
| 36 | while [ $tries -gt 0 ] && [ $freepgs -lt $needpgs ]; do |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 37 | lackpgs=$(( $needpgs - $freepgs )) |
Ben Hutchings | ee00479 | 2015-11-02 12:22:22 +0000 | [diff] [blame] | 38 | echo 3 > /proc/sys/vm/drop_caches |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 39 | echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages |
| 40 | if [ $? -ne 0 ]; then |
| 41 | echo "Please run this test as root" |
Shuah Khan (Samsung OSG) | a4d7537 | 2018-06-13 21:31:43 -0600 | [diff] [blame] | 42 | exit $ksft_skip |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 43 | fi |
Ben Hutchings | ee00479 | 2015-11-02 12:22:22 +0000 | [diff] [blame] | 44 | while read name size unit; do |
| 45 | if [ "$name" = "HugePages_Free:" ]; then |
| 46 | freepgs=$size |
| 47 | fi |
| 48 | done < /proc/meminfo |
| 49 | tries=$((tries - 1)) |
| 50 | done |
| 51 | if [ $freepgs -lt $needpgs ]; then |
| 52 | printf "Not enough huge pages available (%d < %d)\n" \ |
| 53 | $freepgs $needpgs |
| 54 | exit 1 |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 55 | fi |
| 56 | else |
| 57 | echo "no hugetlbfs support in kernel?" |
| 58 | exit 1 |
| 59 | fi |
| 60 | |
Masami Hiramatsu | 7549b33 | 2019-10-23 13:57:49 +0900 | [diff] [blame] | 61 | #filter 64bit architectures |
Sandipan Das | 963e3e9 | 2020-01-30 12:31:19 +0530 | [diff] [blame] | 62 | ARCH64STR="arm64 ia64 mips64 parisc64 ppc64 ppc64le riscv64 s390x sh64 sparc64 x86_64" |
Masami Hiramatsu | 7549b33 | 2019-10-23 13:57:49 +0900 | [diff] [blame] | 63 | if [ -z $ARCH ]; then |
| 64 | ARCH=`uname -m 2>/dev/null | sed -e 's/aarch64.*/arm64/'` |
| 65 | fi |
| 66 | VADDR64=0 |
| 67 | echo "$ARCH64STR" | grep $ARCH && VADDR64=1 |
| 68 | |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 69 | mkdir $mnt |
| 70 | mount -t hugetlbfs none $mnt |
| 71 | |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 72 | echo "---------------------" |
Masanari Iida | ce8283d | 2012-07-18 00:56:18 +0900 | [diff] [blame] | 73 | echo "running hugepage-mmap" |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 74 | echo "---------------------" |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 75 | ./hugepage-mmap |
| 76 | if [ $? -ne 0 ]; then |
| 77 | echo "[FAIL]" |
Joern Engel | 51a1d16 | 2013-07-03 15:09:17 -0700 | [diff] [blame] | 78 | exitcode=1 |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 79 | else |
| 80 | echo "[PASS]" |
| 81 | fi |
| 82 | |
| 83 | shmmax=`cat /proc/sys/kernel/shmmax` |
| 84 | shmall=`cat /proc/sys/kernel/shmall` |
| 85 | echo 268435456 > /proc/sys/kernel/shmmax |
| 86 | echo 4194304 > /proc/sys/kernel/shmall |
| 87 | echo "--------------------" |
Masanari Iida | ce8283d | 2012-07-18 00:56:18 +0900 | [diff] [blame] | 88 | echo "running hugepage-shm" |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 89 | echo "--------------------" |
| 90 | ./hugepage-shm |
| 91 | if [ $? -ne 0 ]; then |
| 92 | echo "[FAIL]" |
Joern Engel | 51a1d16 | 2013-07-03 15:09:17 -0700 | [diff] [blame] | 93 | exitcode=1 |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 94 | else |
| 95 | echo "[PASS]" |
| 96 | fi |
| 97 | echo $shmmax > /proc/sys/kernel/shmmax |
| 98 | echo $shmall > /proc/sys/kernel/shmall |
| 99 | |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 100 | echo "-------------------" |
Masanari Iida | ce8283d | 2012-07-18 00:56:18 +0900 | [diff] [blame] | 101 | echo "running map_hugetlb" |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 102 | echo "-------------------" |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 103 | ./map_hugetlb |
| 104 | if [ $? -ne 0 ]; then |
| 105 | echo "[FAIL]" |
Joern Engel | 51a1d16 | 2013-07-03 15:09:17 -0700 | [diff] [blame] | 106 | exitcode=1 |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 107 | else |
| 108 | echo "[PASS]" |
| 109 | fi |
| 110 | |
Mina Almasry | 12b6132 | 2021-11-05 13:41:43 -0700 | [diff] [blame] | 111 | echo "-----------------------" |
| 112 | echo "running hugepage-mremap" |
| 113 | echo "-----------------------" |
| 114 | ./hugepage-mremap |
| 115 | if [ $? -ne 0 ]; then |
| 116 | echo "[FAIL]" |
| 117 | exitcode=1 |
| 118 | else |
| 119 | echo "[PASS]" |
| 120 | fi |
| 121 | |
Mike Kravetz | fd5a9ec | 2015-09-08 15:02:55 -0700 | [diff] [blame] | 122 | echo "NOTE: The above hugetlb tests provide minimal coverage. Use" |
| 123 | echo " https://github.com/libhugetlbfs/libhugetlbfs.git for" |
| 124 | echo " hugetlb regression testing." |
| 125 | |
SeongJae Park | 9e69fa4 | 2020-02-20 20:04:06 -0800 | [diff] [blame] | 126 | echo "---------------------------" |
| 127 | echo "running map_fixed_noreplace" |
| 128 | echo "---------------------------" |
| 129 | ./map_fixed_noreplace |
| 130 | if [ $? -ne 0 ]; then |
| 131 | echo "[FAIL]" |
| 132 | exitcode=1 |
| 133 | else |
| 134 | echo "[PASS]" |
| 135 | fi |
| 136 | |
John Hubbard | d943fe8 | 2020-12-14 19:05:24 -0800 | [diff] [blame] | 137 | echo "------------------------------------------------------" |
| 138 | echo "running: gup_test -u # get_user_pages_fast() benchmark" |
| 139 | echo "------------------------------------------------------" |
| 140 | ./gup_test -u |
John Hubbard | be87141 | 2020-04-01 21:05:45 -0700 | [diff] [blame] | 141 | if [ $? -ne 0 ]; then |
| 142 | echo "[FAIL]" |
| 143 | exitcode=1 |
| 144 | else |
| 145 | echo "[PASS]" |
| 146 | fi |
| 147 | |
John Hubbard | d943fe8 | 2020-12-14 19:05:24 -0800 | [diff] [blame] | 148 | echo "------------------------------------------------------" |
| 149 | echo "running: gup_test -a # pin_user_pages_fast() benchmark" |
| 150 | echo "------------------------------------------------------" |
| 151 | ./gup_test -a |
| 152 | if [ $? -ne 0 ]; then |
| 153 | echo "[FAIL]" |
| 154 | exitcode=1 |
| 155 | else |
| 156 | echo "[PASS]" |
| 157 | fi |
| 158 | |
| 159 | echo "------------------------------------------------------------" |
| 160 | echo "# Dump pages 0, 19, and 4096, using pin_user_pages:" |
| 161 | echo "running: gup_test -ct -F 0x1 0 19 0x1000 # dump_page() test" |
| 162 | echo "------------------------------------------------------------" |
| 163 | ./gup_test -ct -F 0x1 0 19 0x1000 |
John Hubbard | be87141 | 2020-04-01 21:05:45 -0700 | [diff] [blame] | 164 | if [ $? -ne 0 ]; then |
| 165 | echo "[FAIL]" |
| 166 | exitcode=1 |
| 167 | else |
| 168 | echo "[PASS]" |
| 169 | fi |
| 170 | |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 171 | echo "-------------------" |
Andrea Arcangeli | c47174f | 2015-09-04 15:47:23 -0700 | [diff] [blame] | 172 | echo "running userfaultfd" |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 173 | echo "-------------------" |
John Hubbard | a26c4c6 | 2020-12-14 19:05:31 -0800 | [diff] [blame] | 174 | ./userfaultfd anon 20 16 |
Andrea Arcangeli | c47174f | 2015-09-04 15:47:23 -0700 | [diff] [blame] | 175 | if [ $? -ne 0 ]; then |
| 176 | echo "[FAIL]" |
| 177 | exitcode=1 |
| 178 | else |
| 179 | echo "[PASS]" |
| 180 | fi |
| 181 | |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 182 | echo "---------------------------" |
Mike Kravetz | 9903bd7 | 2017-02-22 15:43:07 -0800 | [diff] [blame] | 183 | echo "running userfaultfd_hugetlb" |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 184 | echo "---------------------------" |
Li Zhijian | 0627be7 | 2018-03-09 15:51:16 -0800 | [diff] [blame] | 185 | # Test requires source and destination huge pages. Size of source |
| 186 | # (half_ufd_size_MB) is passed as argument to test. |
| 187 | ./userfaultfd hugetlb $half_ufd_size_MB 32 $mnt/ufd_test_file |
Mike Kravetz | 9903bd7 | 2017-02-22 15:43:07 -0800 | [diff] [blame] | 188 | if [ $? -ne 0 ]; then |
| 189 | echo "[FAIL]" |
| 190 | exitcode=1 |
| 191 | else |
| 192 | echo "[PASS]" |
| 193 | fi |
| 194 | rm -f $mnt/ufd_test_file |
| 195 | |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 196 | echo "-------------------------" |
Mike Rapoport | 419624d | 2017-02-22 15:43:46 -0800 | [diff] [blame] | 197 | echo "running userfaultfd_shmem" |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 198 | echo "-------------------------" |
John Hubbard | a26c4c6 | 2020-12-14 19:05:31 -0800 | [diff] [blame] | 199 | ./userfaultfd shmem 20 16 |
Mike Rapoport | 419624d | 2017-02-22 15:43:46 -0800 | [diff] [blame] | 200 | if [ $? -ne 0 ]; then |
| 201 | echo "[FAIL]" |
| 202 | exitcode=1 |
| 203 | else |
| 204 | echo "[PASS]" |
| 205 | fi |
| 206 | |
Dave Young | f0f57b2 | 2012-03-28 14:42:56 -0700 | [diff] [blame] | 207 | #cleanup |
| 208 | umount $mnt |
| 209 | rm -rf $mnt |
| 210 | echo $nr_hugepgs > /proc/sys/vm/nr_hugepages |
Sri Jayaramappa | bd67d5c | 2015-04-23 14:21:41 -0400 | [diff] [blame] | 211 | |
| 212 | echo "-----------------------" |
| 213 | echo "running compaction_test" |
| 214 | echo "-----------------------" |
| 215 | ./compaction_test |
| 216 | if [ $? -ne 0 ]; then |
| 217 | echo "[FAIL]" |
| 218 | exitcode=1 |
| 219 | else |
| 220 | echo "[PASS]" |
| 221 | fi |
| 222 | |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 223 | echo "----------------------" |
Eric B Munson | b3b0d09 | 2015-11-05 18:51:43 -0800 | [diff] [blame] | 224 | echo "running on-fault-limit" |
SeongJae Park | 2b8713e | 2017-04-14 01:58:49 +0900 | [diff] [blame] | 225 | echo "----------------------" |
Eric B Munson | b3b0d09 | 2015-11-05 18:51:43 -0800 | [diff] [blame] | 226 | sudo -u nobody ./on-fault-limit |
| 227 | if [ $? -ne 0 ]; then |
| 228 | echo "[FAIL]" |
| 229 | exitcode=1 |
| 230 | else |
| 231 | echo "[PASS]" |
| 232 | fi |
| 233 | |
| 234 | echo "--------------------" |
Dmitry Safonov | 1caed86 | 2018-08-21 21:53:47 -0700 | [diff] [blame] | 235 | echo "running map_populate" |
| 236 | echo "--------------------" |
| 237 | ./map_populate |
| 238 | if [ $? -ne 0 ]; then |
| 239 | echo "[FAIL]" |
| 240 | exitcode=1 |
| 241 | else |
| 242 | echo "[PASS]" |
| 243 | fi |
| 244 | |
SeongJae Park | 9e69fa4 | 2020-02-20 20:04:06 -0800 | [diff] [blame] | 245 | echo "-------------------------" |
| 246 | echo "running mlock-random-test" |
| 247 | echo "-------------------------" |
| 248 | ./mlock-random-test |
| 249 | if [ $? -ne 0 ]; then |
| 250 | echo "[FAIL]" |
| 251 | exitcode=1 |
| 252 | else |
| 253 | echo "[PASS]" |
| 254 | fi |
| 255 | |
Dmitry Safonov | 1caed86 | 2018-08-21 21:53:47 -0700 | [diff] [blame] | 256 | echo "--------------------" |
Eric B Munson | b3b0d09 | 2015-11-05 18:51:43 -0800 | [diff] [blame] | 257 | echo "running mlock2-tests" |
| 258 | echo "--------------------" |
| 259 | ./mlock2-tests |
| 260 | if [ $? -ne 0 ]; then |
| 261 | echo "[FAIL]" |
| 262 | exitcode=1 |
| 263 | else |
| 264 | echo "[PASS]" |
| 265 | fi |
| 266 | |
Kalesh Singh | 7df6662 | 2020-12-14 19:07:25 -0800 | [diff] [blame] | 267 | echo "-------------------" |
| 268 | echo "running mremap_test" |
| 269 | echo "-------------------" |
| 270 | ./mremap_test |
| 271 | if [ $? -ne 0 ]; then |
| 272 | echo "[FAIL]" |
| 273 | exitcode=1 |
| 274 | else |
| 275 | echo "[PASS]" |
| 276 | fi |
| 277 | |
SeongJae Park | 9e69fa4 | 2020-02-20 20:04:06 -0800 | [diff] [blame] | 278 | echo "-----------------" |
| 279 | echo "running thuge-gen" |
| 280 | echo "-----------------" |
| 281 | ./thuge-gen |
| 282 | if [ $? -ne 0 ]; then |
| 283 | echo "[FAIL]" |
| 284 | exitcode=1 |
| 285 | else |
| 286 | echo "[PASS]" |
| 287 | fi |
| 288 | |
Masami Hiramatsu | 7549b33 | 2019-10-23 13:57:49 +0900 | [diff] [blame] | 289 | if [ $VADDR64 -ne 0 ]; then |
Anshuman Khandual | 4e5ce33 | 2017-05-08 16:00:19 -0700 | [diff] [blame] | 290 | echo "-----------------------------" |
| 291 | echo "running virtual_address_range" |
| 292 | echo "-----------------------------" |
| 293 | ./virtual_address_range |
| 294 | if [ $? -ne 0 ]; then |
| 295 | echo "[FAIL]" |
| 296 | exitcode=1 |
| 297 | else |
| 298 | echo "[PASS]" |
| 299 | fi |
| 300 | |
Aneesh Kumar K.V | 235266b | 2018-01-31 16:16:59 -0800 | [diff] [blame] | 301 | echo "-----------------------------" |
| 302 | echo "running virtual address 128TB switch test" |
| 303 | echo "-----------------------------" |
| 304 | ./va_128TBswitch |
| 305 | if [ $? -ne 0 ]; then |
| 306 | echo "[FAIL]" |
| 307 | exitcode=1 |
| 308 | else |
| 309 | echo "[PASS]" |
| 310 | fi |
Masami Hiramatsu | 7549b33 | 2019-10-23 13:57:49 +0900 | [diff] [blame] | 311 | fi # VADDR64 |
Aneesh Kumar K.V | 235266b | 2018-01-31 16:16:59 -0800 | [diff] [blame] | 312 | |
Uladzislau Rezki (Sony) | a05ef00 | 2019-03-05 15:43:37 -0800 | [diff] [blame] | 313 | echo "------------------------------------" |
| 314 | echo "running vmalloc stability smoke test" |
| 315 | echo "------------------------------------" |
| 316 | ./test_vmalloc.sh smoke |
| 317 | ret_val=$? |
| 318 | |
| 319 | if [ $ret_val -eq 0 ]; then |
| 320 | echo "[PASS]" |
| 321 | elif [ $ret_val -eq $ksft_skip ]; then |
| 322 | echo "[SKIP]" |
| 323 | exitcode=$ksft_skip |
| 324 | else |
| 325 | echo "[FAIL]" |
| 326 | exitcode=1 |
| 327 | fi |
| 328 | |
Brian Geffon | 0c28759 | 2020-04-01 21:09:20 -0700 | [diff] [blame] | 329 | echo "------------------------------------" |
| 330 | echo "running MREMAP_DONTUNMAP smoke test" |
| 331 | echo "------------------------------------" |
| 332 | ./mremap_dontunmap |
| 333 | ret_val=$? |
| 334 | |
| 335 | if [ $ret_val -eq 0 ]; then |
| 336 | echo "[PASS]" |
| 337 | elif [ $ret_val -eq $ksft_skip ]; then |
| 338 | echo "[SKIP]" |
| 339 | exitcode=$ksft_skip |
| 340 | else |
| 341 | echo "[FAIL]" |
| 342 | exitcode=1 |
| 343 | fi |
Ralph Campbell | fee9f6d | 2020-04-22 12:50:27 -0700 | [diff] [blame] | 344 | |
| 345 | echo "running HMM smoke test" |
| 346 | echo "------------------------------------" |
| 347 | ./test_hmm.sh smoke |
| 348 | ret_val=$? |
| 349 | |
| 350 | if [ $ret_val -eq 0 ]; then |
| 351 | echo "[PASS]" |
| 352 | elif [ $ret_val -eq $ksft_skip ]; then |
| 353 | echo "[SKIP]" |
| 354 | exitcode=$ksft_skip |
| 355 | else |
| 356 | echo "[FAIL]" |
| 357 | exitcode=1 |
| 358 | fi |
| 359 | |
David Hildenbrand | e5bfac5 | 2021-06-30 18:52:39 -0700 | [diff] [blame] | 360 | echo "--------------------------------------------------------" |
| 361 | echo "running MADV_POPULATE_READ and MADV_POPULATE_WRITE tests" |
| 362 | echo "--------------------------------------------------------" |
| 363 | ./madv_populate |
| 364 | ret_val=$? |
| 365 | |
| 366 | if [ $ret_val -eq 0 ]; then |
| 367 | echo "[PASS]" |
| 368 | elif [ $ret_val -eq $ksft_skip ]; then |
| 369 | echo "[SKIP]" |
| 370 | exitcode=$ksft_skip |
| 371 | else |
| 372 | echo "[FAIL]" |
| 373 | exitcode=1 |
| 374 | fi |
| 375 | |
Mike Rapoport | 76fe17e | 2021-07-07 18:08:15 -0700 | [diff] [blame] | 376 | echo "running memfd_secret test" |
| 377 | echo "------------------------------------" |
| 378 | ./memfd_secret |
| 379 | ret_val=$? |
| 380 | |
| 381 | if [ $ret_val -eq 0 ]; then |
| 382 | echo "[PASS]" |
| 383 | elif [ $ret_val -eq $ksft_skip ]; then |
| 384 | echo "[SKIP]" |
| 385 | exitcode=$ksft_skip |
| 386 | else |
| 387 | echo "[FAIL]" |
| 388 | exitcode=1 |
| 389 | fi |
| 390 | |
Zhansaya Bagdauletkyzy | 68d6289 | 2021-09-02 15:00:39 -0700 | [diff] [blame] | 391 | echo "-------------------------------------------------------" |
| 392 | echo "running KSM MADV_MERGEABLE test with 10 identical pages" |
| 393 | echo "-------------------------------------------------------" |
Zhansaya Bagdauletkyzy | a40c80e | 2021-09-02 15:00:42 -0700 | [diff] [blame] | 394 | ./ksm_tests -M -p 10 |
| 395 | ret_val=$? |
| 396 | |
| 397 | if [ $ret_val -eq 0 ]; then |
| 398 | echo "[PASS]" |
| 399 | elif [ $ret_val -eq $ksft_skip ]; then |
| 400 | echo "[SKIP]" |
| 401 | exitcode=$ksft_skip |
| 402 | else |
| 403 | echo "[FAIL]" |
| 404 | exitcode=1 |
| 405 | fi |
| 406 | |
| 407 | echo "------------------------" |
| 408 | echo "running KSM unmerge test" |
| 409 | echo "------------------------" |
| 410 | ./ksm_tests -U |
Zhansaya Bagdauletkyzy | 68d6289 | 2021-09-02 15:00:39 -0700 | [diff] [blame] | 411 | ret_val=$? |
| 412 | |
| 413 | if [ $ret_val -eq 0 ]; then |
| 414 | echo "[PASS]" |
| 415 | elif [ $ret_val -eq $ksft_skip ]; then |
| 416 | echo "[SKIP]" |
| 417 | exitcode=$ksft_skip |
| 418 | else |
| 419 | echo "[FAIL]" |
| 420 | exitcode=1 |
| 421 | fi |
| 422 | |
Zhansaya Bagdauletkyzy | 3961998 | 2021-09-02 15:00:45 -0700 | [diff] [blame] | 423 | echo "----------------------------------------------------------" |
| 424 | echo "running KSM test with 10 zero pages and use_zero_pages = 0" |
| 425 | echo "----------------------------------------------------------" |
| 426 | ./ksm_tests -Z -p 10 -z 0 |
| 427 | ret_val=$? |
| 428 | |
| 429 | if [ $ret_val -eq 0 ]; then |
| 430 | echo "[PASS]" |
| 431 | elif [ $ret_val -eq $ksft_skip ]; then |
| 432 | echo "[SKIP]" |
| 433 | exitcode=$ksft_skip |
| 434 | else |
| 435 | echo "[FAIL]" |
| 436 | exitcode=1 |
| 437 | fi |
| 438 | |
| 439 | echo "----------------------------------------------------------" |
| 440 | echo "running KSM test with 10 zero pages and use_zero_pages = 1" |
| 441 | echo "----------------------------------------------------------" |
| 442 | ./ksm_tests -Z -p 10 -z 1 |
| 443 | ret_val=$? |
| 444 | |
| 445 | if [ $ret_val -eq 0 ]; then |
| 446 | echo "[PASS]" |
| 447 | elif [ $ret_val -eq $ksft_skip ]; then |
| 448 | echo "[SKIP]" |
| 449 | exitcode=$ksft_skip |
| 450 | else |
| 451 | echo "[FAIL]" |
| 452 | exitcode=1 |
| 453 | fi |
| 454 | |
Zhansaya Bagdauletkyzy | 82e717a | 2021-09-02 15:00:48 -0700 | [diff] [blame] | 455 | echo "-------------------------------------------------------------" |
| 456 | echo "running KSM test with 2 NUMA nodes and merge_across_nodes = 1" |
| 457 | echo "-------------------------------------------------------------" |
| 458 | ./ksm_tests -N -m 1 |
| 459 | ret_val=$? |
| 460 | |
| 461 | if [ $ret_val -eq 0 ]; then |
| 462 | echo "[PASS]" |
| 463 | elif [ $ret_val -eq $ksft_skip ]; then |
| 464 | echo "[SKIP]" |
| 465 | exitcode=$ksft_skip |
| 466 | else |
| 467 | echo "[FAIL]" |
| 468 | exitcode=1 |
| 469 | fi |
| 470 | |
| 471 | echo "-------------------------------------------------------------" |
| 472 | echo "running KSM test with 2 NUMA nodes and merge_across_nodes = 0" |
| 473 | echo "-------------------------------------------------------------" |
| 474 | ./ksm_tests -N -m 0 |
| 475 | ret_val=$? |
| 476 | |
| 477 | if [ $ret_val -eq 0 ]; then |
| 478 | echo "[PASS]" |
| 479 | elif [ $ret_val -eq $ksft_skip ]; then |
| 480 | echo "[SKIP]" |
| 481 | exitcode=$ksft_skip |
| 482 | else |
| 483 | echo "[FAIL]" |
| 484 | exitcode=1 |
| 485 | fi |
| 486 | |
Mike Rapoport | 76fe17e | 2021-07-07 18:08:15 -0700 | [diff] [blame] | 487 | exit $exitcode |
| 488 | |
Joern Engel | 51a1d16 | 2013-07-03 15:09:17 -0700 | [diff] [blame] | 489 | exit $exitcode |