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@oracle.com>
21
22TCID="zram02"
23TST_TOTAL=7
24
25. test.sh
26. zram_lib.sh
27
28# Test will create the following number of zram devices:
29dev_num=1
30# This is a list of parameters for zram devices.
31# Number of items must be equal to 'dev_num' parameter.
32zram_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.
41zram_sizes="107374182400" # 100GB
42zram_mem_limits="1M"
43
44TST_CLEANUP="zram_cleanup"
45
46zram_load
47zram_max_streams
48zram_set_disksizes
49zram_set_memlimit
50zram_makeswap
51zram_swapoff
52
53tst_exit
54