Re: [OE-core] [PATCH] bzip2: Add test suite for bzip2

2020-04-14 Thread Randy MacLeod

On 2020-04-13 9:48 p.m., Rahul Kumar wrote:

Hi Randy,

Thanks for your  feedback.
As per your suggestion,I am working on that.

currently my patch has Upstream-Status: Inappropriate.

Since I am not aware of the patch submission process on bzip2, I posted 
a query on bzip2 mailing list (2 days back)  but I did not get any 
response from there.
If they are not responding, in this case shall i keep Upstream-Status: 
Inappropriate and send the v2 to oe-core  Or  should i wait for his 
response?


It's your call but I'd like to see:
   Upstream-Status: Submitted.

as per:
https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines#Patch_Header_Recommendations:_Upstream-Status

Submitted [where]
  - Submitted to upstream, waiting approval
  - Optionally include where it was submitted,
   such as the author, mailing list, etc.

Or
Do you have any idea how to submit the patch for bzip2-test repo.


No, I don't. If there's no answer, ping me here and we'll see if
someone can find a connection to the upstream developer(s).

../Randy



*Thanks & Regards,*
Rahul Kumar
Software Engineer,Linux Solutions Engineering
Group,Montavista Software LLC
Email Id: rah...@mvista.com 




--
# Randy MacLeod
# Wind River Linux
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#137228): 
https://lists.openembedded.org/g/openembedded-core/message/137228
Mute This Topic: https://lists.openembedded.org/mt/72695647/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [OE-core] [PATCH] bzip2: Add test suite for bzip2

2020-04-13 Thread Rahul Kumar
Hi Randy,

Thanks for your  feedback.
As per your suggestion,I am working on that.

currently my patch has Upstream-Status: Inappropriate.

Since I am not aware of the patch submission process on bzip2, I posted a
query on bzip2 mailing list (2 days back)  but I did not get any response
from there.
If they are not responding, in this case shall i keep Upstream-Status:
Inappropriate and send the v2 to oe-core  Or  should i wait for his
response?
Or
Do you have any idea how to submit the patch for bzip2-test repo.

*Thanks & Regards,*
Rahul Kumar
Software Engineer,Linux Solutions Engineering
Group,Montavista Software LLC
Email Id: rah...@mvista.com



On Tue, Apr 14, 2020 at 12:48 AM Randy MacLeod 
wrote:

> On 2020-04-13 1:22 p.m., Rahul Kumar wrote:
>
> Hi Randy,
>
> Kindly find the attached bzip2 ptest logs file.
>
> Hi Rahul,
>
> Most or even all of the tests that fail are due to:
>
>   bzip2: No space left on device
>
> For a [de]compression utility ptest suite, it's certainly reasonable
> to add extra space to the test image:
>
> https://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#var-IMAGE_ROOTFS_EXTRA_SPACE
>
> Make note of what how much extra space is needed in your commit log since
> we don't have a way for ptests to declare this and for it to be added
> automatically.
>
> It would also be really nice to see a summary of your ptest result
> in the long log. For example in my recent update to rsyslog in meta-oe:
>1ec13d7d9 rsyslog: 8.1911.0 -> 8.2002.0
> ...
>
> On qemux86-64/kvm the ptest results with extra filesystem
> space and a timeout of 800 seconds are:
>  1911   2002
>  TOTAL:   389408
>  PASS:339357
>  SKIP: 39 39
>  XFAIL: 0  0
>  FAIL: 11 12
>  XPASS: 0  0
>  ERROR: 0  0
>
> I probably should have listed the extra space used! oops. :)
>
> I answered your Question here .
> Kindly take a look and feel free to point out if i am wrong at any place
> and let me know if i missed anything.
> ==
> > +
> > +modify run-tests script to write PASS/FAIL as expected by the ptest
> infrastructure
> > +
> > +Signed-off-by: Rahul Kumar 
> > +---
> > + run-tests.sh | 83
> +++-
> > + 1 file changed, 43 insertions(+), 40 deletions(-)
> > +
> > +diff --git a/run-tests.sh b/run-tests.sh
> > +index 1ba8c27..1eff62a 100755
> > +--- a/run-tests.sh
> >  b/run-tests.sh
> > +@@ -10,7 +10,7 @@
> > + VALGRIND="valgrind"
> > + VALGRIND_ARGS="-q --error-exitcode=9"
> > + BZIP2="bzip2"
> > +-TESTS_DIR="."
> > ++TESTS_DIR="./bzip2-tests"
>
> Can you explain why you did this? Maybe upstream would accept it ?
>
> Ans:
> we need to parse the TEST_DIR Path because we are running runtest.sh
> script outside the bzip2-tests directory.
> But I figured out a more convenient way for this.
> I will parse the TEST_DIR path during running the runscript.sh.
>
> I can implement this by adding below line in makefile.am file.
> ./bzip2-tests/run-tests.sh --tests-dir="$(PWD)/bzip2-tests"
>
> Ah good.
>
>
> In Next version of patch I will implement it.
>
> ===
>
> > + IGNORE_MD5=0
> > +
> > + for i in "$@"
> > +@@ -40,21 +40,21 @@ case $i in
> > + esac
> > + done
> > +
> > +-if ! type "valgrind" > /dev/null; then
> > ++if ! type "valgrind" > /dev/null 2>&1; then
> > +   VALGRIND=""
> > +   VALGRIND_ARGS=""
> > + fi
>
> Explanation:
>
>if ! type "valgrind" > /dev/null;
>suppose if valgrind is not present in my image at that time it is
> showing
> ./bzip2-tests/run-tests.sh: line 43: type: valgrind: not found
>
>Since we are displaying a message in script that valgrind is used or
> not.
>
>So i redirect the output
>BY Modifying this line with "if ! type "valgrind" > /dev/null 2>&1"
>
> ==
>
> > + echo "Testing ${BZIP2} in directory ${TESTS_DIR}"
> > + if [ "$VALGRIND" != "" ]; then
> > +-  echo "  using valgrind"
> > ++  echo "Using valgrind: Yes"
> > + else
> > +-  echo "  NOT using valgrind"
> > ++  echo "Using valgrind: No"
> > + fi
> > + if [[ ${IGNORE_MD5} -eq 0 ]]; then
> > +-  echo "  checking md5 sums"
> > ++  echo "Checking md5 sums: Yes"
> > + else
> > +-  echo "  NOT checking md5 sums"
> > ++  echo "Checking md5 sums: No"
> > + fi
> > +
>
> Explanation:
> I Simply modified valgrind and md5sum messages with Yes/No
>
> I is worth seeing if upstream will accept the change, IMO.
>
>
> ==
>
> > + # Remove any left over tesfilecopies from previous runs first.
> > +@@ -76,16 +76,16 @@ while IFS= read -r -d '' bzfile; do
> > +   echo "Processing ${bzfile}"
> > +
> > +   # Decompress it.
> > +-  echo "  Decompress..."
> > ++  # echo "  Decompress..."
>
> Explanation:
> Initially for each file It is printing Decompress...
> I think which is not required to display in ptest logs so i comment it out.
>
> Does it cause a problem?
> We try to minimize our changes so if it's 

Re: [OE-core] [PATCH] bzip2: Add test suite for bzip2

2020-04-13 Thread Randy MacLeod

On 2020-04-13 1:22 p.m., Rahul Kumar wrote:

Hi Randy,

Kindly find the attached bzip2 ptest logs file.


Hi Rahul,

Most or even all of the tests that fail are due to:

  bzip2: No space left on device

For a [de]compression utility ptest suite, it's certainly reasonable
to add extra space to the test image:
https://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#var-IMAGE_ROOTFS_EXTRA_SPACE

Make note of what how much extra space is needed in your commit log since
we don't have a way for ptests to declare this and for it to be added 
automatically.


It would also be really nice to see a summary of your ptest result
in the long log. For example in my recent update to rsyslog in meta-oe:
   1ec13d7d9 rsyslog: 8.1911.0 -> 8.2002.0
...

    On qemux86-64/kvm the ptest results with extra filesystem
    space and a timeout of 800 seconds are:
 1911   2002
 TOTAL:   389    408
 PASS:    339    357
 SKIP: 39 39
 XFAIL: 0  0
 FAIL: 11 12
 XPASS: 0  0
 ERROR: 0  0

I probably should have listed the extra space used! oops. :)


I answered your Question here .
Kindly take a look and feel free to point out if i am wrong at any 
place and let me know if i missed anything.

==
> +
> +modify run-tests script to write PASS/FAIL as expected by the ptest 
infrastructure

> +
> +Signed-off-by: Rahul Kumar >

> +---
> + run-tests.sh | 83 
+++-

> + 1 file changed, 43 insertions(+), 40 deletions(-)
> +
> +diff --git a/run-tests.sh b/run-tests.sh
> +index 1ba8c27..1eff62a 100755
> +--- a/run-tests.sh
>  b/run-tests.sh
> +@@ -10,7 +10,7 @@
> + VALGRIND="valgrind"
> + VALGRIND_ARGS="-q --error-exitcode=9"
> + BZIP2="bzip2"
> +-TESTS_DIR="."
> ++TESTS_DIR="./bzip2-tests"

Can you explain why you did this? Maybe upstream would accept it ?

Ans:
we need to parse the TEST_DIR Path because we are running runtest.sh 
script outside the bzip2-tests directory.

But I figured out a more convenient way for this.
I will parse the TEST_DIR path during running the runscript.sh.

I can implement this by adding below line in makefile.am 
 file.

./bzip2-tests/run-tests.sh --tests-dir="$(PWD)/bzip2-tests"

Ah good.


In Next version of patch I will implement it.

===

> + IGNORE_MD5=0
> +
> + for i in "$@"
> +@@ -40,21 +40,21 @@ case $i in
> + esac
> + done
> +
> +-if ! type "valgrind" > /dev/null; then
> ++if ! type "valgrind" > /dev/null 2>&1; then
> +   VALGRIND=""
> +   VALGRIND_ARGS=""
> + fi

Explanation:

   if ! type "valgrind" > /dev/null;
   suppose if valgrind is not present in my image at that time it is 
showing

./bzip2-tests/run-tests.sh: line 43: type: valgrind: not found

   Since we are displaying a message in script that valgrind is used 
or not.


   So i redirect the output
   BY Modifying this line with "if ! type "valgrind" > /dev/null 2>&1"

==

> + echo "Testing ${BZIP2} in directory ${TESTS_DIR}"
> + if [ "$VALGRIND" != "" ]; then
> +-  echo "  using valgrind"
> ++  echo "Using valgrind: Yes"
> + else
> +-  echo "  NOT using valgrind"
> ++  echo "Using valgrind: No"
> + fi
> + if [[ ${IGNORE_MD5} -eq 0 ]]; then
> +-  echo "  checking md5 sums"
> ++  echo "Checking md5 sums: Yes"
> + else
> +-  echo "  NOT checking md5 sums"
> ++  echo "Checking md5 sums: No"
> + fi
> +

Explanation:
I Simply modified valgrind and md5sum messages with Yes/No

I is worth seeing if upstream will accept the change, IMO.


==

> + # Remove any left over tesfilecopies from previous runs first.
> +@@ -76,16 +76,16 @@ while IFS= read -r -d '' bzfile; do
> +   echo "Processing ${bzfile}"
> +
> +   # Decompress it.
> +-  echo "  Decompress..."
> ++  # echo "  Decompress..."

Explanation:
Initially for each file It is printing Decompress...
I think which is not required to display in ptest logs so i comment it 
out.

Does it cause a problem?
We try to minimize our changes so if it's just aesthetic, don't change it.


==
> +   if [[ ${IGNORE_MD5} -ne 1 ]]; then
> +-    md5sum --check --status ${md5file} < ${file} \
> +-      || { echo "!!! md5sum doesn't match decompressed file";
> ++    md5sum -c ${md5file} < ${file} && { echo "PASS: ${bzfile} 
md5sum Matched"; } \

> ++      || { echo "FAIL: ${bzfile} md5sum Matched";
> +            badtests=("${badtests[@]}" $"${file} md5sum doesn't match")
> +            nogood=$[${nogood}+1]; conti

Explanation:
for md5sum there is no short form option for --status option.
use of --status is "don't output anything, status code shows success"

md5sum -c ${md5file} < ${copy}
so i removed the --status option due to this below line is coming in 
ptest log

-: OK


The discrete md5sum doesn't have a short form of --status and

busybox md5sum only supports '-s'; that's a shame.

I guess we'd need to drop the argument for now but
this is another case where perhaps upstream bzip2 

Re: [OE-core] [PATCH] bzip2: Add test suite for bzip2

2020-04-13 Thread Rahul Kumar
Hi Randy,

Kindly find the attached bzip2 ptest logs file.
I answered your Question here .
Kindly take a look and feel free to point out if i am wrong at any place
and let me know if i missed anything.
==
> +
> +modify run-tests script to write PASS/FAIL as expected by the ptest
infrastructure
> +
> +Signed-off-by: Rahul Kumar 
> +---
> + run-tests.sh | 83
+++-
> + 1 file changed, 43 insertions(+), 40 deletions(-)
> +
> +diff --git a/run-tests.sh b/run-tests.sh
> +index 1ba8c27..1eff62a 100755
> +--- a/run-tests.sh
>  b/run-tests.sh
> +@@ -10,7 +10,7 @@
> + VALGRIND="valgrind"
> + VALGRIND_ARGS="-q --error-exitcode=9"
> + BZIP2="bzip2"
> +-TESTS_DIR="."
> ++TESTS_DIR="./bzip2-tests"

Can you explain why you did this? Maybe upstream would accept it ?

Ans:
we need to parse the TEST_DIR Path because we are running runtest.sh script
outside the bzip2-tests directory.
But I figured out a more convenient way for this.
I will parse the TEST_DIR path during running the runscript.sh.

I can implement this by adding below line in makefile.am file.
./bzip2-tests/run-tests.sh --tests-dir="$(PWD)/bzip2-tests"

In Next version of patch I will implement it.

===

> + IGNORE_MD5=0
> +
> + for i in "$@"
> +@@ -40,21 +40,21 @@ case $i in
> + esac
> + done
> +
> +-if ! type "valgrind" > /dev/null; then
> ++if ! type "valgrind" > /dev/null 2>&1; then
> +   VALGRIND=""
> +   VALGRIND_ARGS=""
> + fi

Explanation:

   if ! type "valgrind" > /dev/null;
   suppose if valgrind is not present in my image at that time it is
showing
./bzip2-tests/run-tests.sh: line 43: type: valgrind: not found

   Since we are displaying a message in script that valgrind is used or
not.

   So i redirect the output
   BY Modifying this line with "if ! type "valgrind" > /dev/null 2>&1"

==

> + echo "Testing ${BZIP2} in directory ${TESTS_DIR}"
> + if [ "$VALGRIND" != "" ]; then
> +-  echo "  using valgrind"
> ++  echo "Using valgrind: Yes"
> + else
> +-  echo "  NOT using valgrind"
> ++  echo "Using valgrind: No"
> + fi
> + if [[ ${IGNORE_MD5} -eq 0 ]]; then
> +-  echo "  checking md5 sums"
> ++  echo "Checking md5 sums: Yes"
> + else
> +-  echo "  NOT checking md5 sums"
> ++  echo "Checking md5 sums: No"
> + fi
> +

Explanation:
I Simply modified valgrind and md5sum messages with Yes/No

==

> + # Remove any left over tesfilecopies from previous runs first.
> +@@ -76,16 +76,16 @@ while IFS= read -r -d '' bzfile; do
> +   echo "Processing ${bzfile}"
> +
> +   # Decompress it.
> +-  echo "  Decompress..."
> ++  # echo "  Decompress..."

Explanation:
Initially for each file It is printing Decompress...
I think which is not required to display in ptest logs so i comment it out.

==
> +   if [[ ${IGNORE_MD5} -ne 1 ]]; then
> +-md5sum --check --status ${md5file} < ${file} \
> +-  || { echo "!!! md5sum doesn't match decompressed file";
> ++md5sum -c ${md5file} < ${file} && { echo "PASS: ${bzfile} md5sum
Matched"; } \
> ++  || { echo "FAIL: ${bzfile} md5sum Matched";
> +badtests=("${badtests[@]}" $"${file} md5sum doesn't match")
> +nogood=$[${nogood}+1]; conti

Explanation:
for md5sum there is no short form option for --status option.
use of --status is "don't output anything, status code shows success"

md5sum -c ${md5file} < ${copy}
so i removed the --status option due to this below line is coming in ptest
log
-: OK

==

+   echo "Bad results, look for !!! in the logs above"
+   printf ' - %s\n' "${badtests[@]}"
+-  exit 1
+ fi
+--

Explanation:
if some test failed then script is returning with exit 1 status due to this
at the end of ptest below message is printing
make: *** [Makefile:14: runtest] Error 1

logs wil looks like below if script returning with exit 1 status

PASS: Correctly found data integrity errors in
./bzip2-tests/lbzip2/void.bz2.bad during decompress (small)

Correctly found all bad file data integrity errors.

Bad results, look for !!! in the logs above
 - ./bzip2-tests/commons-compress/zip64support.tar.bz2 bad decompress result
 - ./bzip2-tests/go/regexp/re2-exhaustive.txt.bz2 bad decompress result
 - ./bzip2-tests/lbzip2/idx89.bz2 bad decompress result
 - ./bzip2-tests/lbzip2/ch255.bz2 bad decompress result
 - ./bzip2-tests/pyflate/45MB-fb.bz2 bad decompress result
 - ./bzip2-tests/pyflate/45MB-00.bz2 bad decompress result
make: *** [Makefile:14: runtest] Error 1

ERROR: Exit status is 512
DURATION: 31
END: /usr/lib/bzip2/ptest
2020-04-13T16:05
STOP: ptest-runner
root@qemux86-64:~#

To avoid "make: *** [Makefile:14: runtest] Error 1" messgae
I removed exit 1 line from the script.
May be i am wrong please suggest me i should keep it or remove.

==

>  file://configure.ac;subdir=${BP} \
>  file://Makefile.am;subdir=${BP} \
>  file://run-ptest \
> +
file://0001-bzip2-modify-run-tests-script.patch;patchdir=${WORKDIR}/git \
>  "
> +
> 

Re: [OE-core] [PATCH] bzip2: Add test suite for bzip2

2020-04-02 Thread Randy MacLeod

On 2020-04-02 7:10 a.m., Rahul Kumar wrote:

[YOCTO #13444]


Thanks for contributing this work Rahul.

It would be good if the long log explained the changes made
in a sentence or two. I've made some comments and asked
some questions inline below. I may have gone overboard but
I hope you get the idea that we'd like to see not just the
changes but the reason for the changes.

Also, can you present the results of running:
# ptest-runner bzip2
on qemux86-64 with kvm enabled in the long log?
If there are tests that fail or are skipped
comment on that even it it's to say that you don't know what is wrong.



Signed-off-by: Rahul Kumar 
---
  .../bzip2/0001-bzip2-modify-run-tests-script.patch | 220 +
  meta/recipes-extended/bzip2/bzip2/Makefile.am  |   2 +
  meta/recipes-extended/bzip2/bzip2_1.0.8.bb |  15 +-
  3 files changed, 234 insertions(+), 3 deletions(-)
  create mode 100644 
meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch

diff --git 
a/meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch 
b/meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch
new file mode 100644
index 000..8ae3c4e
--- /dev/null
+++ b/meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch
@@ -0,0 +1,220 @@
+From 42e6258485030085285d4b30854bfb94bcf43880 Mon Sep 17 00:00:00 2001
+From: Rahul Kumar 
+Date: Mon, 30 Mar 2020 12:17:00 +0530
+Subject: [PATCH] bzip2: modify run-tests script
+
+Upstream-Status: Inappropriate [ modify run-tests script for ptest 
infrastructure ]


It seems that some of the changes are to make the tests less verbose and
to 'tighten-up' the language and formatting used. Upstream might accept
them, have you checked? If you change the status to Pending I think it
would be better for now because that would force someone check on the
progress at some point.


+
+modify run-tests script to write PASS/FAIL as expected by the ptest 
infrastructure
+
+Signed-off-by: Rahul Kumar 
+---
+ run-tests.sh | 83 +++-
+ 1 file changed, 43 insertions(+), 40 deletions(-)
+
+diff --git a/run-tests.sh b/run-tests.sh
+index 1ba8c27..1eff62a 100755
+--- a/run-tests.sh
 b/run-tests.sh
+@@ -10,7 +10,7 @@
+ VALGRIND="valgrind"
+ VALGRIND_ARGS="-q --error-exitcode=9"
+ BZIP2="bzip2"
+-TESTS_DIR="."
++TESTS_DIR="./bzip2-tests"


Can you explain why you did this? Maybe upstream would accept it.


+ IGNORE_MD5=0
+
+ for i in "$@"
+@@ -40,21 +40,21 @@ case $i in
+ esac
+ done
+
+-if ! type "valgrind" > /dev/null; then
++if ! type "valgrind" > /dev/null 2>&1; then
+   VALGRIND=""
+   VALGRIND_ARGS=""
+ fi
+
+ echo "Testing ${BZIP2} in directory ${TESTS_DIR}"
+ if [ "$VALGRIND" != "" ]; then
+-  echo "  using valgrind"
++  echo "Using valgrind: Yes"
+ else
+-  echo "  NOT using valgrind"
++  echo "Using valgrind: No"
+ fi
+ if [[ ${IGNORE_MD5} -eq 0 ]]; then
+-  echo "  checking md5 sums"
++  echo "Checking md5 sums: Yes"
+ else
+-  echo "  NOT checking md5 sums"
++  echo "Checking md5 sums: No"
+ fi
+
+ # Remove any left over tesfilecopies from previous runs first.
+@@ -76,16 +76,16 @@ while IFS= read -r -d '' bzfile; do
+   echo "Processing ${bzfile}"
+
+   # Decompress it.
+-  echo "  Decompress..."
++  # echo "  Decompress..."


Without an explanation in the long log, I can't tell if this
comment was removed intentionally or perhaps when you were debugging.
I expect you have a good reason to remove it but an explaination would
be helpful.


+   rm -f "${file}"
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${bzfile} \
+-|| { echo "!!! bad decompress result $?";
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${bzfile} && { echo "PASS: 
${bzfile} Decompress"; } \
++|| { echo "FAIL: ${bzfile} Decompress";
+  badtests=("${badtests[@]}" $"${bzfile} bad decompress result")
+  nogood=$[${nogood}+1]; continue; }
+
+   if [[ ${IGNORE_MD5} -ne 1 ]]; then
+-md5sum --check --status ${md5file} < ${file} \
+-  || { echo "!!! md5sum doesn't match decompressed file";
++md5sum -c ${md5file} < ${file} && { echo "PASS: ${bzfile} md5sum 
Matched"; } \
++  || { echo "FAIL: ${bzfile} md5sum Matched";
+badtests=("${badtests[@]}" $"${file} md5sum doesn't match")
+nogood=$[${nogood}+1]; continue; }
+   fi
+@@ -93,20 +93,20 @@ while IFS= read -r -d '' bzfile; do
+   # Compress and decompress a copy
+   mv "${file}" "${copy}"
+   rm -f "${bzcopy}"
+-  echo "  Recompress..."
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} \
+-|| { echo "!!! bad compress result $?";
++  # echo "  Recompress..."
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} && { echo "PASS: 
${bzfile} Recompress "; } \
++|| { echo "FAIL: ${bzfile} Recompress";
+  badtests=("${badtests[@]}" $"${copy} bad result")
+  nogood=$[${nogood}+1]; continue; }
+-  echo "  Redecompress..."
+-  ${VALGRIND} 

[OE-core] [PATCH] bzip2: Add test suite for bzip2

2020-04-02 Thread Rahul Kumar
[YOCTO #13444]

Signed-off-by: Rahul Kumar 
---
 .../bzip2/0001-bzip2-modify-run-tests-script.patch | 220 +
 meta/recipes-extended/bzip2/bzip2/Makefile.am  |   2 +
 meta/recipes-extended/bzip2/bzip2_1.0.8.bb |  15 +-
 3 files changed, 234 insertions(+), 3 deletions(-)
 create mode 100644 
meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch

diff --git 
a/meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch 
b/meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch
new file mode 100644
index 000..8ae3c4e
--- /dev/null
+++ b/meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch
@@ -0,0 +1,220 @@
+From 42e6258485030085285d4b30854bfb94bcf43880 Mon Sep 17 00:00:00 2001
+From: Rahul Kumar 
+Date: Mon, 30 Mar 2020 12:17:00 +0530
+Subject: [PATCH] bzip2: modify run-tests script
+
+Upstream-Status: Inappropriate [ modify run-tests script for ptest 
infrastructure ]
+
+modify run-tests script to write PASS/FAIL as expected by the ptest 
infrastructure
+
+Signed-off-by: Rahul Kumar 
+---
+ run-tests.sh | 83 +++-
+ 1 file changed, 43 insertions(+), 40 deletions(-)
+
+diff --git a/run-tests.sh b/run-tests.sh
+index 1ba8c27..1eff62a 100755
+--- a/run-tests.sh
 b/run-tests.sh
+@@ -10,7 +10,7 @@
+ VALGRIND="valgrind"
+ VALGRIND_ARGS="-q --error-exitcode=9"
+ BZIP2="bzip2"
+-TESTS_DIR="."
++TESTS_DIR="./bzip2-tests"
+ IGNORE_MD5=0
+
+ for i in "$@"
+@@ -40,21 +40,21 @@ case $i in
+ esac
+ done
+
+-if ! type "valgrind" > /dev/null; then
++if ! type "valgrind" > /dev/null 2>&1; then
+   VALGRIND=""
+   VALGRIND_ARGS=""
+ fi
+
+ echo "Testing ${BZIP2} in directory ${TESTS_DIR}"
+ if [ "$VALGRIND" != "" ]; then
+-  echo "  using valgrind"
++  echo "Using valgrind: Yes"
+ else
+-  echo "  NOT using valgrind"
++  echo "Using valgrind: No"
+ fi
+ if [[ ${IGNORE_MD5} -eq 0 ]]; then
+-  echo "  checking md5 sums"
++  echo "Checking md5 sums: Yes"
+ else
+-  echo "  NOT checking md5 sums"
++  echo "Checking md5 sums: No"
+ fi
+
+ # Remove any left over tesfilecopies from previous runs first.
+@@ -76,16 +76,16 @@ while IFS= read -r -d '' bzfile; do
+   echo "Processing ${bzfile}"
+
+   # Decompress it.
+-  echo "  Decompress..."
++  # echo "  Decompress..."
+   rm -f "${file}"
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${bzfile} \
+-|| { echo "!!! bad decompress result $?";
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${bzfile} && { echo "PASS: 
${bzfile} Decompress"; } \
++|| { echo "FAIL: ${bzfile} Decompress";
+  badtests=("${badtests[@]}" $"${bzfile} bad decompress result")
+  nogood=$[${nogood}+1]; continue; }
+
+   if [[ ${IGNORE_MD5} -ne 1 ]]; then
+-md5sum --check --status ${md5file} < ${file} \
+-  || { echo "!!! md5sum doesn't match decompressed file";
++md5sum -c ${md5file} < ${file} && { echo "PASS: ${bzfile} md5sum 
Matched"; } \
++  || { echo "FAIL: ${bzfile} md5sum Matched";
+badtests=("${badtests[@]}" $"${file} md5sum doesn't match")
+nogood=$[${nogood}+1]; continue; }
+   fi
+@@ -93,20 +93,20 @@ while IFS= read -r -d '' bzfile; do
+   # Compress and decompress a copy
+   mv "${file}" "${copy}"
+   rm -f "${bzcopy}"
+-  echo "  Recompress..."
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} \
+-|| { echo "!!! bad compress result $?";
++  # echo "  Recompress..."
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} && { echo "PASS: 
${bzfile} Recompress "; } \
++|| { echo "FAIL: ${bzfile} Recompress";
+  badtests=("${badtests[@]}" $"${copy} bad result")
+  nogood=$[${nogood}+1]; continue; }
+-  echo "  Redecompress..."
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -d -q -s ${bzcopy} \
+-|| { echo "!!! bad (re)decompress result $?";
++  # echo "  Redecompress..."
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -d -q -s ${bzcopy} && { echo "PASS: 
${bzfile} Redecompress"; } \
++|| { echo "FAIL: ${bzfile} Redecompress";
+  badtests=("${badtests[@]}" $"${bzcopy} bad result")
+  nogood=$[${nogood}+1]; continue; }
+
+   if [[ ${IGNORE_MD5} -ne 1 ]]; then
+-md5sum --check --status ${md5file} < ${copy} \
+-  || { echo "!!! md5sum doesn't match (re)decompressed file";
++md5sum -c ${md5file} < ${copy} && { echo "PASS: ${bzfile} md5sum 
Matched"; } \
++  || { echo "FAIL: ${bzfile} md5sum Matched";
+badtests=("${badtests[@]}" $"${copy} md5sum doesn't match")
+nogood=$[${nogood}+1]; continue; }
+   fi
+@@ -114,16 +114,16 @@ while IFS= read -r -d '' bzfile; do
+   rm "${copy}"
+
+   # Now do it all again in "small" mode.
+-  echo "  Decompress (small)..."
++  # echo "  Decompress (small)..."
+   rm -f "${file}"
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q -s ${bzfile} \
+-|| { echo "!!! bad decompress result $?";
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q -s ${bzfile} 

[OE-core] [PATCH] bzip2: Add test suite for bzip2

2020-04-01 Thread Rahul Chauhan
[YOCTO #13444]

Signed-off-by: Rahul Kumar 
---
 .../bzip2/0001-bzip2-modify-run-tests-script.patch | 218 +
 meta/recipes-extended/bzip2/bzip2/Makefile.am  |   2 +
 meta/recipes-extended/bzip2/bzip2_1.0.8.bb |  15 +-
 3 files changed, 232 insertions(+), 3 deletions(-)
 create mode 100644 
meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch

diff --git 
a/meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch 
b/meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch
new file mode 100644
index 000..4da3bd6
--- /dev/null
+++ b/meta/recipes-extended/bzip2/bzip2/0001-bzip2-modify-run-tests-script.patch
@@ -0,0 +1,218 @@
+From 3be937cadc9e379334eddc9e8042d46357f0330b Mon Sep 17 00:00:00 2001
+From: Rahul Kumar 
+Date: Mon, 30 Mar 2020 12:17:00 +0530
+Subject: [PATCH] bzip2: modify run-tests script
+
+modify run-tests script to write PASS/FAIL as expected by the ptest 
infrastructure
+
+Signed-off-by: Rahul Kumar 
+---
+ run-tests.sh | 83 +++-
+ 1 file changed, 43 insertions(+), 40 deletions(-)
+
+diff --git a/run-tests.sh b/run-tests.sh
+index 1ba8c27..1eff62a 100755
+--- a/run-tests.sh
 b/run-tests.sh
+@@ -10,7 +10,7 @@
+ VALGRIND="valgrind"
+ VALGRIND_ARGS="-q --error-exitcode=9"
+ BZIP2="bzip2"
+-TESTS_DIR="."
++TESTS_DIR="./bzip2-tests"
+ IGNORE_MD5=0
+
+ for i in "$@"
+@@ -40,21 +40,21 @@ case $i in
+ esac
+ done
+
+-if ! type "valgrind" > /dev/null; then
++if ! type "valgrind" > /dev/null 2>&1; then
+   VALGRIND=""
+   VALGRIND_ARGS=""
+ fi
+
+ echo "Testing ${BZIP2} in directory ${TESTS_DIR}"
+ if [ "$VALGRIND" != "" ]; then
+-  echo "  using valgrind"
++  echo "Using valgrind: Yes"
+ else
+-  echo "  NOT using valgrind"
++  echo "Using valgrind: No"
+ fi
+ if [[ ${IGNORE_MD5} -eq 0 ]]; then
+-  echo "  checking md5 sums"
++  echo "Checking md5 sums: Yes"
+ else
+-  echo "  NOT checking md5 sums"
++  echo "Checking md5 sums: No"
+ fi
+
+ # Remove any left over tesfilecopies from previous runs first.
+@@ -76,16 +76,16 @@ while IFS= read -r -d '' bzfile; do
+   echo "Processing ${bzfile}"
+
+   # Decompress it.
+-  echo "  Decompress..."
++  # echo "  Decompress..."
+   rm -f "${file}"
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${bzfile} \
+-|| { echo "!!! bad decompress result $?";
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q ${bzfile} && { echo "PASS: 
${bzfile} Decompress"; } \
++|| { echo "FAIL: ${bzfile} Decompress";
+  badtests=("${badtests[@]}" $"${bzfile} bad decompress result")
+  nogood=$[${nogood}+1]; continue; }
+
+   if [[ ${IGNORE_MD5} -ne 1 ]]; then
+-md5sum --check --status ${md5file} < ${file} \
+-  || { echo "!!! md5sum doesn't match decompressed file";
++md5sum -c ${md5file} < ${file} && { echo "PASS: ${bzfile} md5sum 
Matched"; } \
++  || { echo "FAIL: ${bzfile} md5sum Matched";
+badtests=("${badtests[@]}" $"${file} md5sum doesn't match")
+nogood=$[${nogood}+1]; continue; }
+   fi
+@@ -93,20 +93,20 @@ while IFS= read -r -d '' bzfile; do
+   # Compress and decompress a copy
+   mv "${file}" "${copy}"
+   rm -f "${bzcopy}"
+-  echo "  Recompress..."
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} \
+-|| { echo "!!! bad compress result $?";
++  # echo "  Recompress..."
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -z -q -s ${copy} && { echo "PASS: 
${bzfile} Recompress "; } \
++|| { echo "FAIL: ${bzfile} Recompress";
+  badtests=("${badtests[@]}" $"${copy} bad result")
+  nogood=$[${nogood}+1]; continue; }
+-  echo "  Redecompress..."
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -d -q -s ${bzcopy} \
+-|| { echo "!!! bad (re)decompress result $?";
++  # echo "  Redecompress..."
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -d -q -s ${bzcopy} && { echo "PASS: 
${bzfile} Redecompress"; } \
++|| { echo "FAIL: ${bzfile} Redecompress";
+  badtests=("${badtests[@]}" $"${bzcopy} bad result")
+  nogood=$[${nogood}+1]; continue; }
+
+   if [[ ${IGNORE_MD5} -ne 1 ]]; then
+-md5sum --check --status ${md5file} < ${copy} \
+-  || { echo "!!! md5sum doesn't match (re)decompressed file";
++md5sum -c ${md5file} < ${copy} && { echo "PASS: ${bzfile} md5sum 
Matched"; } \
++  || { echo "FAIL: ${bzfile} md5sum Matched";
+badtests=("${badtests[@]}" $"${copy} md5sum doesn't match")
+nogood=$[${nogood}+1]; continue; }
+   fi
+@@ -114,16 +114,16 @@ while IFS= read -r -d '' bzfile; do
+   rm "${copy}"
+
+   # Now do it all again in "small" mode.
+-  echo "  Decompress (small)..."
++  # echo "  Decompress (small)..."
+   rm -f "${file}"
+-  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q -s ${bzfile} \
+-|| { echo "!!! bad decompress result $?";
++  ${VALGRIND} ${VALGRIND_ARGS} ${BZIP2} -k -d -q -s ${bzfile} &&{ echo "PASS: 
${bzfile} Decompress (small)"; } \
++|| { echo "FAIL: ${bzfile}