All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] unzip01.sh: Fix failure with BusyBox unzip
@ 2020-12-21 11:22 Radoslav Kolev
  2021-01-05  9:26 ` Petr Vorel
  0 siblings, 1 reply; 2+ messages in thread
From: Radoslav Kolev @ 2020-12-21 11:22 UTC (permalink / raw)
  To: ltp

BusyBox unzip uses the word 'inflating' instead of 'extracting'.
Detect it and check for the correct match in the output.

Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
---
 testcases/commands/unzip/unzip01.sh | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/testcases/commands/unzip/unzip01.sh b/testcases/commands/unzip/unzip01.sh
index 750718de4..1b9a1665f 100755
--- a/testcases/commands/unzip/unzip01.sh
+++ b/testcases/commands/unzip/unzip01.sh
@@ -12,6 +12,14 @@ TST_NEEDS_TMPDIR=1
 TST_NEEDS_CMDS="unzip"
 . tst_test.sh
 
+EXTRACT_MATCH=""
+
+if unzip 2>&1 | grep -q 'BusyBox'; then
+	EXTRACT_MATCH="inflating"
+else
+	EXTRACT_MATCH="extracting"
+fi
+
 setup()
 {
 	cat > unzip_exp.out <<EOF
@@ -21,15 +29,15 @@ Archive:  $TST_DATAROOT/test.zip
    creating: dir/d2/
    creating: dir/d3/
    creating: dir/d4/
- extracting: dir/d1/f1
- extracting: dir/d1/f2
- extracting: dir/d1/f3
+ $EXTRACT_MATCH: dir/d1/f1
+ $EXTRACT_MATCH: dir/d1/f2
+ $EXTRACT_MATCH: dir/d1/f3
    creating: dir/d2/d1/
    creating: dir/d2/d2/
    creating: dir/d2/d3/
- extracting: dir/d2/f1
- extracting: dir/d2/f2
- extracting: dir/d2/f3
+ $EXTRACT_MATCH: dir/d2/f1
+ $EXTRACT_MATCH: dir/d2/f2
+ $EXTRACT_MATCH: dir/d2/f3
    creating: dir/d3/d1/
    creating: dir/d3/d2/
    creating: dir/d3/d3/
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [LTP] [PATCH] unzip01.sh: Fix failure with BusyBox unzip
  2020-12-21 11:22 [LTP] [PATCH] unzip01.sh: Fix failure with BusyBox unzip Radoslav Kolev
@ 2021-01-05  9:26 ` Petr Vorel
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2021-01-05  9:26 UTC (permalink / raw)
  To: ltp

Hi Radoslav,

> BusyBox unzip uses the word 'inflating' instead of 'extracting'.
> Detect it and check for the correct match in the output.

> Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
> ---
>  testcases/commands/unzip/unzip01.sh | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)

> diff --git a/testcases/commands/unzip/unzip01.sh b/testcases/commands/unzip/unzip01.sh
> index 750718de4..1b9a1665f 100755
> --- a/testcases/commands/unzip/unzip01.sh
> +++ b/testcases/commands/unzip/unzip01.sh
> @@ -12,6 +12,14 @@ TST_NEEDS_TMPDIR=1
>  TST_NEEDS_CMDS="unzip"
>  . tst_test.sh

> +EXTRACT_MATCH=""
FYI shell syntax allow to drop quotes here:
EXTRACT_MATCH=

> +
> +if unzip 2>&1 | grep -q 'BusyBox'; then
> +	EXTRACT_MATCH="inflating"
> +else
> +	EXTRACT_MATCH="extracting"
> +fi

Thanks for a fix. Obviously correct, I pushed it with a tiny change (readability):

EXTRACT_MATCH="extracting"

if unzip 2>&1 | grep -q 'BusyBox'; then
	EXTRACT_MATCH="inflating"
fi

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-05  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 11:22 [LTP] [PATCH] unzip01.sh: Fix failure with BusyBox unzip Radoslav Kolev
2021-01-05  9:26 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.