selftests/lkdtm: Use "comm" instead of "diff" for dmesg
Subsystems (2)
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.
---
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
@@ -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
Quoted 21 lines · Kees Cook
Instead of full GNU diff (which smaller boot environments may not have), use "comm" which is more available.
Reported-by Naresh Kamboju <[email protected]>Cc Shuah Khan <[email protected]>Fixes f131d9edc29d ("selftests/lkdtm: Don't clear dmesg when running tests")Signed-off-by Kees Cook <[email protected]>---
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
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
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.
Reported-by Naresh Kamboju <[email protected]>Cc Shuah Khan <[email protected]>Fixes f131d9edc29d ("selftests/lkdtm: Don't clear dmesg when running tests")Signed-off-by Kees Cook <[email protected]>---
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
-0tools/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 outputGreg,
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:
Acked-by Shuah Khan <[email protected]>
Thanks, I'll take it.
greg k-h