Naresh Kamboju | f21fb79 | 2015-08-18 12:31:59 +0530 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | TCID="zram.sh" |
| 3 | |
Naresh Kamboju | 2dfb28e | 2015-08-31 17:11:55 +0530 | [diff] [blame] | 4 | check_prereqs() |
| 5 | { |
| 6 | local msg="skip all tests:" |
| 7 | |
| 8 | if [ $UID != 0 ]; then |
| 9 | echo $msg must be run as root >&2 |
| 10 | exit 0 |
| 11 | fi |
| 12 | } |
| 13 | |
Naresh Kamboju | f21fb79 | 2015-08-18 12:31:59 +0530 | [diff] [blame] | 14 | run_zram () { |
| 15 | echo "--------------------" |
| 16 | echo "running zram tests" |
| 17 | echo "--------------------" |
| 18 | ./zram01.sh |
| 19 | echo "" |
| 20 | ./zram02.sh |
| 21 | } |
| 22 | |
Naresh Kamboju | 2dfb28e | 2015-08-31 17:11:55 +0530 | [diff] [blame] | 23 | check_prereqs |
| 24 | |
Naresh Kamboju | f21fb79 | 2015-08-18 12:31:59 +0530 | [diff] [blame] | 25 | # check zram module exists |
| 26 | MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko |
| 27 | if [ -f $MODULE_PATH ]; then |
| 28 | run_zram |
| 29 | elif [ -b /dev/zram0 ]; then |
| 30 | run_zram |
| 31 | else |
| 32 | echo "$TCID : No zram.ko module or /dev/zram0 device file not found" |
| 33 | echo "$TCID : CONFIG_ZRAM is not set" |
| 34 | exit 1 |
| 35 | fi |