Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/bash
0002 # SPDX-License-Identifier: GPL-2.0-or-later
0003 # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
0004 #
0005 # Test checks that we can create swap zram device.
0006 #
0007 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
0008 # Modified: Naresh Kamboju <naresh.kamboju@linaro.org>
0009 
0010 TCID="zram02"
0011 ERR_CODE=0
0012 
0013 . ./zram_lib.sh
0014 
0015 # Test will create the following number of zram devices:
0016 dev_num=1
0017 # This is a list of parameters for zram devices.
0018 # Number of items must be equal to 'dev_num' parameter.
0019 zram_max_streams="2"
0020 
0021 # The zram sysfs node 'disksize' value can be either in bytes,
0022 # or you can use mem suffixes. But in some old kernels, mem
0023 # suffixes are not supported, for example, in RHEL6.6GA's kernel
0024 # layer, it uses strict_strtoull() to parse disksize which does
0025 # not support mem suffixes, in some newer kernels, they use
0026 # memparse() which supports mem suffixes. So here we just use
0027 # bytes to make sure everything works correctly.
0028 zram_sizes="1048576" # 1M
0029 zram_mem_limits="1M"
0030 
0031 check_prereqs
0032 zram_load
0033 zram_max_streams
0034 zram_set_disksizes
0035 zram_set_memlimit
0036 zram_makeswap
0037 zram_swapoff
0038 zram_cleanup
0039 
0040 if [ $ERR_CODE -ne 0 ]; then
0041         echo "$TCID : [FAIL]"
0042 else
0043         echo "$TCID : [PASS]"
0044 fi