Home | History | Annotate | Download | only in zram
      1 #!/bin/sh
      2 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
      3 #
      4 # This program is free software; you can redistribute it and/or
      5 # modify it under the terms of the GNU General Public License as
      6 # published by the Free Software Foundation; either version 2 of
      7 # the License, or (at your option) any later version.
      8 #
      9 # This program is distributed in the hope that it would be useful,
     10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 # GNU General Public License for more details.
     13 #
     14 # You should have received a copy of the GNU General Public License
     15 # along with this program; if not, write the Free Software Foundation,
     16 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     17 #
     18 # Test checks that we can create swap zram device.
     19 #
     20 # Author: Alexey Kodanev <alexey.kodanev (at] oracle.com>
     21 
     22 TCID="zram02"
     23 TST_TOTAL=7
     24 
     25 . test.sh
     26 . zram_lib.sh
     27 
     28 # Test will create the following number of zram devices:
     29 dev_num=1
     30 # This is a list of parameters for zram devices.
     31 # Number of items must be equal to 'dev_num' parameter.
     32 zram_max_streams="2"
     33 
     34 # The zram sysfs node 'disksize' value can be either in bytes,
     35 # or you can use mem suffixes. But in some old kernels, mem
     36 # suffixes are not supported, for example, in RHEL6.6GA's kernel
     37 # layer, it uses strict_strtoull() to parse disksize which does
     38 # not support mem suffixes, in some newer kernels, they use
     39 # memparse() which supports mem suffixes. So here we just use
     40 # bytes to make sure everything works correctly.
     41 zram_sizes="107374182400" # 100GB
     42 zram_mem_limits="1M"
     43 
     44 TST_CLEANUP="zram_cleanup"
     45 
     46 zram_load
     47 zram_max_streams
     48 zram_set_disksizes
     49 zram_set_memlimit
     50 zram_makeswap
     51 zram_swapoff
     52 
     53 tst_exit
     54