Bug 10874

Summary: oe-selftest: 35% of the testing time is concentrated in 5 tests (out of ~200)
Product: [QA/Testing] Build Testing Reporter: Benjamin Esquivel <benjamin.esquivel>
Component: generalAssignee: Leonardo Sandoval Gonzalez <leonardo.sandoval.gonzalez>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Medium+ CC: jku, joshuagloe, leonardo.sandoval.gonzalez, ross.burton
Version: unspecified   
Target Milestone: 2.5 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on: 10929, 10996, 11233, 11234, 11238    
Bug Blocks:    
Attachments:
Description Flags
morty oe-selftest time measurements, ordered by greatest time to run. none

Description Benjamin Esquivel 2017-01-03 17:48:04 UTC
Created attachment 3582 [details]
morty oe-selftest time measurements, ordered by greatest time to run.

An effort could be done to reduce testing time of the following items:

archiver.Archiver.test_archiver_allows_to_filter_on_recipe_name
buildoptions.ImageOptionsTests.test_read_only_image		
manifest.VerifyManifest.test_SDK_manifest_entries		
wic.Wic.test_bmap
sstatetests.SStateTests.test_sstate_cache_management_script_using_machine	

These tests together take around 35% of the time to test oe-selftest. See the attached for more details. The measurements were done in the morty release.
Comment 1 Leonardo Sandoval Gonzalez 2017-01-04 21:46:04 UTC
This may become the bug that will target the profiling analysis which may file other bugs to reduce (optimize) the main bottlenecks.
Comment 2 Ross Burton 2017-01-09 23:40:53 UTC
!!!

I'll have a look tomorrow.  At least the archiver test should be trivial and this indicates a bug in the archiver.
Comment 3 Leonardo Sandoval Gonzalez 2017-01-10 22:33:07 UTC
(In reply to comment #2)
> !!!
> 
> I'll have a look tomorrow.  At least the archiver test should be trivial and
> this indicates a bug in the archiver.

Thanks Ross. 

BTW, to get profiling data per unit tests I will use something like this

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=lsandov1/oesdktest-profiling&id=bc717d33fb9e712e0e0d6343fb40f42111b856b3
Comment 4 Ross Burton 2017-01-11 14:26:01 UTC
So read_only_image just builds a core-image-minimal, is it possible that this was the first test to actually build an image?
Comment 5 Leonardo Sandoval Gonzalez 2017-01-11 15:04:45 UTC
(In reply to comment #4)
> So read_only_image just builds a core-image-minimal, is it possible that
> this was the first test to actually build an image?

Good question, let me check that. BTW, read_only_image builds a sato, not a minimal.

    @testcase(1435)
    def test_read_only_image(self):
        distro_features = get_bb_var('DISTRO_FEATURES')
        if not ('x11' in distro_features and 'opengl' in distro_features):
            self.skipTest('core-image-sato requires x11 and opengl in distro features')
        self.write_config('IMAGE_FEATURES += "read-only-rootfs"')
        bitbake("core-image-sato")
        # do_image will fail if there are any pending postinsts
Comment 6 Leonardo Sandoval Gonzalez 2017-01-25 16:29:32 UTC
*** Bug 10254 has been marked as a duplicate of this bug. ***
Comment 7 Leonardo Sandoval Gonzalez 2017-01-26 21:20:11 UTC
Here is some profiling data.

* sorted times (in seconds) per test case

$ sed -n -e 's/.* \(test.*\) (\(.*\)) ... OK (\(.*\)s)/\1 \2 \3/p' nightly-oe-selftest.autobuilder.log | datamash -t ' ' -g2 sum 3 | awk '{print $2, $1}' | sort -n -r
6557.767 oeqa.selftest.buildoptions.ImageOptionsTests
6107.847 oeqa.selftest.runtime-test.Postinst
4362.983 oeqa.selftest.devtool.DevtoolTests
3989.167 oeqa.selftest.sstatetests.SStateTests
3254.606 oeqa.selftest.wic.Wic
2857.417 oeqa.selftest.bbtests.BitbakeTests
1315.838 oeqa.selftest.prservice.BitbakePrTests
1308 oeqa.selftest.archiver.Archiver
1195.199 oeqa.selftest.manifest.VerifyManifest
1139.806 oeqa.selftest.imagefeatures.ImageFeatures
629.967 oeqa.selftest.recipetool.RecipetoolTests
538.316 oeqa.selftest.systemd_boot.Systemdboot
444.576 oeqa.selftest.eSDK.oeSDKExtSelfTest
374.008 oeqa.selftest.runtime-test.TestImage
365.66 oeqa.selftest.runtime-test.TestExport
343.099 oeqa.selftest.recipetool.RecipetoolAppendsrcTests
293.396 oeqa.selftest.buildoptions.SanityOptionsTest
268.011 oeqa.selftest.buildoptions.BuildhistoryTests
255.04 oeqa.selftest.signing.Signing
236.454 oeqa.selftest.bblayers.BitbakeLayers
221.433 oeqa.selftest.oescripts.TestScripts
142.181 oeqa.selftest.pkgdata.OePkgdataUtilTests
134.103 oeqa.selftest.oescripts.BuildhistoryDiffTests
126.501 oeqa.selftest.buildoptions.ArchiverTest
98.752 oeqa.selftest.buildoptions.DiskMonTest
70.753 oeqa.selftest.layerappend.LayerAppendTests
50.305 oeqa.selftest.signing.LockedSignatures
28.792 oeqa.selftest.liboe.LibOE
23.9 oeqa.selftest.tinfoil.TinfoilTests
18.349 oeqa.selftest.lic-checksum.LicenseTests
15.812 oeqa.selftest.image_typedep.ImageTypeDepTests
0.011 oeqa.selftest.oelib.path.TestRealPath
0 oeqa.selftest.oelib.utils.TestTrimVersion
0 oeqa.selftest.oelib.utils.TestPackagesFilterOutSystem
0 oeqa.selftest.oelib.types.TestList
0 oeqa.selftest.oelib.types.TestBooleanType
0 oeqa.selftest.oelib.license.TestSingleLicense
0 oeqa.selftest.oelib.license.TestSimpleCombinations
0 oeqa.selftest.oelib.elf.TestElf
Comment 8 Leonardo Sandoval Gonzalez 2017-01-26 21:24:44 UTC
* top-10 oe-selftest consuming most time

sed -n -e 's/.* \(test.*\) (\(.*\)) ... OK (\(.*\)s)/\1 \2 \3/p' nightly-oe-selftest.autobuilder.log | awk '{print $3, $2, $1}' | sort -n -r | head
5947.529 oeqa.selftest.runtime-test.Postinst test_postinst_roofs_and_boot
3765.832 oeqa.selftest.buildoptions.ImageOptionsTests test_read_only_image
1989.198 oeqa.selftest.buildoptions.ImageOptionsTests test_ccache_tool
1974.684 oeqa.selftest.wic.Wic test_alternate_output_dir
1606.850 oeqa.selftest.bbtests.BitbakeTests test_non_gplv3
1308.000 oeqa.selftest.archiver.Archiver test_archiver_allows_to_filter_on_recipe_name
1173.233 oeqa.selftest.manifest.VerifyManifest test_SDK_manifest_entries
802.737 oeqa.selftest.buildoptions.ImageOptionsTests test_incremental_image_generation
566.259 oeqa.selftest.sstatetests.SStateTests test_sstate_cache_management_script_using_machine
550.060 oeqa.selftest.devtool.DevtoolTests test_devtool_add_library

log obtained from AB [1]

[1] https://autobuilder.yoctoproject.org/main/builders/nightly-oe-selftest/builds/807
Comment 9 Leonardo Sandoval Gonzalez 2017-01-31 22:55:23 UTC
Two series are intended to reduce the cpu time considerably [1] [2] but there is still room for improvement, specially including the sstate mirrors, but the later is block by bug 10929.

[1] http://lists.openembedded.org/pipermail/openembedded-core/2017-January/132088.html

[2] http://lists.openembedded.org/pipermail/openembedded-core/2017-January/131986.html
Comment 10 Leonardo Sandoval Gonzalez 2017-02-22 18:08:13 UTC
There have been several patches targeting optimizations sent (and most merged) during M3 so we should check again the numbers after the M3 release, so moving it to M4.
Comment 11 Jussi Kukkonen 2017-03-24 09:11:42 UTC
I've filed a specific bug 11233 for test_archiver_allows_to_filter_on_recipe_name because I don't think it was fixed. Still seems to (at least sometimes) take over 8 minutes to finish.
Comment 12 Jussi Kukkonen 2017-03-24 09:20:10 UTC
Almost current top 20 (March 3rd, https://autobuilder.yocto.io/builders/nightly-oe-selftest/builds/200):
2656.240 oeqa.selftest.runtime-test.Postinst test_postinst_roofs_and_boot
890.481 oeqa.selftest.wic.Wic test_bmap_long
708.996 oeqa.selftest.buildoptions.ImageOptionsTests test_read_only_image
575.632 oeqa.selftest.buildoptions.ImageOptionsTests test_ccache_tool
569.475 oeqa.selftest.manifest.VerifyManifest test_SDK_manifest_entries
484.100 oeqa.selftest.bbtests.BitbakeTests test_non_gplv3
263.932 oeqa.selftest.imagefeatures.ImageFeatures test_clutter_image_can_be_built
262.426 oeqa.selftest.wic.Wic test_iso_image
259.397 oeqa.selftest.systemd_boot.Systemdboot test_efi_systemdboot_images_can_be_built
253.061 oeqa.selftest.bbtests.BitbakeTests test_continue
249.166 oeqa.selftest.devtool.DevtoolTests test_devtool_add_library
243.201 oeqa.selftest.archiver.Archiver test_archiver_allows_to_filter_on_recipe_name
229.400 oeqa.selftest.devtool.DevtoolTests test_devtool_modify_native
215.134 oeqa.selftest.runtime-test.TestImage test_testimage_install
187.150 oeqa.selftest.buildoptions.ImageOptionsTests test_incremental_image_generation
180.311 oeqa.selftest.sstatetests.SStateTests test_sstate_cache_management_script_using_pr_3
172.013 oeqa.selftest.devtool.DevtoolTests test_devtool_build_image
167.931 oeqa.selftest.devtool.DevtoolTests test_devtool_deploy_target
149.136 oeqa.selftest.imagefeatures.ImageFeatures test_wayland_support_in_image
136.856 oeqa.selftest.wic.Wic test_qemu

(the very latest runs have test_devtool_virtual_kernel_modify taking 8 hours alone but that's at least partly a kernel cloning issue)
Comment 13 Leonardo Sandoval Gonzalez 2017-04-12 18:39:59 UTC
Updating the top 10 list with a current build

curl -s https://autobuilder.yoctoproject.org/main/builders/nightly-oe-selftest/builds/870/steps/Running%20oe-selftest/logs/stdio/text | sed -n -e 's/.* \(test.*\) (\(.*\)) ... OK (\(.*\)s)/\1 \2 \3/p' | awk '{print $3, $2, $1}' | sort -n -r | head

5344.897 oeqa.selftest.runtime-test.Postinst test_postinst_rootfs_and_boot
3078.308 oeqa.selftest.buildoptions.ImageOptionsTests test_ccache_tool
1353.179 oeqa.selftest.devtool.DevtoolTests test_devtool_virtual_kernel_modify
770.546 oeqa.selftest.devtool.DevtoolTests test_devtool_build_image
753.150 oeqa.selftest.imagefeatures.ImageFeatures test_clutter_image_can_be_built
658.208 oeqa.selftest.signing.Signing test_signing_packages
639.644 oeqa.selftest.archiver.Archiver test_archiver_allows_to_filter_on_recipe_name
560.257 oeqa.selftest.devtool.DevtoolTests test_devtool_buildclean
547.177 oeqa.selftest.wic.Wic test_iso_image
541.583 oeqa.selftest.manifest.VerifyManifest test_SDK_manifest_entries

the build taken was built and has the commit id:

Apr 11 20:51 	b283b10d5363... 	success 	#870 	Build successful

taken from https://autobuilder.yoctoproject.org/main/builders/nightly-oe-selftest
Comment 14 Leonardo Sandoval Gonzalez 2017-10-31 15:17:50 UTC
This is an umbrella bug and all its dependencies where completed so resolving it as fixed.

In the other hand, there are two main actions that have impact the building times, reducing these considerably:

1. share states are **now** being used in the autobuilder directly impacting the building times. 

2. early  2.5 M1, what is being proposed at bug 10033 (oe-selftest parallelization) will greatly impact the times (local tests indicated the complete oe-selftest execution runs in less than an hour)