1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3TCID="zram.sh"
4
5# Kselftest framework requirement - SKIP code is 4.
6ksft_skip=4
7
8. ./zram_lib.sh
9
10run_zram () {
11echo "--------------------"
12echo "running zram tests"
13echo "--------------------"
14./zram01.sh
15echo ""
16./zram02.sh
17}
18
19check_prereqs
20
21# check zram module exists
22MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
23if [ -f $MODULE_PATH ]; then
24	run_zram
25elif [ -b /dev/zram0 ]; then
26	run_zram
27else
28	echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
29	echo "$TCID : CONFIG_ZRAM is not set"
30	exit $ksft_skip
31fi
32