selftests: check percentage range for memory-hotplug test
authorPo-Hsu Lin <po-hsu.lin@canonical.com>
Tue, 27 Jun 2017 06:17:13 +0000 (14:17 +0800)
committerShuah Khan <shuahkh@osg.samsung.com>
Fri, 30 Jun 2017 16:06:22 +0000 (10:06 -0600)
Check the precentage range for -r flag in memory-hotplug test.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh

index 993ff2bcfc7b9d0910403eadebe77b2022288449..c735ece968f862805ad26df1d1c7772c40059811 100755 (executable)
@@ -136,6 +136,10 @@ while getopts e:hp:r: opt; do
                ;;
        r)
                ratio=$OPTARG
+               if [ "$ratio" -gt 100 ] || [ "$ratio" -lt 0 ]; then
+                       echo "The percentage should be an integer within 0~100 range"
+                       exit 1
+               fi
                ;;
        esac
 done