[LTP] [PATCH 2/2] Optimise grep action in cpuset_syscall_test
Yuan Sun
sunyuan3@huawei.com
Thu Oct 15 03:21:29 CEST 2015
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
---
.../cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh
index 771b642..9d3e4c8 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh
@@ -188,7 +188,7 @@ test7()
do_syscall_test 0 0 --mbind=1 0 || return $?
memory_addr="$(cat $TEST_OUTPUT)"
memory_addr=${memory_addr##*0x}
- allowed_list=$(cat $TEST_PROCNUMA | grep "$memory_addr" | \
+ allowed_list=$(grep "$memory_addr" $TEST_PROCNUMA | \
awk '{print $2}')
allowed_list="$(echo $allowed_list | sed -e s/bind://)"
test "$allowed_list" = "0" || return 1
@@ -204,7 +204,7 @@ test8()
do_syscall_test 0 0-1 --mbind=1 0 || return $?
memory_addr="$(cat $TEST_OUTPUT)"
memory_addr=${memory_addr##*0x}
- allowed_list=$(cat $TEST_PROCNUMA | grep "$memory_addr" | \
+ allowed_list=$(grep "$memory_addr" $TEST_PROCNUMA | \
awk '{print $2}')
allowed_list="$(echo $allowed_list | sed -e s/bind://)"
test "$allowed_list" = "0"
@@ -220,7 +220,7 @@ test9()
do_syscall_test 0 0-1 --mbind=6 0 || return $?
memory_addr="$(cat $TEST_OUTPUT)"
memory_addr=${memory_addr##*0x}
- allowed_list=$(cat $TEST_PROCNUMA | grep "$memory_addr" | \
+ allowed_list=$(grep "$memory_addr" $TEST_PROCNUMA | \
awk '{print $2}')
allowed_list="$(echo $allowed_list | sed -e s/bind://)"
test "$allowed_list" = "1"
@@ -236,12 +236,12 @@ test10()
do_syscall_test 0 0 --mbind=6 1 || return $?
memory_addr="$(cat $TEST_OUTPUT)"
memory_addr=${memory_addr##*0x}
- allowed_list=$(cat $TEST_PROCNUMA | grep "$memory_addr" | \
+ allowed_list=$(grep "$memory_addr" $TEST_PROCNUMA | \
awk '{print $2}')
allowed_list="$(echo $allowed_list | sed -e s/bind://)"
- task_policy=$(cat $TEST_PROCNUMA | grep -e " *stack *anon" | \
- awk '{print $2}')
+ task_policy=$(grep -e " *stack *anon" | \
+ awk '{print $2}' $TEST_PROCNUMA)
test "$allowed_list" = "$task_policy"
if [ $? -ne 0 ]; then
--
1.9.1
More information about the Ltp
mailing list