Skip to content

Commit

Permalink
Squash to "selftests: mptcp: add evts_get_info helper"
Browse files Browse the repository at this point in the history
Fixed info and style issues reported by ShellCheck:

  In tools/testing/selftests/net/mptcp/mptcp_lib.sh line 213:
          grep "${2}" | sed -n 's/.*\('${1}':\)\([0-9a-f:.]*\).*$/\2/p;q'
                                       ^--^ SC2086 (info): Double quote to prevent globbing and word splitting.

  Did you mean:
          grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q'

  In tools/testing/selftests/net/mptcp/mptcp_lib.sh line 218:
          cat "${2}" | mptcp_lib_get_info_value "${1}" "^type:${3:-1},"
              ^----^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.

The first one is just to be on the safe side and the second one is just
a bit better but still, there were the only two issues reported by
ShellCheck: better to fix them to easily spot important issues.

Signed-off-by: Matthieu Baerts <[email protected]>
  • Loading branch information
matttbe authored and intel-lab-lkp committed Oct 22, 2023
1 parent 24bf299 commit 79530a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/net/mptcp/mptcp_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ mptcp_lib_result_print_all_tap() {

# get the value of keyword $1 in the line marked by keyword $2
mptcp_lib_get_info_value() {
grep "${2}" | sed -n 's/.*\('${1}':\)\([0-9a-f:.]*\).*$/\2/p;q'
grep "${2}" | sed -n 's/.*\('"${1}"':\)\([0-9a-f:.]*\).*$/\2/p;q'
}

# $1: info name ; $2: evts_ns ; $3: event type
mptcp_lib_evts_get_info() {
cat "${2}" | mptcp_lib_get_info_value "${1}" "^type:${3:-1},"
mptcp_lib_get_info_value "${1}" "^type:${3:-1}," < "${2}"
}

# $1: PID
Expand Down

0 comments on commit 79530a6

Please sign in to comment.