Bug 13444

Summary: Add test suite for bzip2
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: coreAssignee: Rahul Kumar <rahulk>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Medium+ CC: JPEWhacker, meta.mr.watcher, meta.watcher, rahulk, randy.macleod, tvgamblin
Version: 3.1   
Target Milestone: 4.99   
Hardware: x86   
OS: Multiple   
Whiteboard: newcomer
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
run-test.sh script result none

Description Ross Burton 2019-07-18 11:00:43 UTC
bzip2 now has a test suite available at git://sourceware.org/git/bzip2-tests.git.  We should investigate adding it to the bzip2 recipe if ptests are enabled.

Thoughts:
1) The test runner has a non-standard output so we'd need to patch it to write PASS/FAIL as expected by the ptest infrastructure
2) The test files are from other projects, so populating the LICENSE field for bzip2-ptest will need to be done carefully

The ptest package should depend on bzip2 and md5sum, and pass --without-valgrind as that will be used if present and causes the tests to run *a lot* slower.
Comment 1 Joshua Watt 2019-07-18 15:33:36 UTC
Upstream bzip2 has been pretty responsive lately. It's probably worth discussing this with them and seeing if they would be interested in using a more standardized test output format.
Comment 2 Rahul Kumar 2020-02-11 13:35:22 UTC
Hi,

Here product version is 0.0.0. what does it means?
Comment 3 Randy MacLeod 2020-02-11 14:58:39 UTC
Rahul, The 0.0.0 is either a poor choice by the reporter or an interaction bug between web browsers and the Yocto Bugzilla version. I've set it to 3.1 now.
Do you want to work on this enhancement? If so feel free to ask questions here, or on IRC.
Comment 4 Rahul Kumar 2020-03-17 16:55:13 UTC
Hi Randy MacLeod,

I want to work on this enhancement.

I cloned the oe-core and bitbake source code via below link
git clone git://git.openembedded.org/openembedded-core
git clone git://git.openembedded.org/bitbake bitbake

I go through the below link 
https://wiki.yoctoproject.org/wiki/Releases

as product version is 3.1, openembedded-core branch should be Dunfell and bitbake branch should be 1.46.
but But there is no Dunfell branch in oe-core and 1.46 branch in bitbake source code.

can you please guide me on which branch i should work.

Thanks & Regards
Rahul Kumar
Comment 5 Joshua Watt 2020-03-17 17:15:32 UTC
Rahul,

The master branch should be used, for that matter you should use the master branch of oe-core also.
Comment 6 Rahul Kumar 2020-03-18 09:30:44 UTC
Thanks Joshua Watt,

But when i am switching to master branch and enable ptest,below error I am facing 

ERROR: busybox-1.31.1-r0 do_package: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:ptest_update_alternatives(d)
     0003:
File: '/opt/opensource/openembedded-core.git/meta/classes/ptest.bbclass', lineno: 98, function: ptest_update_alternatives
     0094:        for alt_name, alt_link, alt_target, _ in alternatives:
     0095:            # Some alternatives are for man pages,
     0096:            # check if the alternative is in PATH
     0097:            if os.path.dirname(alt_link) in bin_paths:
 *** 0098:                os.symlink(alt_target, os.path.join(ptest_bindir, alt_name))
     0099:}
     0100:
     0101:do_configure_ptest_base[dirs] = "${B}"
     0102:do_compile_ptest_base[dirs] = "${B}"
Exception: FileExistsError: [Errno 17] File exists: '/bin/busybox.suid' -> '/opt/opensource/openembedded-core.git/build-master/tmp-glibc/work/core2-64-oe-linux/busybox/1.31.1-r0/package/usr/lib/busybox/ptest/bin/login'

ERROR: Logfile of failure stored in: /opt/opensource/openembedded-core.git/build-master/tmp-glibc/work/core2-64-oe-linux/busybox/1.31.1-r0/temp/log.do_package.8901
ERROR: Task (/opt/opensource/openembedded-core.git/meta/recipes-core/busybox/busybox_1.31.1.bb:do_package) failed with exit code '1'

Does anyone have idea on this?
Comment 7 Rahul Kumar 2020-03-24 18:03:17 UTC
Created attachment 4652 [details]
run-test.sh script result

Hi,

I modified run-tests.sh script to write PASS/FAIL as expected by the ptest infrastructure.
run-test.sh script output file attached here.

basically run-test.sh file is doing two kind of tests
1) First test the good bz2 files (Testing decompression and recompression)
   Output looks like below
	Testing decompression and recompression...

	Processing ./go/regexp/re2-exhaustive.txt.bz2
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 Decompress
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 md5sum Matched
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 Recompress 
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 Redecompress
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 md5sum Matched
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 Decompress (small)
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 Md5sum Matched
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 Recompress (small)
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 Redecompress (small)
	PASS: ./go/regexp/re2-exhaustive.txt.bz2 md5sum Matched

2) Then test all bad inputs
   Output looks like below
	Testing detection of bad input data...

	bzip2: Data integrity error when decompressing.
	PASS: Correctly found data integrity errors in ./go/compress/fail-issue5747.bz2.bad during decompress.

	bzip2: Data integrity error when decompressing.
	PASS: Correctly found data integrity errors in ./go/compress/fail-issue5747.bz2.bad during decompress (small).bzip2

can any one review this attached output file and guide me if any further modification required in output.
Comment 8 Randy MacLeod 2020-03-25 03:06:04 UTC
If no one replies, I either Trevor (who I added) or I can look at this tomorrow.
Since you are working on the bug, I've assigned it to you. Thanks!
Comment 9 Rahul Kumar 2020-04-02 11:40:28 UTC
(In reply to comment #8)
> If no one replies, I either Trevor (who I added) or I can look at this
> tomorrow.
> Since you are working on the bug, I've assigned it to you. Thanks!

Hi,

I sent the patch for this enhancement.

https://patchwork.openembedded.org/patch/171539/

Kindly take a look.
Comment 10 Rahul Kumar 2020-04-23 12:19:05 UTC
Hi,

As per your suggestion I submitted bzip2 patch to bzip2 mailing list
https://sourceware.org/pipermail/bzip2-devel/2020q2/000102.html
But i did not getting any response.


I have sent Patch Version 2.
https://patchwork.openembedded.org/patch/172134/

Kindly take a look .
Comment 11 Rahul Kumar 2020-04-27 07:51:24 UTC
Hi Randy,

As per your comments i made changes and submitted Patch Version 2 to openembedded-core mailing list.
https://patchwork.openembedded.org/patch/172134/

Kindly take a look and comment if any thing remaining for this bug

Thanks & Regards
Rahul Kumar
Comment 12 Rahul Kumar 2020-05-26 04:22:34 UTC
Hi Randy,

In mailing list could not conclude whether which option we should choose.
kindly help me on it.

1) LICENSE = \
   "bzip2-1.0.6 & GPLv3+ & Apache-2.0 & MS-PL & BSD-3-Clause & Zlib"

and

2) LICENSE = "GPLv3+"


One more thing,bzip2 community has been accepted my patch and add some additional changes on top of it .
so now our changes is part of bzip2-tests.git source code.
You can check here
https://sourceware.org/git/?p=bzip2-tests.git;a=commit;h=f9061c030a25de5b6829e1abf373057309c734c0

So I need your suggestion with respect to Yocto.

Since required changes for ptest infrastructure is integrated to the bzip2-tests.git source code.
So now we can just change the SRCREV with the latest commit instead of applying the patch (0001-bzip2-modify-run-tests-script.patch) to the bzip2-tests.git source code.

If we are going with second option.
Then i think no need to add any License for it because we are just integrating the bzip2-tests source to the bzip2 recipe and not apply any patch to the bzip2-tests.git source code. 

Kindly correct me if i am wrong at any point.

Thanks and Regards
Rahul Kumar
Comment 13 Randy MacLeod 2020-05-26 13:45:21 UTC
I have written to the bzip-devel list to discuss the license terms.
   https://sourceware.org/pipermail/bzip2-devel/2020q2/000109.html

Meanwhile, we can merge the recipe with:

   LICENSE = \
   "bzip2-1.0.6 & GPLv3+ & Apache-2.0 & MS-PL & BSD-3-Clause & Zlib"
since that reflects the source terms as they are written now.

And yes, just change the SRCREV with the latest commit instead of applying the patch (0001-bzip2-modify-run-tests-script.patch) to the bzip2-tests.git source code.
Comment 14 Rahul Kumar 2020-06-02 22:12:22 UTC
(In reply to comment #13)
> I have written to the bzip-devel list to discuss the license terms.
>    https://sourceware.org/pipermail/bzip2-devel/2020q2/000109.html
> 
> Meanwhile, we can merge the recipe with:
> 
>    LICENSE = \
>    "bzip2-1.0.6 & GPLv3+ & Apache-2.0 & MS-PL & BSD-3-Clause & Zlib"
> since that reflects the source terms as they are written now.
> 
> And yes, just change the SRCREV with the latest commit instead of applying
> the patch (0001-bzip2-modify-run-tests-script.patch) to the bzip2-tests.git
> source code.

Hi Randy,

Thanks for your confirmation.
I have sent Patch v3 to openembedded-core mailing list.
https://patchwork.openembedded.org/patch/173009/

Thanks & Regards
Rahul kumar
Comment 15 Rahul Kumar 2020-06-28 23:24:20 UTC
Hi

I have sent Patch v4 to openembedded-core mailing list.
https://patchwork.openembedded.org/patch/173912/

Thanks & Regards
Rahul kumar
Comment 16 Randy MacLeod 2020-07-08 13:16:33 UTC
Rahul,

and it was merged:

https://git.openembedded.org/openembedded-core/commit/?id=968529b484265b577e8b8130caef448a8a9d8b68

commit 968529b484265b577e8b8130caef448a8a9d8b68
Author: Rahul Kumar <rahulk@mvista.com>
Date:   Thu Jun 25 09:11:27 2020

    bzip2: Add test suite for bzip2

so I'm closing the defect.

Care to work on another, it's almost certainly going to be less hassle than this one was for you. Thanks for being so patient and working though all the issues.