Simplify grep actions in power_management.
PATCH 1/2 Simplify grep actions in power_management.
Signed-off-by Yuan Sun <[email protected]>
--- testcases/kernel/power_management/pm_include.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
testcases/kernel/power_management/pm_include.sh +6 -6
@@ -87,8 +87,8 @@ get_supporting_govr() { } is_hyper_threaded() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` + siblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'` + cpu_cores=`grep "cpu cores" /proc/cpuinfo | uniq | cut -f2 -d':'` [ $siblings -gt $cpu_cores ]; echo $? }
@@ -131,8 +131,8 @@ is_multi_socket() { } is_multi_core() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` + siblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'` + cpu_cores=`grep "cpu cores" /proc/cpuinfo | uniq | cut -f2 -d':'` if [ $siblings -eq $cpu_cores ]; then [ $cpu_cores -gt 1 ]; echo $? else
@@ -142,8 +142,8 @@ is_multi_core() { } is_dual_core() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq \ + siblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'` + cpu_cores=`grep "cpu cores" /proc/cpuinfo | uniq \ | cut -f2 -d':'` if [ $siblings -eq $cpu_cores ]; then [ $cpu_cores -eq 2 ]; echo $?
Signature · 1 line
1.9.1
PATCH 2/2 Simplify grep actions in cpuset_syscall_test.
Signed-off-by Yuan Sun <[email protected]>
--- .../cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh +5 -5
@@ -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,11 +236,11 @@ 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" | \ + task_policy=$(grep -e " *stack *anon" $TEST_PROCNUMA | \ awk '{print $2}') test "$allowed_list" = "$task_policy"
Signature · 1 line
1.9.1
PATCH 1/2 Simplify grep actions in power_management.
In reply to Yuan Sun----- Original Message -----
Quoted 7 lines
From: "Yuan Sun" <[email protected]>
To: [email protected], [email protected]
Cc: [email protected]
Sent: Monday, 9 November, 2015 9:05:33 AM
Subject: [PATCH 1/2] Simplify grep actions inpower_management.Signed-off-by Yuan Sun <[email protected]>
Both pushed.
Regards,
Jan
Quoted 46 lines
--- testcases/kernel/power_management/pm_include.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)testcases/kernel/power_management/pm_include.sh +6
-7@@ -87,8 +87,8 @@ get_supporting_govr() { } is_hyper_threaded() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` + siblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'` + cpu_cores=`grep "cpu cores" /proc/cpuinfo | uniq | cut -f2 -d':'` [ $siblings -gt $cpu_cores ]; echo $? }@@ -131,8 +131,8 @@ is_multi_socket() { } is_multi_core() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'` + siblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'` + cpu_cores=`grep "cpu cores" /proc/cpuinfo | uniq | cut -f2 -d':'` if [ $siblings -eq $cpu_cores ]; then [ $cpu_cores -gt 1 ]; echo $? else@@ -142,8 +142,8 @@ is_multi_core() { } is_dual_core() { - siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'` - cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq \ + siblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'` + cpu_cores=`grep "cpu cores" /proc/cpuinfo | uniq \ | cut -f2 -d':'` if [ $siblings -eq $cpu_cores ]; then [ $cpu_cores -eq 2 ]; echo $? --1.9.1