public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] cpuset: skip test when cpu or nodes are not numbered continously from 0
Date: Thu, 14 Jan 2021 09:40:50 +0800	[thread overview]
Message-ID: <5FFFA122.3060702@cn.fujitsu.com> (raw)
In-Reply-To: <X/8ehCeZbWs6TIA4@yuki.lan>

Hi Cyril

I will send a v3 for these comments.

Best Regards
Yang Xu
> Hi!
>> diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
>> index f4365af2c..5b1bde114 100755
>> --- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
>> +++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
>> @@ -26,23 +26,34 @@
>>
>>   . test.sh
>>
>> +cpu_string="`cat /sys/devices/system/cpu/online`"
>>   NR_CPUS=`tst_ncpus`
>> +
>>   if [ -f "/sys/devices/system/node/has_high_memory" ]; then
>> -	N_NODES="`cat /sys/devices/system/node/has_high_memory | tr ',' ' '`"
>> +	mem_string="`cat /sys/devices/system/node/has_high_memory`"
>>   else
>> -	N_NODES="`cat /sys/devices/system/node/has_normal_memory | tr ',' ' '`"
>> +	mem_string="`cat /sys/devices/system/node/has_normal_memory`"
>>   fi
>> +N_NODES="`echo $mem_string | tr ',' ' '`"
>>   count=0
>> +final_node=0
>>   for item in $N_NODES; do
>>   	delta=1
>>   	if [ "${item#*-*}" != "$item" ]; then
>>   		delta=$((${item#*-*} - ${item%*-*} + 1))
>>   	fi
>> +	final_node=${item#*-*}
>>   	count=$((count + $delta))
>>   done
>> +final_node=`expr $final_node + 1`
>
> Why don't we use $(()) as in the rest of the code?
>
>>   N_NODES=$count
>>
>> -mem_string="$N_NODES"
>> +final_cpu=0
>> +N_CPUS="`echo $cpu_string | tr ',' ' '`"
>> +for item in $N_CPUS; do
>> +	final_cpu=${item#*-*}
>> +done
>> +final_cpu=`expr $final_cpu + 1`
>
> Here as well.
>
>>   CPUSET="/dev/cpuset"
>>   CPUSET_TMP="/tmp/cpuset_tmp"
>> @@ -78,6 +89,12 @@ ncpus_check()
>>   	if [ $NR_CPUS -lt $1 ]; then
>>   		tst_brkm TCONF "The total of CPUs is less than $1"
>>   	fi
>> +	# check online cpu whether match 0-num
>> +	if [ $final_cpu -eq $NR_CPUS ]; then
>> +		tst_resm TINFO "cpus enable continuously from 0($cpu_string)"
>                                       ^
> 				     This does not make much sense.
>
> This should probably be:
> 	"CPUs numbered continuously starting at 0 ($cpu_string)"
>
>
>> +	else
>> +		tst_brkm TCONF "cpus don't enable continuously from 0($cpu_string)"
>
> Here it should be:
> 	"CPUs are not numbered continuously starting at 0 ($cpu_string)"
>
>> +	fi
>>   }
>>
>>   nnodes_check()
>> @@ -85,6 +102,12 @@ nnodes_check()
>>   	if [ $N_NODES -lt $1 ]; then
>>   		tst_brkm TCONF "The total of nodes is less than $1"
>>   	fi
>> +	# check online whether match 0-num
>> +	if [ $final_node -eq $count ]; then
>                                 ^
> 			I guess that N_NODES would be better here.
>
>> +		tst_resm TINFO "nodes enable continuously from 0($mem_string)"
>> +	else
>> +		tst_brkm TCONF "nodes don't enable continuously from 0($mem_string)"
>
> These two messages should be adjusted as well.
>
>> +	fi
>>   }
>>
>>   user_check()
>> --
>> 2.23.0
>>
>>
>>
>




  reply	other threads:[~2021-01-14  1:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30  2:06 [LTP] [PATCH] cpuset_inherit: Use the original mem value instead of N_NODES Yang Xu
2021-01-08 13:26 ` Cyril Hrubis
2021-01-11  9:04   ` Yang Xu
2021-01-12 10:44     ` Yang Xu
2021-01-12 15:17       ` Cyril Hrubis
2021-01-13  9:24         ` Yang Xu
2021-01-13 12:03         ` [LTP] [PATCH v2] cpuset: skip test when cpu or nodes are not numbered continously from 0 Yang Xu
2021-01-13 16:23           ` Cyril Hrubis
2021-01-14  1:40             ` Yang Xu [this message]
2021-01-14  2:18             ` [LTP] [PATCH v3 1/2] cpuset: skip test when cpu or nodes are not numbered continuously " Yang Xu
2021-01-14  2:18               ` [LTP] [PATCH v3 2/2] cpuset_inherit: Remove redundant cpu_string assignment Yang Xu
2021-01-19 11:22                 ` Petr Vorel
2021-01-19 11:51                 ` Cyril Hrubis
2021-01-18  8:16               ` [LTP] [PATCH v3 1/2] cpuset: skip test when cpu or nodes are not numbered continuously from 0 Yang Xu
2021-01-19 11:21                 ` Petr Vorel
2021-01-20  1:45                   ` Yang Xu
2021-01-19 11:50               ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5FFFA122.3060702@cn.fujitsu.com \
    --to=xuyang2018.jy@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox