Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame^] | 1 | From 5e660f246bb04560692ac9fc144574732c7e19e7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alex Kiernan <alex.kiernan@gmail.com> |
| 3 | Date: Thu, 26 Jan 2023 08:28:16 +0000 |
| 4 | Subject: [PATCH 2/2] tests: Use `head -n1` for busybox compatibility |
| 5 | |
| 6 | Upstream-Status: Pending |
| 7 | Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> |
| 8 | --- |
| 9 | tests/keyctl/session/valid/runtest.sh | 4 ++-- |
| 10 | tests/keyctl/show/noargs/runtest.sh | 2 +- |
| 11 | tests/toolbox.inc.sh | 2 +- |
| 12 | 3 files changed, 4 insertions(+), 4 deletions(-) |
| 13 | |
| 14 | diff --git a/tests/keyctl/session/valid/runtest.sh b/tests/keyctl/session/valid/runtest.sh |
| 15 | index 4c831314c0b0..456e9f32de23 100644 |
| 16 | --- a/tests/keyctl/session/valid/runtest.sh |
| 17 | +++ b/tests/keyctl/session/valid/runtest.sh |
| 18 | @@ -17,7 +17,7 @@ then |
| 19 | expect_key_rdesc rdesc "keyring@.*@.*@.*@_ses[^@]*\$" |
| 20 | |
| 21 | # check the session keyring ID is shown |
| 22 | - seskeyring="`tail -2 $OUTPUTFILE | head -1`" |
| 23 | + seskeyring="`tail -2 $OUTPUTFILE | head -n1`" |
| 24 | if ! expr "$seskeyring" : "Joined session keyring: [0-9]*" >&/dev/null |
| 25 | then |
| 26 | failed |
| 27 | @@ -30,7 +30,7 @@ new_session qwerty keyctl rdescribe @s "@" |
| 28 | expect_key_rdesc rdesc "keyring@.*@.*@.*@qwerty" |
| 29 | |
| 30 | # check the session keyring ID is shown |
| 31 | -seskeyring="`tail -2 $OUTPUTFILE | head -1`" |
| 32 | +seskeyring="`tail -2 $OUTPUTFILE | head -n1`" |
| 33 | if ! expr "$seskeyring" : "Joined session keyring: [0-9]*" >&/dev/null |
| 34 | then |
| 35 | failed |
| 36 | diff --git a/tests/keyctl/show/noargs/runtest.sh b/tests/keyctl/show/noargs/runtest.sh |
| 37 | index d5072716c76a..a6d8b6b585c4 100644 |
| 38 | --- a/tests/keyctl/show/noargs/runtest.sh |
| 39 | +++ b/tests/keyctl/show/noargs/runtest.sh |
| 40 | @@ -31,7 +31,7 @@ then |
| 41 | fi |
| 42 | |
| 43 | # the first key listed (line 2) should be a keying (the session keyring) ... |
| 44 | -keyring1="`grep -n keyring $OUTPUTFILE | cut -d: -f1 | head -1`" |
| 45 | +keyring1="`grep -n keyring $OUTPUTFILE | cut -d: -f1 | head -n1`" |
| 46 | if [ "$keyring1" != "4" ] |
| 47 | then |
| 48 | failed |
| 49 | diff --git a/tests/toolbox.inc.sh b/tests/toolbox.inc.sh |
| 50 | index 7ea2f253ba7d..a461a73daaa3 100644 |
| 51 | --- a/tests/toolbox.inc.sh |
| 52 | +++ b/tests/toolbox.inc.sh |
| 53 | @@ -229,7 +229,7 @@ function check_notify () |
| 54 | if [ "$1" = "-2" ] |
| 55 | then |
| 56 | shift |
| 57 | - my_logline="`tail -2 $watch_log | head -1`" |
| 58 | + my_logline="`tail -2 $watch_log | head -n1`" |
| 59 | else |
| 60 | my_logline="`tail -1 $watch_log`" |
| 61 | fi |
| 62 | -- |
| 63 | 2.39.0 |
| 64 | |