Skip to contentSkip to conversation

selftests/lkdtm: Use "comm" instead of "diff" for dmesg

PATCH In review Kees Cook 3 participants 3 messages Sep 9, 2020 – Sep 10, 2020

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH v2 1/1 selftests/lkdtm: Use "comm" instead of "diff" for dmesg

Instead of full GNU diff (which smaller boot environments may not have), use "comm" which is more available.

Cc Shuah Khan <[email protected]>
Fixes f131d9edc29d ("selftests/lkdtm: Don't clear dmesg when running tests")

---
v2: add --nocheck-order, thanks to Joe Lawrence
v1: https://lore.kernel.org/lkml/202006261358.3E8AA623A9@keescook/

---
 tools/testing/selftests/lkdtm/run.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/lkdtm/run.sh +1 -1
index 8383eb89d88a..bb7a1775307b 100755
@@ -82,7 +82,7 @@ dmesg > "$DMESG"
 ($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true
 
 # Record and dump the results
-dmesg | diff --changed-group-format='%>' --unchanged-group-format='' "$DMESG" - > "$LOG" || true
+dmesg | comm --nocheck-order -13 "$DMESG" - > "$LOG" || true
 
 cat "$LOG"
 # Check for expected output
Signature · 1 line
2.25.1
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 21 lines · Kees Cook

Instead of full GNU diff (which smaller boot environments may not have), use "comm" which is more available.

Cc Shuah Khan <[email protected]>
Fixes f131d9edc29d ("selftests/lkdtm: Don't clear dmesg when running tests")

---
v2: add --nocheck-order, thanks to Joe Lawrence
v1: https://lore.kernel.org/lkml/202006261358.3E8AA623A9@keescook/

---
  tools/testing/selftests/lkdtm/run.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/lkdtm/run.sh +0 -0
index 8383eb89d88a..bb7a1775307b 100755

tools/testing/selftests/lkdtm/run.sh dmesg > "$DMESG" · line 88

Quoted 8 lines
tools/testing/selftests/lkdtm/run.sh +1 -1
@@ -82,7 +82,7 @@ dmesg > "$DMESG"
  ($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true
 
  # Record and dump the results
-dmesg | diff --changed-group-format='%>' --unchanged-group-format='' "$DMESG" - > "$LOG" || true
+dmesg | comm --nocheck-order -13 "$DMESG" - > "$LOG" || true
 
  cat "$LOG"
  # Check for expected output

Greg,

Would you like me to take this through kselftest tree?

If you want to take it through lkdtm tree, here is my Ack:

thanks,
-- Shuah

#2 lore raw
Quoted 31 lines · Shuah Khan
Quoted 20 lines · Kees Cook

Instead of full GNU diff (which smaller boot environments may not have), use "comm" which is more available.

Cc Shuah Khan <[email protected]>
Fixes f131d9edc29d ("selftests/lkdtm: Don't clear dmesg when running tests")

---
v2: add --nocheck-order, thanks to Joe Lawrence
v1: https://lore.kernel.org/lkml/202006261358.3E8AA623A9@keescook/

---
  tools/testing/selftests/lkdtm/run.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/lkdtm/run.sh +0 -0
index 8383eb89d88a..bb7a1775307b 100755

tools/testing/selftests/lkdtm/run.sh dmesg > "$DMESG" · line 87

Quoted 7 lines
tools/testing/selftests/lkdtm/run.sh +1 -1
@@ -82,7 +82,7 @@ dmesg > "$DMESG"
  ($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true
  # Record and dump the results
-dmesg | diff --changed-group-format='%>' --unchanged-group-format='' "$DMESG" - > "$LOG" || true
+dmesg | comm --nocheck-order -13 "$DMESG" - > "$LOG" || true
  cat "$LOG"
  # Check for expected output
 

Greg,

Quoted 5 lines

Would you like me to take this through kselftest tree?

If you want to take it through lkdtm tree, here is my Ack:

Thanks, I'll take it.

greg k-h