1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3 4# Kselftest framework requirement - SKIP code is 4. 5ksft_skip=4 6 7if [ $EUID -ne 0 ] 8then 9 echo "Run as root" 10 exit $ksft_skip 11fi 12 13damon_reclaim_enabled="/sys/module/damon_reclaim/parameters/enabled" 14if [ ! -f "$damon_reclaim_enabled" ] 15then 16 echo "No 'enabled' file. Maybe DAMON_RECLAIM not built" 17 exit $ksft_skip 18fi 19 20nr_kdamonds=$(pgrep kdamond | wc -l) 21if [ "$nr_kdamonds" -ne 0 ] 22then 23 echo "Another kdamond is running" 24 exit $ksft_skip 25fi 26 27echo Y > "$damon_reclaim_enabled" 28 29nr_kdamonds=$(pgrep kdamond | wc -l) 30if [ "$nr_kdamonds" -ne 1 ] 31then 32 echo "kdamond is not turned on" 33 exit 1 34fi 35 36echo N > "$damon_reclaim_enabled" 37nr_kdamonds=$(pgrep kdamond | wc -l) 38if [ "$nr_kdamonds" -ne 0 ] 39then 40 echo "kdamond is not turned off" 41 exit 1 42fi 43