• Kajol Jain's avatar
    perf test stat_bpf_counters_cgrp: Fix shellcheck issue about logical operators · 0dd1f815
    Kajol Jain authored
    Running shellcheck on lock_contention.sh generates below warning:
    
    In stat_bpf_counters_cgrp.sh line 28:
    	if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; then
                                                ^-- SC2166 (warning): Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
    
    In stat_bpf_counters_cgrp.sh line 34:
    	local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
            ^-------------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
                  ^-------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
                            ^-- SC2046 (warning): Quote this to prevent word splitting.
    
    In stat_bpf_counters_cgrp.sh line 51:
    	local output
            ^----------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
    
    In stat_bpf_counters_cgrp.sh line 65:
    	local output
            ^----------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
    
    Fixed above warnings by:
    - Changing the expression [p -a q] to [p] && [q].
    - Fixing shellcheck warnings for local usage, by prefixing
      function name to the variable.
    Signed-off-by: default avatarKajol Jain <kjain@linux.ibm.com>
    Acked-by: default avatarIan Rogers <irogers@google.com>
    Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: https://lore.kernel.org/r/20230709182800.53002-6-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    0dd1f815
stat_bpf_counters_cgrp.sh 2.05 KB