mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/cgroup: Fix awk usage in test_cpuset_prs.sh that may cause error
@ 2023-09-25 19:38 Juntong Deng
  2023-09-26 12:18 ` Waiman Long
  0 siblings, 1 reply; 3+ messages in thread
From: Juntong Deng @ 2023-09-25 19:38 UTC (permalink / raw)
  To: longman, lizefan.x, tj, hannes, shuah
  Cc: cgroups, linux-kselftest, linux-kernel, linux-kernel-mentees

According to the awk manual, the -e option does not need to be specified
in front of 'program' (unless you need to mix program-file).

The redundant -e option can cause error when users use awk tools other
than gawk (for example, mawk does not support the -e option).

Error Example:
awk: not an option: -e
Cgroup v2 mount point not found!

Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
---
 tools/testing/selftests/cgroup/test_cpuset_prs.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
index 4afb132e4e4f..6820653e8432 100755
--- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
+++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
@@ -20,7 +20,7 @@ skip_test() {
 WAIT_INOTIFY=$(cd $(dirname $0); pwd)/wait_inotify
 
 # Find cgroup v2 mount point
-CGROUP2=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
+CGROUP2=$(mount -t cgroup2 | head -1 | awk '{print $3}')
 [[ -n "$CGROUP2" ]] || skip_test "Cgroup v2 mount point not found!"
 
 CPUS=$(lscpu | grep "^CPU(s):" | sed -e "s/.*:[[:space:]]*//")
-- 
2.39.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/cgroup: Fix awk usage in test_cpuset_prs.sh that may cause error
  2023-09-25 19:38 [PATCH] selftests/cgroup: Fix awk usage in test_cpuset_prs.sh that may cause error Juntong Deng
@ 2023-09-26 12:18 ` Waiman Long
  2023-10-29 21:23   ` Juntong Deng
  0 siblings, 1 reply; 3+ messages in thread
From: Waiman Long @ 2023-09-26 12:18 UTC (permalink / raw)
  To: Juntong Deng, lizefan.x, tj, hannes, shuah
  Cc: cgroups, linux-kselftest, linux-kernel, linux-kernel-mentees

On 9/25/23 15:38, Juntong Deng wrote:
> According to the awk manual, the -e option does not need to be specified
> in front of 'program' (unless you need to mix program-file).
>
> The redundant -e option can cause error when users use awk tools other
> than gawk (for example, mawk does not support the -e option).
>
> Error Example:
> awk: not an option: -e
> Cgroup v2 mount point not found!
>
> Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
> ---
>   tools/testing/selftests/cgroup/test_cpuset_prs.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> index 4afb132e4e4f..6820653e8432 100755
> --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> @@ -20,7 +20,7 @@ skip_test() {
>   WAIT_INOTIFY=$(cd $(dirname $0); pwd)/wait_inotify
>   
>   # Find cgroup v2 mount point
> -CGROUP2=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
> +CGROUP2=$(mount -t cgroup2 | head -1 | awk '{print $3}')
>   [[ -n "$CGROUP2" ]] || skip_test "Cgroup v2 mount point not found!"
>   
>   CPUS=$(lscpu | grep "^CPU(s):" | sed -e "s/.*:[[:space:]]*//")

Yes, the -e option is redundant. Thanks for catching that.

Acked-by: Waiman Long <longman@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/cgroup: Fix awk usage in test_cpuset_prs.sh that may cause error
  2023-09-26 12:18 ` Waiman Long
@ 2023-10-29 21:23   ` Juntong Deng
  0 siblings, 0 replies; 3+ messages in thread
From: Juntong Deng @ 2023-10-29 21:23 UTC (permalink / raw)
  To: Waiman Long, lizefan.x, tj, hannes, shuah
  Cc: cgroups, linux-kselftest, linux-kernel, linux-kernel-mentees

On 2023/9/26 20:18, Waiman Long wrote:
> On 9/25/23 15:38, Juntong Deng wrote:
>> According to the awk manual, the -e option does not need to be specified
>> in front of 'program' (unless you need to mix program-file).
>>
>> The redundant -e option can cause error when users use awk tools other
>> than gawk (for example, mawk does not support the -e option).
>>
>> Error Example:
>> awk: not an option: -e
>> Cgroup v2 mount point not found!
>>
>> Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
>> ---
>>   tools/testing/selftests/cgroup/test_cpuset_prs.sh | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh 
>> b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
>> index 4afb132e4e4f..6820653e8432 100755
>> --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
>> +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
>> @@ -20,7 +20,7 @@ skip_test() {
>>   WAIT_INOTIFY=$(cd $(dirname $0); pwd)/wait_inotify
>>   # Find cgroup v2 mount point
>> -CGROUP2=$(mount -t cgroup2 | head -1 | awk -e '{print $3}')
>> +CGROUP2=$(mount -t cgroup2 | head -1 | awk '{print $3}')
>>   [[ -n "$CGROUP2" ]] || skip_test "Cgroup v2 mount point not found!"
>>   CPUS=$(lscpu | grep "^CPU(s):" | sed -e "s/.*:[[:space:]]*//")
> 
> Yes, the -e option is redundant. Thanks for catching that.
> 
> Acked-by: Waiman Long <longman@redhat.com>
> 

Hi Shuah, this patch has been acked but does not seem to have been
applied yet.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-29 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25 19:38 [PATCH] selftests/cgroup: Fix awk usage in test_cpuset_prs.sh that may cause error Juntong Deng
2023-09-26 12:18 ` Waiman Long
2023-10-29 21:23   ` Juntong Deng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®