Bug 15073 - Add ptest for less
Summary: Add ptest for less
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 4.3
Hardware: x86 Multiple
: Medium enhancement
Target Milestone: 4.3
Assignee: Julien Stephan
QA Contact:
URL:
Whiteboard: NEWCOMER
Depends on:
Blocks:
 
Reported: 2023-03-16 19:10 UTC by Randy MacLeod
Modified: 2023-09-01 00:34 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randy MacLeod 2023-03-16 19:10:13 UTC
The less package has some test code:

https://github.com/gwsw/less

❯ ls lesstest/
display.c  env.c  lesstest.c  lesstest.h  log.c  lt  lt_screen.c  lt_types.h  Makefile  maketest  parse.c  pipeline.c  README  run.c  runtest  term.c  unicode.c  wchar.c  wchar.h

but out recipe doesn't exercise it:
https://git.openembedded.org/openembedded-core/tree/meta/recipes-extended/less/less_608.bb

Action: compile, install and run the tests in the ptest system.
Comment 1 Frank Wolff 2023-03-20 09:07:47 UTC
Hi Randy,

I'm planning on working on this bug as a newcomer and I've got a question.
The less recipe gets the tar archive from greenwoodsoftware.com and not from github.com
The lesstest folder is only available on Github repository. So should we change the SRC_URI to Github ?
Comment 2 Randy MacLeod 2023-03-20 14:08:51 UTC
Hi Frank, 
Thanks for working on this!

I'd start with an email to the maintainer to see if they would consider bundling the tests with the release tarball. If they don't want to do that then, yes switch to the github SRC_URI but mention in your commit log that the upstream did not want to bundle the tests.

The tarballs are smaller but the less git history isn't that much of an overhead.


❯ ls -l 
total 364
drwxr-xr-x 2 rmacleod rmacleod   4096 Jul 22  2022 less-608
-rw-rw-r-- 1 rmacleod rmacleod 362346 Jul 22  2022 less-608.tar.gz
drwxrwxr-x 6 rmacleod rmacleod   4096 Mar 20 10:04 less.git

os/core/less 
❯ du -sh less-608
1.6M	less-608

os/core/less 
❯ du -sh less.git/
8.9M	less.git/


Good luck.
Comment 3 Randy MacLeod 2023-03-31 20:01:12 UTC
Hey Frank, I came across this issue in my email -  any news? 
Let me know if you need help at all.
../Randy
Comment 4 Randy MacLeod 2023-06-08 15:41:18 UTC
Frank, I've CCed Nat who may be interested in working on this enhancement if you don't have time. What's happening?
Comment 5 Frank Wolff 2023-06-08 15:47:34 UTC
Hi Randy,
sorry I totally forgot to answer you last time. Sadly I've been caught in other projects and don't have enough time right now to work on this.
FYI there's an issue about this on less Github repository : https://github.com/gwsw/less/issues/344
Comment 6 Randy MacLeod 2023-06-08 16:50:41 UTC
Thanks Frank and everyone checking on this.
It looks like v635 and other recent github tarballs have the lesstest content. Does someone want to check since Frank is busy?
Comment 7 Loc Nguyen 2023-07-04 05:05:41 UTC
Hi Randy,
I'm willing to help on this bug. As my understanding, the steps will be:
1. try to compile and run this test manually
2. modifying recipe to add -ptest package. (refer: https://wiki.yoctoproject.org/wiki/Ptest)
3. Verifying by adding CORE_IMAGE_EXTRA_INSTALL += "less-ptest" to conf file, bitbake and run "ptest-runner" in the target.

Is there anything missing?
Comment 8 Julien Stephan 2023-07-04 08:11:29 UTC
Hi Randy and Loc,

Hi also started to have a look yesterday at this issue as a newcomer to the yocto project. I wanted to take a look around to this issue before posting. I almost have a patch ready for this issue. I am able to run the lesstest test but I have two failing tests (I am currently looking at this right now): 

``
TEST version.c.lt
OK   version.c (38 steps)
TEST utf8-2.txt.lt
FAIL utf8-2.txt on cmd #20 (. a)
FAIL utf8-2.txt (20 steps)
ERR  status 256 from /usr/lib/less/ptest/lesstest -s '/usr/lib/less/ptest/lt_screen' -t /usr/lib/less/ptest/lt/chinese1.lt' '/usr/bin/less' 
TEST table-50x200.lt
OK   table-50x200 (467 steps)
TEST seq200.lt
OK   seq200 (18 steps)
TEST proc-special.lt
OK   proc-special (107 steps)
TEST hdr-unicode1.lt
OK   hdr-unicode (107 steps)
TEST hdr-unicode.lt
OK   hdr-unicode (164 steps)
TEST github329.lt
OK   github329 (28 steps)
TEST github265.lt
OK   github265 (17 steps)
TEST github216.lt
OK   github216 (143 steps)
TEST colorbars.lt
OK   colorbars (222 steps)
TEST chinese1.lt
FAIL chinese1 on cmd #29 (. a)
FAIL chinese1 (29 steps)
ERR  status 256 from /usr/lib/less/ptest/lesstest -s '/usr/lib/less/ptest/lt_screen' -t /usr/lib/less/ptest/lt/chinese1.lt' '/usr/bin/less' 
RAN  12 tests with 2 errors
``

Best 
Julien
Comment 9 Randy MacLeod 2023-07-04 21:54:19 UTC
Julien and Luc,

The steps listed seem reasonable.

If you can't get all the ptests to pass with the time you have at hand, 
please just submit the recipe changes to the list anyway with a good summary of the current state and we'll work it out over time.

Some tests are better than no tests!

../Randy
Comment 10 Randy MacLeod 2023-07-05 15:59:16 UTC
Luc, Julien,

There are 10s (?) more recipes that don't have ptest coverage in oe-core and many in other layers. Do you want to work on one?
 
Here's a quick filter that will likely miss some recipes where the ptest support is in a .inc file:

oe-core.git on  master [$] 
❯ for i in `find . -name "*.bb" | grep -v class`; do echo -n $i ": ";grep  -q ptest $i; echo $?; done | rg ": 0" | wc -l
112

but it's a good starting point.

We could organize this into a top level enhancement and track each recipe as a sub-activity or y'all could just pick on and send a patch.
Comment 11 Loc Nguyen 2023-07-06 07:15:46 UTC
Hi Julien, Randy

Since Julien have started, I'll look into other bugs. 
Thank you for your notification.

Good luck
Comment 12 Julien Stephan 2023-07-06 07:57:04 UTC
Hi Randy,

yes I would be happy to help on such task. Let me know how. 
In the meantime, I already sent the patch for less and I am trying to figure out the locale issue related to the 2 failing tests.
Comment 13 Julien Stephan 2023-07-06 13:57:19 UTC
As pointed out by Alexander Kanavin (https://lists.openembedded.org/g/openembedded-core/message/183922) less has a weird version scheme on its github repository so we should postpone this until lesstest code gets bundled into the release tarballs. 

The latest version of my work is available here: https://lists.openembedded.org/g/openembedded-core/message/183943 and I pushed my branch on poky-contrib: https://git.yoctoproject.org/poky-contrib/commit/?h=jstephan/add-ptest-for-less

All tests pass (locale issues described above are fixed).
Comment 14 Julien Stephan 2023-08-21 14:41:35 UTC
release tarballs now include lesstest, so I sent a v5 of this series to upgrade less and add ptest https://lists.openembedded.org/g/openembedded-core/message/186446
Comment 15 Randy MacLeod 2023-09-01 00:34:23 UTC
And it's merged to master!

https://git.openembedded.org/openembedded-core/commit/?id=1d20e7990656c2135570640a329c80b7df879675

Thanks Julien!