Просмотр исходного кода

selftests: check percentage range for memory-hotplug test

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>
Po-Hsu Lin 8 лет назад
Родитель
Сommit
72441ea588
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      tools/testing/selftests/memory-hotplug/mem-on-off-test.sh

+ 4 - 0
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh

@@ -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