Bug 10872 - Test for PACKAGE_FEED_URIS needed
Summary: Test for PACKAGE_FEED_URIS needed
Status: VERIFIED FIXED
Alias: None
Product: Runtime Testing
Classification: QA/Testing
Component: general (show other bugs)
Version: 2.3
Hardware: x86 Multiple
: Medium+ enhancement
Target Milestone: 2.3 M3
Assignee: Humberto Ibarra
QA Contact: oscar lopez arandas
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-01-03 15:01 UTC by Alexander Kanavin
Modified: 2017-12-07 14:53 UTC (History)
5 users (show)

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


Attachments
full-log (10.26 KB, text/plain)
2017-12-04 16:43 UTC, oscar lopez arandas
no flags Details
oe-selftest-log (33.21 KB, application/octet-stream)
2017-12-05 16:15 UTC, oscar lopez arandas
no flags Details
full-log (149.51 KB, text/plain)
2017-12-05 20:16 UTC, oscar lopez arandas
no flags Details
all testcases pass (96.62 KB, text/plain)
2017-12-07 14:53 UTC, oscar lopez arandas
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kanavin 2017-01-03 15:01:36 UTC
Currently the following functionality is not tested anywhere at all:
http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#var-PACKAGE_FEED_URIS
Comment 1 Alexander Kanavin 2017-01-03 15:07:31 UTC
Specifically, we need to check that during build the feeds are configured without anything failing, and then that on the resulting image the repo manager can access them without error.
Comment 2 Alexander Kanavin 2017-02-09 20:21:46 UTC
Later, the test should be extended to check for repository and package signatures (that signing works and signature verification works) - PACKAGE_FEED_SIGN and RPM_SIGN_PACKAGES are used to configure that.
Comment 3 Alexander Kanavin 2017-02-13 10:39:34 UTC
We discussed how on-image testing is difficult during selftest, but there is a testcase which boots an image and tries things on it, and this could be added to it:

1) Set up the configuration variables in meta/lib/oeqa/selftest/runtime-test.py, specifically

class TestImage(oeSelfTest):
    def test_testimage_install(self):

2) Add testcases that run dnf on image to meta-selftest/lib/oeqa/runtime/cases/selftest.py 

This shouldn't make testing much longer.
Comment 4 Humberto Ibarra 2017-02-15 21:45:51 UTC
Will work on add this test for smartpm.

Adding 9675 as dependency, once it is implemente we can think on changing this test to dnf.
Comment 5 Alexander Kanavin 2017-02-16 10:44:11 UTC
Regarding the per-arch repodata issue, a couple points:

1) the repodata that is generated in image's private build directory for the purpose of installing packages into the image on the host should not be used to set up remote package feeds, in general. It's transient, contains only those packages that are required by the image, and will be wiped next time an image is built. It's okay to use for the image tests, but nothing else.

2) Generally there is no standard way in oe-core to set up package feeds, and I don't know how people do it. I guess they copy tmp/deploy/rpm to somewhere else, and then run metadata creation tools on it - for which they have custom recipes.

3) I really don't want to complicate indexing and dnf configuration code by iterating over architectures. createrepo_c is perfectly capable of recursing into directories, let's use that facility, unless someone points out a specific reason why this is not the right way (see point 1 - this repodata will not be used for remote feeds anyway).

4) Similarly, we can make the package feed configuration code behave differently than that of opkg/deb: if no arches are given, it will not iterate over the internal list and append them all, but rather append nothing at all. If people want per-arch repodata, they'll need to supply an explicit list of arches to feed creation code, and run createrepo against each directory. Again, I'd like to hear specific reasons first, before making code more complicated than it needs to be.
Comment 6 Humberto Ibarra 2017-02-16 15:49:22 UTC
First, wanted to clarify what is being discussed here:

a. This bug is about adding a test for PACKAGE_FEED_URIS var, and most of the discussion is about actually implementing the setting of feeds in dnf based on this vars.

b. smartpm already has this functionality done, and, as the rest of the package managers, has a way to get a very solid choice of archs for the feeds even when PACKAGE_FEED_ARCHS are not given.

c. dnf is not yet in master and has not yet implemented the use of PACKAGE_FEED vars, which again, this bug is asking to test.

---

So, answering the statements about implementation in dnf and unique repo against a repo per arch:

Only the rpm-repo in the dnf branch has a repodata in the base folder of the repo. Master branch has smart creating a rpm base folder for the repo named 'rpms' and has a repo being created under each arch. This is a temporal repo, for internal reasons only, but still, this is the way that all package managers are expecting the structure and the way upstream repos such as fedora official updates and releases repos are structured.

It is a temporal repo, used for testing. But, even when I am okay with modifying environment conditions to make tests more efficient; modifying the code to adapt to the repo environment is a different thing.

As I have said, currently, smartpm and the rest of the package managers have a way to generate the archs even if PACKAGE_FEED_ARCHS is not given. They do it well, and what is being proposed is that dnf does not generate these archs when they are not given, but simply assume empty archs. What reason, other than because it will be easier to test with the new repo structure generated for the dnf branch, there is to not have dnf generate these arch values also?

---

That being said, I think the previous fragment and the rest of the conversation should be moved to a new bug. There is no reason to continue this talk about implementing this functionality in the dnf poky-contrib branch here. This bug is clearly about testing it. Since the dnf functionality is not done yet and is not in master, that is a bug/test for another time. I will use this bug to test the PACKAGE_FEED_URIS var in smartpm in master and kindly ask for a new bug to be opened to address implementation of the functionality in dnf.
Comment 7 Alexander Kanavin 2017-02-16 16:34:29 UTC
But why is this even an issue for you? If you are writing tests for smart, you don't set PACKAGE_FEED_ARCHS at all, and the code in package_manager.py will expand it into the correct list of architectures, one per feed. You need to test that the expansion looks sane in the resulting config file and that smart is able to access those feeds, and nothing exits with an error.

Similarly, when porting the same test to dnf, you do not set the PACKAGE_FEED_ARCHS at all either, and you still need to do the same two things:
1) check that the config file in the image looks sane
2) check that smart is able to access the feed.

Whether in case of dnf there is a per-architecture feed or not, is irrelevant for the test, no?
Comment 8 Humberto Ibarra 2017-02-16 16:51:07 UTC
It is important because smart knew how to correctly generate these archs and you are proposing to implement this for dnf (which again, is not the purpose of this bug) and not let dnf have an ability smart had.

Your test repo in dnf branch does not work with the PACKAGE_FEED_ARCHS, even if we give the right archs to the variable. You propose to not give the var at all and code around it, which doesn't sound right to me, adapting your code to work with your test repo doesn't seem like the way to go. This is already documented in the yocto manual, and adding dnf means that you need to support this var too.

I am working in this test already, but I am doing it for smart, which already has the correct structure. I will not test this for dnf in this bug, and won't implement the functionality for dnf to do this in this bug either.

If you have doubts about the smart implementation, we can continue this discussion. If your doubts are about dnf, specially about the implementation of this feature and not the test, please open a new bug for it. This is phrased as a bug to add tests, not to discuss what dnf should use as archs if PACKAGAE_FEED_ARCHS is not given.
Comment 9 Alexander Kanavin 2017-02-16 19:03:01 UTC
Okay my bad, I read the code in master now more closely. For testing smart, it doesn't reuse the package feed produced during image creation, but rather creates its own, separate feed (the former is in 'rpms' directory, the latter in 'rpm' - very easy to confuse), and then tests smart against that. This latter feed is created by calling createrepo directly from testimage.bbclass (and doing some other tricks), and so it is set up exactly the way the tests need.

I should add the same thing to dnf testing, where they don't reuse the image creation feed, but rather make their own in a similar way. Then the whole issue where PACKAGE_FEED_ARCHS clash with how image creation feed is made becomes moot. Agree?
Comment 10 Humberto Ibarra 2017-02-16 21:24:20 UTC
Agree. I only want to add that the image created folder is actually 'rpm' and the new repo created in package_manager.py is really the one called 'rpms'
Comment 11 Alexander Kanavin 2017-02-17 09:19:50 UTC
(In reply to comment #10)
> Agree. I only want to add that the image created folder is actually 'rpm'
> and the new repo created in package_manager.py is really the one called
> 'rpms'

I'll change those names to be more descriptive, e.g. "oe-rootfs-repo" and "oe-testimage-repo".
Comment 12 Alexander Kanavin 2017-02-17 11:18:23 UTC
The repo issue is now fixed in https://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=akanavin/dnf-rpm4 - dnf test is now using the feeds created by testimage.bbclass (I did slight tweaks to them, but repodata is still per arch).
Comment 13 Humberto Ibarra 2017-02-20 18:53:49 UTC
Sent patch for smart in master

http://lists.openembedded.org/pipermail/openembedded-core/2017-February/132994.html
Comment 14 Humberto Ibarra 2017-03-17 18:03:13 UTC
Working in a v2 patch to address comments.
Comment 16 Humberto Ibarra 2017-03-22 17:01:12 UTC
Already in master, with a patch sent by Alex Kanavin, but still has a dependency to #9675 and can't be marked RESOLVED until that one is fixed.
Comment 17 Alexander Kanavin 2017-03-22 20:05:22 UTC
I think you can totally resolve/fix this bug, as 9675 remains open only to update Yocto documentation, the rest of the work is done and merged.
Comment 18 Humberto Ibarra 2017-03-22 20:43:14 UTC
Removed dependency so I could mark this bug as solved.
Comment 19 oscar lopez arandas 2017-12-04 16:42:54 UTC
Test for PACKAGE_FEED_URIS  is added in selftest.

Build Configuration:
BB_VERSION        = "1.33.2"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "universal"
TARGET_SYS        = "i586-poky-linux"
MACHINE           = "qemux86"
DISTRO            = "poky"
DISTRO_VERSION    = "2.2+snapshot-20171204"
TUNE_FEATURES     = "m32 i586"
meta-selftest     = "HEAD:2b77735c72cb5100dbd850e79d4f639e82629842"

STEPS: 
1. git clone git://git.yoctoproject.org/poky"
2. $ git checkout <commit-id>
3. add   meta-sefltest  in vi conf/bblayers.conf
4. git clone git://git.yoctoproject.org/meta-selftest
5.$ bitbake rpm busybox run-postinsts
$ bitbake package-index
6. bitbake-selftest -v

expect-out:
all test pass 
actual expect-out:
all test pass

============================================================================
test_var_exec (bb.tests.codeparser.PythonReferenceTest) ... ok
test_var_reference (bb.tests.codeparser.PythonReferenceTest) ... ok
test_vardeps (bb.tests.codeparser.DependencyReferenceTest) ... ok
test_vardeps_expand (bb.tests.codeparser.DependencyReferenceTest) ... ok
============================================================================
full-log in attachment
Comment 20 oscar lopez arandas 2017-12-04 16:43:51 UTC
Created attachment 4140 [details]
full-log
Comment 21 Alexander Kanavin 2017-12-04 17:00:13 UTC
You are executing bitbake-selftest, but the test is in oe-selftest.
Comment 22 oscar lopez arandas 2017-12-04 17:09:37 UTC
(In reply to comment #21)
> You are executing bitbake-selftest, but the test is in oe-selftest.

ok Im go  prove in oe-sefltes, thanks
Comment 23 oscar lopez arandas 2017-12-05 16:14:30 UTC
 the test oe-sefltest run in ubuntu 16.04 AB GDC failed 
======================================================================
FAIL [392.534s]: test_testimage_install (oeqa.selftest.runtime-test.TestImage)
---------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1604/build/meta/lib/oeqa/selftest/runtime-test.py", line 130, in test_testimage_install
    bitbake('-c testimage core-image-full-cmdline')
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1604/build/meta/lib/oeqa/utils/commands.py", line 143, in bitbake
    return runCmd(cmd, ignore_status, timeout, **options)
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1604/build/meta/lib/oeqa/utils/commands.py", line 121, in runCmd
    raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, result.output))
AssertionError: Command 'bitbake  -c testimage core-image-full-cmdline' returned non-zero exit status 1:
Loading cache...done.
Loaded 1322 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

ERROR: core-image-full-cmdline-1.0-r0 do_testimage: Function failed: do_testimage

----------------------------------------------------------------------

Build Configuration:
BB_VERSION        = "1.33.2"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "universal"
TARGET_SYS        = "x86_64-poky-linux"
MACHINE           = "qemux86-64"
DISTRO            = "poky"
DISTRO_VERSION    = "2.2+snapshot-20171204"
TUNE_FEATURES     = "m64 core2"
meta-selftest     = "heads/master:2b77735c72cb5100dbd850e79d4f639e82629842"

full-log in attachment
Comment 24 oscar lopez arandas 2017-12-05 16:15:16 UTC
Created attachment 4143 [details]
oe-selftest-log
Comment 25 Alexander Kanavin 2017-12-05 16:23:51 UTC
The error is:

NOTE: runqemu exited with code 1
Output from runqemu:
Could not initialize SDL(No available video device) - exiting

That is a qemu/build setup issue, which you need to fix first before reaching the point where image tests can be run.
Comment 26 oscar lopez arandas 2017-12-05 20:16:03 UTC
the qemu/build setup issue, is solved and run the image test in oe-sefltest and all rerun and all succeeded. 

Build Configuration:
BB_VERSION        = "1.33.2"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "universal"
TARGET_SYS        = "i586-poky-linux"
MACHINE           = "qemux86"
DISTRO            = "poky"
DISTRO_VERSION    = "2.2+snapshot-20171205"
TUNE_FEATURES     = "m32 i586" 
meta-selftest     = "HEAD:2b77735c72cb5100dbd850e79d4f639e82629842"

STEPS: 
1. git clone git://git.yoctoproject.org/poky"
2. $ git checkout <commit-id>
3. add   meta-sefltest  in vi conf/bblayers.conf
4. git clone git://git.yoctoproject.org/meta-selftest
5.$ bitbake rpm busybox run-postinsts
$ bitbake package-index
6.bitbake oe-selftest-image


expect-out:
all test pass 
actual expect-out:
all test pass
================================================================================
NOTE: recipe oe-selftest-image-1.0-r0: task do_image_ext4: Started
NOTE: recipe oe-selftest-image-1.0-r0: task do_image_tar: Started
NOTE: recipe oe-selftest-image-1.0-r0: task do_image_ext4: Succeeded
NOTE: recipe oe-selftest-image-1.0-r0: task do_image_tar: Succeeded
NOTE: Running task 2392 of 2394 (/home/oscar/quemux/meta-selftest/recipes-test/images/oe-selftest-image.bb:do_image_complete)
NOTE: recipe oe-selftest-image-1.0-r0: task do_image_complete: Started
NOTE: recipe oe-selftest-image-1.0-r0: task do_image_complete: Succeeded
NOTE: Running task 2393 of 2394 (/home/oscar/quemux/meta-selftest/recipes-test/images/oe-selftest-image.bb:do_image_qa)
NOTE: recipe oe-selftest-image-1.0-r0: task do_image_qa: Started
NOTE: recipe oe-selftest-image-1.0-r0: task do_image_qa: Succeeded
NOTE: Running noexec task 2394 of 2394 (/home/oscar/quemux/meta-selftest/recipes-test/images/oe-selftest-image.bb:do_build)
NOTE: Tasks Summary: Attempted 2394 tasks of which 1770 didn't need to be rerun and all succeeded.
==============================================================================
full-log
Comment 27 oscar lopez arandas 2017-12-05 20:16:50 UTC
Created attachment 4144 [details]
full-log
Comment 28 Alexander Kanavin 2017-12-06 08:27:35 UTC
You are still verifying the wrong thing. 'bitbake oe-selftest-image' will not execute the test. You need to execute oe-selftest itself.
Comment 29 oscar lopez arandas 2017-12-06 14:38:01 UTC
(In reply to comment #28)
> You are still verifying the wrong thing. 'bitbake oe-selftest-image' will
> not execute the test. You need to execute oe-selftest itself.

What would be the correct steps to verify this error?
Comment 30 Jose Perez C 2017-12-06 16:41:01 UTC
(In reply to comment #29)
> (In reply to comment #28)
> > You are still verifying the wrong thing. 'bitbake oe-selftest-image' will
> > not execute the test. You need to execute oe-selftest itself.
> 
> What would be the correct steps to verify this error?

To verify this bug you can execute the "runtime_test" from oe-selftest suite, follow below steps and ensure all test cases are reported as PASS. 

1. echo "SANITY_TESTED_DISTROS=''" >> conf/local.conf
2. oe-selftest -r runtime_test 

as an alternative you can execute a oe-selfete buildset on the AB an verify that that below test cases are PASS.


runtime_test.Postinst.test_postinst_rootfs_and_boot
runtime_test.TestExport.test_testexport_basic
runtime_test.TestExport.test_testexport_sdk
--> runtime_test.TestImage.test_testimage_dnf --> "This is actually the test that is coevring the feature"
runtime_test.TestImage.test_testimage_install
Comment 31 oscar lopez arandas 2017-12-07 14:52:46 UTC
 can execute a oe-selfete buildset on the AB an verify that that below test cases are PASS.

Build Configuration:
BB_VERSION           = "1.37.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "fedora-25"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "2.4+snapshot-20171206"
TUNE_FEATURES        = "m64 core2"       
meta-yocto-bsp       = "heads/master:4469acdf1d0338220f3fe2ecb5e079eea6fda375"
============================================================================
2017-12-06 18:20:37,155 - oe-selftest - INFO - RESULTS - runtime_test.Postinst.test_postinst_rootfs_and_boot - Testcase 1540: PASSED
2017-12-06 18:20:37,155 - oe-selftest - INFO - RESULTS - runtime_test.TestExport.test_testexport_basic - Testcase 1499: PASSED
2017-12-06 18:20:37,155 - oe-selftest - INFO - RESULTS - runtime_test.TestExport.test_testexport_sdk - Testcase 1641: PASSED
2017-12-06 18:20:37,155 - oe-selftest - INFO - RESULTS - runtime_test.TestImage.test_testimage_dnf - Testcase 1883: PASSED
2017-12-06 18:20:37,155 - oe-selftest - INFO - RESULTS - runtime_test.TestImage.test_testimage_install - Testcase 1644: PASSED
2017-12-06 18:20:37,155 - oe-selftest - INFO - RESULTS - selftest.ExternalLayer.test_list_imported - Testcase 1885: PASSED
============================================================================
log in attachment
Comment 32 oscar lopez arandas 2017-12-07 14:53:37 UTC
Created attachment 4151 [details]
all testcases pass