Compare commits

..

170 Commits

Author SHA1 Message Date
Richard Purdie
84b78df15f build-appliance-image: Update to sumo head revision
(From OE-Core rev: 0a2db923fd17019d07d88204b355aa46590f0b97)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-27 23:22:02 +00:00
Richard Purdie
c10a028e27 oeqa/utils/gitarchive: Handle case where parent is only on origin
The parent code currently assumed that any parent branch is locally
checked out which may not be the case.

Use the local branch by default but fall back to the origin. This
also means removing the later saftey check as the branch may not exist
locally.

This fixes the autobuilder resulttool test pushing code.

(From OE-Core rev: 633e024f5d492ba38debf745b59813f6a2f4a3f0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-27 23:21:47 +00:00
Richard Purdie
a01fba7973 build-appliance-image: Update to sumo head revision
(From OE-Core rev: ece8242187558011940d7c6762b64c7116e38689)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:54:21 +00:00
Richard Purdie
7255a417d4 poky.conf: Bump version for 2.5.3 sumo release
(From meta-yocto rev: c19ec95877614314ab236fd89d9b5055f33de0c4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:54:12 +00:00
Richard Purdie
6690c4962c yocto-uninative: Update to 2.4
This supports glibc 2.29 which is appearing in distros like Ubuntu 19.04

(From OE-Core rev: 661ac7ed164965690a4334d372bf22f04c3bfd3a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
[Fixed up for Sumo context; no aarch64]
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Richard Purdie
ee12af6556 oe-build-perf-report/gitarchive: Move common useful functions to library
These functions can be reused by the resulttool code so move to the common
function library for this purpose.

(From OE-Core rev: c66f848938c04e133259c5b6903dc592866ab385)

(From OE-Core rev: 94a3ca85d30fc957f8f01a216a75342be49f9143)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Richard Purdie
622e5728da scripts/oe-git-archive: Separate out functionality to library function
This turns the core of the script into a library function. Ultimately this
will let us call that code with custom 'keywords' rather than relying
on the data parsed from bitbake metadata which can't be used when archiving
historical results.

(From OE-Core rev: 4820ca2b0850e29b04a4fd5659a6e9837d6714d0)

(From OE-Core rev: ab5d49ba8bb02410fb9f3024f98ff19a04acb3ca)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Richard Purdie
14e86a2968 oe-build-perf-report: Fix missing buildstats comparisions
Integers were being compared to strings leading to missing buildstats comparision
data. Fix this.

(From OE-Core rev: 2dbbf598192ae2b3aa488df042f56aa6c6634a00)

(From OE-Core rev: e8651b2e01db0777b23a0359f9413c3b27bae77f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Richard Purdie
b25e586458 oe-build-perf-report: Improve branch comparision handling
When comparing branches, correctly filter the revisions corresponding
to the specific branch specified.

Also use the commit numbers as a way to gauge spatially related commits
for comparision meaning comparisions for out of order build revisions
becomes meaninful.

This should improve the reporting for autobuilder generated builds.

Also improve the branch option help text.

(From OE-Core rev: 9f6f4ab6eec9dca07af7f53da5f737a6167bfb38)

(From OE-Core rev: d6645c4c931565d62df85db0fa71f15d51265828)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Richard Purdie
988205356d oe-build-perf-report: Allow commits from different branches
The code won't currently allow comparisions of two commits on different
branches even if the commits are specified by their hashes.

This updates the code to search two branches for any relavent commits,
hence allowing comparisions to be made. A particularly useful case is
master vs. master-next for example.

(From OE-Core rev: 2d835bb1570c515ae501442f3ce19fae8e249b27)

(From OE-Core rev: c6351550a9bff3e0b0e3d3c0baefed4041c47b33)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Richard Purdie
3975e0ea7a oe-build-perf-report: Allow branch without hostname
Allow the branch to be set without the hostname option. Previously
if hostname wasn't set, branch would be overwritten regardless of
whether it was set or not.

(From OE-Core rev: 3ec43bf4c6c8f7730a67f63ad4e14903f289014e)

(From OE-Core rev: e95277e859adb3e3ca26c8c618954ae52ec3bff4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Mazliana
dd4921cf36 resulttool/manualexecution: To output right test case id
We found that manualexecution does not capture test suite values
correctly if there are more than one test suite in test cases.
After verification has made we found out we should retrieved
full test cases value <test_module.test_suite.test_case> from
oeqa/manual/ json file rather than split it them into new
variables test_suite and test_cases.

(From OE-Core rev: d1dee26b13dd565bf06307c99b02f6d57ff0ddef)

Signed-off-by: Mazliana <mazliana.mohamad@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Yeoh Ee Peng
86aa896b9e resulttool/report: Enable roll-up report for a commit
Enable roll-up all test results belong to a commit
and to provide a roll-up report.

(From OE-Core rev: 8f23018bcb76c1b431f69183f993f08adb660fae)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Yeoh Ee Peng
3e6a012462 scripts/resulttool: Enable manual result store and regression
To enable store for testresults.json file from manualexecution,
add layers metadata to configuration and add "manual" map to
resultutils.store_map.

To enable regression for manual, add "manual" map to
resultutils.regression_map. Also added compulsory configurations
('MACHINE', 'IMAGE_BASENAME') to manualexecution.

(From OE-Core rev: 514a9165790dda2afb412c519cb1444493dff1f9)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:28 +00:00
Yeoh Ee Peng
43823fbe11 resulttool/regression: Ensure regressoin results are sorted
Sorted regression results to provide friendly viewing of report.

(From OE-Core rev: de222c3c9e3aa34e42e1ad6ba6cbb9e1a18ccd80)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Richard Purdie
fa60137844 resulttool/store: Fix missing variable causing testresult corruption
(From OE-Core rev: 811d2be3cef340ee945335552892a2a49a46bf4b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Richard Purdie
e2a49f2679 resulttool/report: Ensure ptest results are sorted
(From OE-Core rev: f182217970029ba0260df3c3089101352da083ce)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Richard Purdie
c381ceb8eb resulttool/report: Ensure test suites with no results show up on the report
ptest suites with no results don't show up on the reports even though we have
a duration for them. Fix this so the fact they report no tests is visible.

(From OE-Core rev: a61ad19d5f997cb2377ca307c94ca2d53f8c0c49)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Richard Purdie
652b502456 resulttool/report: Handle missing metadata sections more cleanly
Currently some older results files cause the code to give tracebacks.
Handle these missing sections more cleanly.

(From OE-Core rev: 829754c380ca2b614afa23500e53a8c5b850932f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Richard Purdie
a1a31bb856 resulttool/store: Handle results files for multiple revisions
Currently we cant store results if the results files span multiple
different build revisons. Remove this limitation by iterating.

(From OE-Core rev: 22a5982dbcb624ffcdbacef92b2a235851214663)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Richard Purdie
da75c0b5b4 resulttool/resultutils: Avoids tracebacks for missing logs
(From OE-Core rev: d5d62b31b192b88c6a829099b74bfb30583b066e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Richard Purdie
c7eb843d7c resulttool: Improvements to allow integration to the autobuilder
This is a combined patch of the various tweaks and improvements I
made to resulttool:

* Avoid subprocess.run() as its a python 3.6 feature and we
  have autobuilder workers with 3.5.

* Avoid python keywords as variable names

* Simplify dict accesses using .get()

* Rename resultsutils -> resultutils to match the resultstool ->
  resulttool rename

* Formalised the handling of "file_name" to "TESTSERIES" which the code
  will now add into the json configuration data if its not present, based
  on the directory name.

* When we don't have failed test cases, print something saying so
  instead of an empty table

* Tweak the table headers in the report to be more readable (reference
  "Test Series" instead if file_id and ID instead of results_id)

* Improve/simplify the max string length handling

* Merge the counts and percentage data into one table in the report
  since printing two reports of the same data confuses the user

* Removed the confusing header in the regression report

* Show matches, then regressions, then unmatched runs in the regression
  report, also remove chatting unneeded output

* Try harder to "pair" up matching configurations to reduce noise in
  the regressions report

* Abstracted the "mapping" table concept used to pairing in the
  regression code to general code in resultutils

* Created multiple mappings for results analysis, results storage and
  'flattening' results data in a merge

* Simplify the merge command to take a source and a destination,
  letting the destination be a directory or a file, removing the need for
  an output directory parameter

* Add the 'IMAGE_PKGTYPE' and 'DISTRO' config options to the regression
  mappings

* Have the store command place the testresults files in a layout from
  the mapping, making commits into the git repo for results storage more
  useful for simple comparison purposes

* Set the oe-git-archive tag format appropriately for oeqa results
  storage (and simplify the commit messages closer to their defaults)

* Fix oe-git-archive to use the commit/branch data from the results file

* Cleaned up the command option help to match other changes

* Follow the model of git branch/tag processing used by oe-build-perf-report
  and use that to read the data using git show to avoid branch change

* Add ptest summary to the report command

* Update the tests to match the above changes

(From OE-Core rev: e4195565d2a50046d4378c97f7a593c41bed51bd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Mazliana
075cd5e7fe scripts/resulttool: enable manual execution and result creation
Integrated “manualexecution” operation to resulttool scripts.
Manual execution script is a helper script to execute all manual
test cases in baseline command, which consists of user guideline
steps and the expected results. The last step will ask user to
provide their input to execute result. The input options are
passed/failed/blocked/skipped status. The result given will be
written in testresults.json including log error from the user
input and configuration if there is any.The output test result
for json file is created by using OEQA library.

The configuration part is manually key-in by the user. The system
allow user to specify how many configuration they want to add and
they need to define the required configuration name and value pair.
In QA perspective, "configuration" means the test environments and
parameters used during QA setup before testing can be carry out.
Example of configurations: image used for boot up, host machine
distro used, poky configurations, etc.

The purpose of adding the configuration is to standardize the
output test result format between automation and manual execution.

To use these scripts, first source oe environment, then run the
entry point script to look for help.
        $ resulttool

To execute manual test cases, execute the below
        $ resulttool manualexecution <manualjsonfile>

By default testresults.json store in <build_dir>/tmp/log/manual/

[YOCTO #12651]

(From OE-Core rev: cd2ef260569a67907801299b1397db94aa871cb5)

Signed-off-by: Mazliana <mazliana.mohamad@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Yeoh Ee Peng
d038d97d48 resulttool: enable merge, store, report and regression analysis
OEQA outputs test results into json files and these files were
archived by Autobuilder during QA releases. Example: each oe-selftest
run by Autobuilder for different host distro generate a
testresults.json file.

These scripts were developed as a test result tools to manage
these testresults.json file.

Using the "store" operation, user can store multiple testresults.json
files as well as the pre-configured directories used to hold those files.

Using the "merge" operation, user can merge multiple testresults.json
files to a target file.

Using the "report" operation, user can view the test result summary
for all available testresults.json files inside a ordinary directory
or a git repository.

Using the "regression-file" operation, user can perform regression
analysis on testresults.json files specified. Using the "regression-dir"
and "regression-git" operations, user can perform regression analysis
on directory and git accordingly.

These resulttool operations expect the testresults.json file to use
the json format below.
{
    "<testresult_1>": {
        "configuration": {
            "<config_name_1>": "<config_value_1>",
            "<config_name_2>": "<config_value_2>",
            ...
            "<config_name_n>": "<config_value_n>",
        },
        "result": {
            "<testcase_namespace_1>": {
                "status": "<PASSED or FAILED or ERROR or SKIPPED>",
                "log": "<failure or error logging>"
            },
            "<testcase_namespace_2>": {
                "status": "<PASSED or FAILED or ERROR or SKIPPED>",
                "log": "<failure or error logging>"
            },
            ...
            "<testcase_namespace_n>": {
                "status": "<PASSED or FAILED or ERROR or SKIPPED>",
                "log": "<failure or error logging>"
            },
        }
    },
    ...
    "<testresult_n>": {
        "configuration": {
            "<config_name_1>": "<config_value_1>",
            "<config_name_2>": "<config_value_2>",
            ...
            "<config_name_n>": "<config_value_n>",
        },
        "result": {
            "<testcase_namespace_1>": {
                "status": "<PASSED or FAILED or ERROR or SKIPPED>",
                "log": "<failure or error logging>"
            },
            "<testcase_namespace_2>": {
                "status": "<PASSED or FAILED or ERROR or SKIPPED>",
                "log": "<failure or error logging>"
            },
            ...
            "<testcase_namespace_n>": {
                "status": "<PASSED or FAILED or ERROR or SKIPPED>",
                "log": "<failure or error logging>"
            },
        }
    },
}

To use these scripts, first source oe environment, then run the
entry point script to look for help.
    $ resulttool

To store test result from oeqa automated tests, execute the below
    $ resulttool store <source_dir> <git_branch>

To merge multiple testresults.json files, execute the below
    $ resulttool merge <base_result_file> <target_result_file>

To report test report, execute the below
    $ resulttool report <source_dir>

To perform regression file analysis, execute the below
    $ resulttool regression-file <base_result_file> <target_result_file>

To perform regression dir analysis, execute the below
    $ resulttool regression-dir <base_result_dir> <target_result_dir>

To perform regression git analysis, execute the below
    $ resulttool regression-git <source_dir> <base_branch> <target_branch>

[YOCTO# 13012]
[YOCTO# 12654]

(From OE-Core rev: bb0bc6368bb51ac0be77d13fe931601d493951ea)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-26 15:38:27 +00:00
Jonathan Rajotte-Julien
cefa08aeef lttng-tools: update to 2.9.11
(From OE-Core rev: 4af5a794497746629a35726ce515556b53d40da9)

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-25 23:12:03 +00:00
Jonathan Rajotte-Julien
3fd4794b16 lttng-modules: update to 2.10.9
Pertinent fix for OE-Core since 2.10.6:
    Fix: out of memory error handling
    Fix: access migrate_disable field directly
    Prevent allocation of buffers if exceeding available memory

2.10.9 also contains the necessary fix to support kernel up to 5.0.

(From OE-Core rev: 9666e9f6058bfd8294cb4e6b03752f28159a76bc)

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-25 23:12:03 +00:00
Jonathan Rajotte-Julien
26745f6b22 lttng-ust: update to 2.10.3
(From OE-Core rev: 9d8b3988a53449fa18398e9eaae1627923eeef97)

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-25 23:12:03 +00:00
Stefan Müller-Klieser
61f17352ec coreutils: 8.29: fix native build
This fixes the native build on glibc 2.28 hosts, by backporting two
gnulib patches from master.

(From OE-Core rev: fe7c33cd470d7466be48391b11ea703746812014)

Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-25 23:12:03 +00:00
Martin Jansa
2333147fa6 busybox: backport fix for issues introduced by CVE-2011-5325.patch
(From OE-Core rev: d0555e89514f2641387ef061f9ffcd1c8ced008c)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-25 23:12:03 +00:00
Mingli Yu
e0fdb98b0f logrotate.py: restore /etc/logrotate.d/wtmp
During the test logrotate.LogrotateTest.test_1_logrotate_setup,
there is below logic:
 # mkdir $HOME/logrotate_dir
 # sed -i "s#wtmp {#wtmp {\n    olddir $HOME/logrotate_dir#" /etc/logrotate.d/wtmp

After all logrotate.LogrotateTest finished, only cleanup
$HOME/logrotate_dir as below, but don't restore
the config file /etc/logrotate.d/wtmp.
[snip]
def tearDownClass(cls):
    cls.tc.target.run('rm -rf $HOME/logrotate_dir')
[snip]

That's to say, there is one additional line added
to /etc/logrotate.d/wtmp and will make the logrotate
service start failed when run systemd.SystemdBasicTests.test_systemd_failed

Take an example as below when run test as root:
 # cat /etc/logrotate.d/wtmp
 # no packages own wtmp -- we'll rotate it here
 /var/log/wtmp {
    olddir /root/logrotate_dir
    missingok
    monthly
    create 0664 root utmp
    minsize 1M
    rotate 1
 }

 # ls /root/logrotate_dir
 ls: cannot access '/root/logrotate_dir': No such file or directory

 # systemctl start logrotate
 Job for logrotate.service failed because the control process exited with error code.
 See "systemctl status logrotate.service" and "journalctl -xe" for details.

 # systemctl status logrotate
  logrotate.service - Rotate log files
   Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset>
   Active: failed (Result: exit-code) since Wed 2019-02-13 03:35:19 UTC; 7s ago
     Docs: man:logrotate(8)
           man:logrotate.conf(5)
   Process: 540 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=1/FAILURE)
   Main PID: 540 (code=exited, status=1/FAILURE)

  Feb 13 03:35:18 qemumips systemd[1]: Starting Rotate log files...
  Feb 13 03:35:19 qemumips logrotate[540]: error: wtmp:9 error verifying olddir path /root/logrotate_dir: No such file or directory
  Feb 13 03:35:19 qemumips logrotate[540]: error: found error in file wtmp, skipping
  Feb 13 03:35:19 qemumips systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
  Feb 13 03:35:19 qemumips systemd[1]: logrotate.service: Failed with result 'exit-code'.
  Feb 13 03:35:19 qemumips systemd[1]: Failed to start Rotate log files.

Add the logic to restore /etc/logrotate.d/wtmp to
make the cleanup complete to fix the above issue.

(From OE-Core rev: a2db9320d97d12d87524ff16a329f9c38a8da33f)

(From OE-Core rev: a5dcf0c4bd9a0be2f2484b0b1b3e77f1f2128dfc)

Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
George McCollister
0278e515fd systemd: fix CVE-2019-6454
Apply patches from systemd_237-3ubuntu10.13 to fix CVE-2019-6454.
CVE-2019-6454 is an issue in which systemd (PID1) can be crashed
with a specially formed D-Bus message.

For information see:
https://usn.ubuntu.com/3891-1/
https://git.launchpad.net/ubuntu/+source/systemd/commit/?h=applied/ubuntu/bionic-updates&id=d7584b894afcaa8a4a1abb69db2a9c81a6276e80

(From OE-Core rev: 342157b135e7493e5965b706ede93bee190fbe32)

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
George McCollister
4c55db6d5c systemd: fix CVE-2018-6954
Apply patches to fix CVE-2018-6954

NVD description from https://nvd.nist.gov/vuln/detail/CVE-2018-6954

systemd-tmpfiles in systemd through 237 mishandles symlinks present in
non-terminal path components, which allows local users to obtain
ownership of arbitrary files via vectors involving creation of a
directory and a file under that directory, and later replacing that
directory with a symlink. This occurs even if the fs.protected_symlinks
sysctl is turned on.

Patches from systemd_237-3ubuntu10.13.debian.

These patches shouldn't be required on newer OE releases since they use
systemd v239 or higher.

(From OE-Core rev: 607350d98aa4c65b71fe1f10900e205fad81d1ec)

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
Marcus Cooper
d4e0f92528 systemd: Security fix CVE-2018-16866
Affects < v240

(From OE-Core rev: 10fa35a75617e82650b12d3e353a554f05f036dd)

Signed-off-by: Marcus Cooper <marcusc@axis.com>

>From v2 patch on openembedded-core@lists.openembedded.org
Incresed file name number from 0026 to 0027.

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
George McCollister
7be61780af systemd: Security fix CVE-2018-16865
Affects < v240

Based on thud commit d5d2b821fc85b8cf39f683061ac2a45bddd2139f
The second patch in the thud commit doesn't apply against 237. Use the
version of the second patch CVE-2018-16865_2.patch from
systemd_237-3ubuntu10.13.debian.

(From OE-Core rev: da41e48567eb21a47426a6fbe23ea07ce780cd3c)

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
George McCollister
c3890467ff systemd: Security fix CVE-2018-16864
Affects < v240

Based on thud commit 403e74b07b6f3c4a2444e68c74a8434fb17aee49
The patch in the thud commit doesn't compile against 237. Use the
version of this patch, CVE-2018-16864.patch from
systemd_237-3ubuntu10.13.debian.

(From OE-Core rev: ddbe969d0c9052a3ae17ef8f1cec8da847c722d3)

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
Chen Qi
b3ed759360 systemd: fix CVE-2018-15688
Backport patch to fix the following CVE.

CVE: CVE-2018-15688

(From OE-Core rev: d490839e881f3ff30a4bde8137cb04cb0fd37acd)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Cherry-picked from thud 13591d7224393dc0ae529a03cdf74aceb3540ce9

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
George McCollister
0e63d91b2b systemd: fix CVE-2018-15687
Backport patch to fix the following CVE.

CVE: CVE-2018-15687

Based on thud commit eeb621aa19f690971caf862290a172a115578ba1
The patch in the thud commit doesn't compile against 237. Use the
version of this patch,  CVE-2018-15687.patch from
systemd_237-3ubuntu10.13.debian.

(From OE-Core rev: 3e8ba9af58253ed9db0f0376a8e2966e45ee089e)

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
Chen Qi
d5400f11dd systemd: fix CVE-2018-15686
Backport patch to fix the following CVE.

CVE: CVE-2018-15686

(From OE-Core rev: 06bf145cee24b677ab076498fe8399126971bc43)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Cherry-picked from thud 0ef70603bc983315eb0e8a97958d995a31198c35

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
ROGEZ Matthieu
0b554def18 systemd: Fix typo in root home variable.
This regression has been introduced while upgrading to version 237
(commit 906230a73b3ccfa4afd2a19a6b0aa18cd1d5fa08)
and seems to only affect sumo version.

(From OE-Core rev: 665b41d326654235d305649be4be69a1be8dc00b)

Signed-off-by: Matthieu Rogez <matthieu.rogez@fivesgroup.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
Richard Purdie
0a8f50fd31 oeqa/runtime/dnf: Fix test error when static libs are enabled
The test works by excluding curl-dev which curl-staticdev depends upon.
When static libraries aren't disabled, this leads to an odd looking test
failure.

Simply exclude curl-staticdev as well in case its enabled to make sure
the test always works.

(From OE-Core rev: dfded083d9456c8d2bb168dbe8e08b2ffb3e1a26)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
Stefan Agner
b4daa5ba96 run-postinsts: for dpkg/opkg, do not rely on /etc/*-postinsts
Start opkg/dpkg as soon as the respective package managers status
file is present, no matter whether /etc/$pm-postinsts exists. This
decouples the implicit link between postinsts scripts in /etc and
the package manager: Currently the package manager is only started
if those scripts are present, although the package manager does not
use those scripts at all! Package managers install their own set of
postinst scripts.

The behavior when using rpm packages stays the same.

Note that using the package managers capability to execute postinst
scripts is preferred for good reasons: It makes sure that the
package managers database reflects that the packages have been
completely installed and configured.

This change allows to drop installation of the postinsts scripts
when package management is present. This will be done in a separate
change.

Note: Before commit 5aae19959a44 ("rootfs.py: Change logic to
unistall packages") rootfs.py did not install /etc/$pm-postinsts
when package management is installed! The change caused YOCTO #8235
which lead to the behavior change of run-postinsts in first place.

(From OE-Core rev: 85e498a4671426999610d90c87c354d41cfe8443)

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-24 16:49:54 +00:00
Filip Jareš
7aae52eae2 ref-manual: Fixed SRC_URI cut-and-paste error.
The update fixes a copy-paste-and-forget-to-update-everything error
in the documentation of the `SRC_URI` entry in the Reference Manual.
The `maxdate` paragraph just repeated what is there for the
neighboring `mindate` paragraph which was incorrect.

(From yocto-docs rev: 26c5549580e108c40aa7c95860d12c675596820c)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-19 23:54:08 +00:00
Richard Purdie
b28f5672ab bitbake: COW: Fix StopIteration warning
Fix the warning:

WARNING: lib/bb/data_smart.py:235: DeprecationWarning: generator 'COWDictMeta.iter' raised StopIteration
  for k, v in self.variables.iteritems():

by using return from the generator, not raising StopIteration.

(Bitbake rev: c0af6c81f8d5487ea2cef54a78fd1cb1d0dc6520)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 407d6e07b09123c12c382b4a92107f002c314b05)
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-03-13 14:38:56 -07:00
Paul Eggleton
d3ad243822 bitbake: utils: add optional callback to edit_bblayers_conf()
Add a callback that lets you modify or remove items in addition to the
current scheme where you can only add or remove. This enables you to for
example replace a layer with a temporary copy (which is what we will use
this for first in OE's oe-selftest).

(Bitbake rev: 4f6ba26e8335f975038d90b9e1c1767160bd5272)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
9f8d417c32 bitbake: process: Rewrite multiple connection handling
If the bitbake server recieved multiple connections, it currently closes
ones it can't handle (while its dealing with another). This is rather
antisocial behaviour which causes clients to quickly run through their
retries and abort.

Instead, queue any other connections until the current one is closed. This
way the client can decide when it wants to stop waiting for the server. If the
client is gone by the time we handle it, we handle that gracefully.

This also fixes a number of bugs in the connection handling where connections
which did drop early were badly handled causing tracebacks in the logs.

Also, handle queue incomming connections in a loop to ensure that the main
client handling doesn't starve that piece of the system.

This code was stress tested by running 50 connection attempts in parallel at
once, ensuring the code correctly handled them.

(Bitbake rev: f675293d86504db66442532258d99b26333742bf)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
d1baf887cd bitbake: process: Handle EWOULDBLOCK in socket connect
Now that we set a timeout for the socket, it can return EWOULDBLOCK
if a signal or other event happens to wake up even if we don't timeout.

If this happens, retry the connection, else we simply see it quickly
loop through the retries and abort the connection in a very short
interval.

(Bitbake rev: f770d6a332812031682dc6bef1a2a84da52a4c32)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
83dbc768d3 bitbake: process.py: Set socket timeout to 10 seconds
The current value of 2 seconds has shown to be short in
wider testing.

(Bitbake rev: c4a940991f261959eb08273d2250d3866b868938)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
d3b7f2ead5 bitbake: server/process: Ensure socket has a timeout set
We're seeing hangs in oe-selftest where server startup and shutdown are
racing. The assumption was a connect would timeout however no timeout is
set which can leave processes hanging. Set a short timeout for
the connection to avoid this.

(Bitbake rev: e53c1009356cc49c57d3b9af1e3dda6927acd78d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
3690c081c1 bitbake: cooker: Add some timing debug messages to the server startup
We're seeing slow startup in bitbake, add some timeing debug messages so
the logs are more useful for debugging when its slow.

(Bitbake rev: 39548791c84982c44c872a579e5b42d2720af98f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
245e1c251a bitbake: server/process: Increase server startup time delay
On loaded production systems we've seen bitbake server take over
40s to start up. Increase the timeout to 90s which tries to avoid
failures in selftests.

The delays come from setting up the inotify watches (31s) so can't
really be avoided.

After 5s delay we now warn the user we're waiting for 90s so the
interactive exeperience shouldn't be much changed and its very
unlikely the user would see that anyway.

(Bitbake rev: 64055fdb0d8485b40ba710a762e9a0af5c4540b4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Peter Kjellerstedt
caad85d90b bitbake: bitbake-diffsigs: Support recursive deps with signature files
Follow dependent hash changes recursively also when specifying two
signature files explicitly. Previously this was only done when using the
--task option.

(Bitbake rev: 65c2a64d6dd5dc85cb14b9e808964c699e890517)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Peter Kjellerstedt
6b6567cb6b bitbake: bitbake-diffsigs: Merge with bitbake-dumpsig
The functionalities of bitbake-diffsigs and bitbake-dumpsig are so
similar that they can be merged into one. Add an option --dump to make
bitbake-diffsigs dump the last signature data instead of comparing it.
Keep bitbake-dumpsig as a symbolic link to bitbake-diffsigs. When it is
called as bitbake-dumpsig, it behaves as if --dump was specified.

Also make -D the short option for --debug again (the way it used to be,
and still was for bitbake-dumpsig), so that -d can be used as the short
option for --dump.

(Bitbake rev: de298ff0b0cfeb29b569f946ab95329be102caa8)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
27d5f46f45 bitbake: server/process: Show last 60 lines of the log if the server didn't start
We're seeing issues where the server doesn't start with no logs as to why. Allow
the server to print the last 60 log lines just in case this shows us something useful
about what is failing.

(Bitbake rev: da54a3fef9cee308dfa87eea9b9638796d734abd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
ba9f093318 bitbake: server/process: Show the last 60 log lines, not the last 10
10 log lines may not capture any full traceback, increase the number of
lines to 60 which covers most tracebacks.

(Bitbake rev: 340a7d91b5030e4d62680f427286fc419509879b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Robert Yang
633d22650c bitbake: server/process: print a message when no logfile
[YOCTO #12898]

There might be no bitbake-cookerdaemon.log, print a message for debugging.

(Bitbake rev: cc32e703a8e68107353702edb230296503f5dad0)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
feee885613 bitbake: server/process: Make lockfile handling clearer
This simplifies the code and makes it easier to read but has the
same functionality.

(Bitbake rev: 21dcec291d58ab7ac5d2c07186c68e01d85e6f65)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Ross Burton
6ddeba54a4 bitbake: layerindex: don't use shell=True when cloning
(Bitbake rev: fd1504a5e92390b8e1c0e689b4c2cb0ac7096b1a)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Ross Burton
4e75f5cc6b bitbake: fetch: don't use shell=True when listing ar files
(Bitbake rev: d150e50355444b0a67cad4d6a100d9bf6fadb2ae)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
d3dcc4f92e package_rpm/archiver: Apply bandaid to src.rpm creation
| error: create archive failed on file /media/build1/poky/build/tmp/work/all-poky-linux/xcursor-transparent-theme/0.1.1+gitAUTOINC+23c8af5ba4-r0/deploy-sources/allarch-poky-linux/xcursor-transparent-theme-0.1.1+gitAUTOINC+23c8af5ba4-r0/xcursor-transparent-theme-0.1.1+git0+23c8af5ba4-r0.src.rpm: cpio: read failed - No such file or directory
| Building target platforms: noarch-poky-linux
| Building for target noarch-poky-linux

This is caused by:

$ cat log.task_order

do_cleansstate (24289): log.do_cleansstate.24289
do_deploy_archives_setscene (24395): log.do_deploy_archives_setscene.24395
do_fetch (24407): log.do_fetch.24407
[..]
do_package_write_rpm (25448): log.do_package_write_rpm.25448
do_package_qa (25451): log.do_package_qa.25451

So do_deploy_archives can run from sstate, created a .src.rpm in WORKDIR/deploy-sources,
then it was removed when rpm was running. This leads to a broken Source line in the
spec file as the original file was found by the os.listdir().

This fix is just a bandaid over much more fundamental problems sadly.

(From OE-Core rev: a10020ace4c3cd863c782760f7cbecea557ec6e7)

(From OE-Core rev: 6d56e912fbbaa22830b4da5ab230586a3d15b23e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
31a84b4316 archiver/package_rpm: Fix the worst src.rpm generation race
The package_rpm code is writing outside the task's sstate directory into
the sstate of do_deploy_archives. This is "out of spec" since if the
task is installed from sstate, the files are not restored. This means
the files may appear/disappear, things are not deterministic and there are
races.

Extend the do_package_write_rpm code to handle writing the src.rpm into
place to avoid these issues. There are other problems but this avoids races
around this file.

(From OE-Core rev: c6e151ba7fe0f14044537cf0ab2cac436f1496e3)

(From OE-Core rev: b119872fb794a36b6eb9ef5e9c42a9c6c991e835)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
6ab2cac421 libtool-cross: Handle ccache sstate 'infection' issues
On a system without ccache, f you:

INHERIT += "ccache"
bitbake libtool-cross
<remove INHERIT>
bitbake apmd

then it fails due to being unable to find ccache. The references to ccache are
coded into libtool-cross but the sstate checksum doesn't reflect this due to the
way the class is coded (output should be the same regardless).

The simplest solution is to remove references to ccache from the libtool script.
The output then works regardless of whether ccache is present or not. The
libtool-cross script is only used in a handful of cases (most of the time its
dynamically generated by autoconf) so any performance issue is minor.

(From OE-Core rev: ed550a49d2114c56e5bc033ecd0e83073d2d4067)

(From OE-Core rev: ee6a2e0ccb11e5f5267bc2e406203c78b0443415)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
ddd9042420 libtool: Fix patch status tag
(From OE-Core rev: 28fc470e5e10ee9cce893d037ed5e518bc5612f5)

(From OE-Core rev: c7c4920fc287bdb5f7a0bca7b2ec2ab7a43f58fd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
656897e761 libtool: Fix problem with libtoolize in multilib installations
Without this patch /usr/bin/libtoolize is different for each multilib
since their host-triplets are different, despite there being no difference in
the functionality of libtoolize itself.

This change just patches out the problematic line since its just a comment for the user
in help text. Ugly but solves the problem. This fixes issues where libtool and
libXX-libtool couldn't be installed into the same system.

(From OE-Core rev: f70040fd3ca3508d33ed24c749c0b8095b020dab)

(From OE-Core rev: 8480fff287e660f85a99fcc28119fe80d517e0b2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
6bbdd7b569 multilib_script: Add support for multilib scripts
Whilst the package managers handle multilib ELF binaries well, they don't
handle scripts in the *bindir directories well. This adds support for
marking these up so that they can be handled using update-alternatives.

Its done this way so that non-multilib systems don't see any changes and
there is standardisation amongst the multilibs on how the alternatives are
named and prioritiesd. The priotitisation code needs to be added but this
change means there is somewhere to add it.

Recipe needs to set MULTILIB_SCRIPTS in the form <pkgname>:<scriptname>, e.g.
MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/file1 ${PN}:${base_bindir}/file2"
to indicate which script files to process from which packages.

libtool is used a as a reference to stop the libtool scripts conflicting
in a multilib case and allows the kernel-devsrc change to be merged.

(From OE-Core rev: 18e837433d07cfdce4019c13f682c6676425a2ad)

(From OE-Core rev: 97e2d65d1c406bc58fe693e500fcc939459bac1a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Ross Burton
5d249ac250 image_types: use cpio-native to build cpio images
As per the previous commit, upstream cpio has a bug which means it crashes on
append. If the image being built has already had testimage ran then cpio-native
will be in the sysroot.  It's also possible that some distributions are shipping
this broken CVE patch too.

Now that our cpio-native is fixed, until we can be sure that the host cpio isn't
broken depend on cpio-native if building a cpio image.

[ YOCTO #13042 ]

(From OE-Core rev: c3b9aedcbe538d7fa74bd814644b4899769dec46)

(From OE-Core rev: a75eba71145efa1c3d206c5e5c00608a50f013bc)

(From OE-Core rev: 9e1c69932add702b9c5bc1faa9ef5db975de0ee3)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Ross Burton
ac03a57bf3 cpio: fix crash when appending to archives
The upstream fix for CVE-2016-2037 introduced a read from uninitialized memory
bug when appending to an existing archive, which is an operation we perform when
building an image.

(From OE-Core rev: 046e3e1fca925febf47b3fdd5d4e9ee2e1fad868)

(From OE-Core rev: 2ff6ab2e2944c6a53523b4b1611e1d22f6393500)

(From OE-Core rev: c0a3874799224c9ae0d6d7dc4d0a0acf364ccdab)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Peter Kjellerstedt
c4681cc02e oe-selftest: devtool: Support meta being a symbolic link
oe-selftest's devtool tests have been broken since commit 2457cd57
(oe-selftest: devtool: avoid parallel races by using temporary copy of
core) if meta is a symbolic link.

(From OE-Core rev: daba6c5a991b370709d17e51305334f55a3858ec)

(From OE-Core rev: 3eb59559ecd2e93fb590a330b47de1db0750fc0b)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Paul Eggleton
e5eadb501b oe-selftest: devtool: avoid parallel races by using temporary copy of core
Some of the devtool tests make changes to files under meta/ -
legitimately since we want these tests to be working with real recipes
and associated files. Unfortunately with the new oe-selftest
parallelisation this can break other tests if files go missing at the
wrong time (among other scenarios). To avoid this issue, simply take a
copy of the core repository and use that for these tests. (We copy the
entire repository since changing the path of meta/ influences COREBASE
and thus we need to have things like scripts/ alongside as well).

(From OE-Core rev: 2457cd57b4195924ef127f497efa2f34f411e660)

(From OE-Core rev: 9cb8353a4f0137823d6ed3e467db9dd7ead7b3de)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Jeremy Puhlman
5e376572d4 Only add uninative and checksum if inherited uninative class
The checksum value is only calculated if the uninative class is
inherited, so check for inherit before adding it to local.conf

(From OE-Core rev: 3b5b832589d943700b273e3a4d83561be0c47f36)

(From OE-Core rev: 8e23a3d59421f34961f39a7db512e93eb9647ec6)

Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
9947f6ad5b oeqa/utils/httpserver: Rework to avoid hangs and improve logging
testimage.bbclass installs a SIGTERM handler which conflicts with the
use of multiprocessing here. This is paritcularly problematic if the http
service is terminated before its started and hence before its had a chance
to reset the default signal handler (as the code was written).

Instead, temporarily remove testimage's handler whilst forking the http process
which means the correct handler is installed and won't deadlock.

Also take the opportunity to add in some log messages about the server start
and shutdown so that future debugging is easier and its clearer what the code
is doing.

(From OE-Core rev: cc0471439aa0085ca87deccf061c5b676ef12388)

(From OE-Core rev: 4eac9a5337d93b6cbd3916af97f62bb04881c9cd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Yeoh Ee Peng
4ca53b38ce oeqa/runtime/dnf: Make sure test_dnf_install does not skipped
During debugging dnf issue, we found that the test_dnf_install
PASSED the testing even though the environment does not allow
dnf install to run successfully. Further debugging had identified
that current test_dnf_install will execute dnf install even when
the package to be installed already exist, thus dnf install
will just skipped and this test will PASSED even though it was
not.

To solve this, added additional logic to check if the package
to be installed already exist, if yes then remove the package
before actually run dnf install. This will make sure dnf install
was tested as expected.

(From OE-Core rev: 4f662b253f7313c4e02bfafb527cdac076b6309a)

(From OE-Core rev: a80498e62898110e2ed6b01cbb9f5dd85995d13b)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Armin Kuster
f663c39ce2 perl: add testdepends for ssh
fixes:

 DEBUG: [Running]$ ssh -l root -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR 192.168.7.4 export PATH=/usr/sbin:/sbin:/usr/bin:/bin; perl -e '$_="Uryyb, jbeyq"; tr/a-zA-Z/n-za-mN-ZA-M/;print'
| DEBUG: time: 1548816904.4024463, endtime: 1548817204.397057
| DEBUG: Partial data from SSH call: ssh: connect to host 192.168.7.4 port 22: Connection refused

for master/thud/sumo

(From OE-Core rev: 76c66e061cdcdcbad73ed503668115120feb0ea3)

Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Ross Burton
5a8fcc4d0c oeqa: rationalise Perl tests
As with the Python test, this can be both better and faster.  No need to copy a
file, just run a one-liner.

(From OE-Core rev: c6eef46747fe58bb2310be4f06d2fa9b67901d72)

(From OE-Core rev: 9188ef8d1edbba8041a73d3bb8a9bfd194db0e92)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:46 +00:00
Richard Purdie
4b21bf658f oeqa/utils/buildproject: Only clean files if we've done something
We should only be wiping out things on target if the tests have
actually run.

(From OE-Core rev: d38c3eac0a5a1a9b0eb98385832e92f48145655e)

(From OE-Core rev: dab22dc58eabaeb421afa3c7de1cc08c5ec34c61)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Robert Yang
0bda550627 oeqa/selftest/runqemu: Enable kvm when QEMU_USE_KVM is set
(From OE-Core rev: 564de3681353fe8e203425388e8be9703a89d2da)

(From OE-Core rev: 1207949c986cc9f6b3940a99e87bc4d8cfb86d5b)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Yeoh Ee Peng
3c7d4f0526 oeqa/qemu & runtime: qemu do not need ip input from external
Qemu do not use the ip input from external. It will
retrieve ip from QemuRunner instance and assign
ip value.

(From OE-Core rev: 14d99dc6c39c963ba3e0d9a30274846bd5369210)

(From OE-Core rev: e4990ae01c9f3f486b4b745a2602795e9d496109)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Richard Purdie
e1b97539c8 oeqa/runtime/cases: Improve dependencies of kernel/gcc/build tests
Mark up these tests as needing a compiler, make and kernel source code
as appropriate, the image feature requirements can then be retired.

(From OE-Core rev: 9f64e6c25abdf494fb511e9cd401f8dcaa08be2a)

(From OE-Core rev: 544c56b6950f0598d5eaf62d9ae9d9de5fcb7eaf)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Richard Purdie
d853fa2680 oeqa/runtime/cases: Improve test dependency information
Add the OEHasPackage decorator to a variety of tests so they determine
automatically if they should run against a given image.

To ensure tests can do this we need to move target operations such
as scp commands into the tests and out of the class startup/teardown.

(From OE-Core rev: 60d6580b85714b8960a964e775d76a7f937f5e5a)

(From OE-Core rev: 03b7658369bb7c1c8fbbaac7d9e281617cc16135)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Ross Burton
e9055b90c0 oeqa/runtime/python: clean up Python test
Currently this is three test cases:

1) test_python_exists.  Fail if python3 isn't in PATH.
2) test_python_stdout.  Run a Python script and check the output is as expected
3) test_python_testfile.  Check that a file test_python_stdout wrote to exists.

(1) should be a setup and skip the test module if it isn't present.
(2) and (3) should be merged, there's no point copying over a two line Python
file, and the test doesn't verify that the file doesn't exist in the first
place.

Rewrite the test to check that Python is present in a class setup so the entire
test is skipped if it isn't and do some simple rot13 to verify that bytecode is
being executed correctly.

(From OE-Core rev: a35be5f32b4fe70b18ac1e2eccfd94558cecfbba)

(From OE-Core rev: babdd2f6addb06c23e4882107be07034ca49bcb8)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Alexander Kanavin
128b07d200 oeqa/runtime/cases/python: use python 3 rather than python 2
For example, core-image-sato skipped the test alltogether, as it
no longer pulls in Python 2.x at all.

(From OE-Core rev: 5ad0fe9ac6b6362011a17afaa7bee8e788093915)

(From OE-Core rev: bde50fc78ae75fd585f8914e458d65c328857fb2)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Robert Yang
5f63f1718e runqemu-gen-tapdevs: Allow run --help without sudo
Then we can get user's UID and GID rather than hardcode to 1000, e.g.:

- Without sudo
$ runqemu-gen-tapdevs --help
[snip]
$ sudo ../poky/scripts/runqemu-gen-tapdevs 15220 100 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin
[snip]

- With sudo
$ sudo ../poky/scripts/runqemu-gen-tapdevs --help
[snip]
$ sudo ../poky/scripts/runqemu-gen-tapdevs 15220 100 4 tmp/sysroots-components/x86_64/qemu-helper-native/usr/bin
[snip]

(From OE-Core rev: 446e7da7e56f9de3602498b5ef40e9e0f8f71837)

(From OE-Core rev: e5bebaddab47b418013f3d329dbb105ce69118bf)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Ross Burton
d28969259f runqemu: clean up subprocess usage
Where possible pass lists instead of strings, don't use a subshell, and call
check*() instead of using Popen directly.

(From OE-Core rev: d2374623444752af1ad748ed36b68ea58f629bf6)

(From OE-Core rev: a2cbc5954d44b0922136fc3d75f891064a948298)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Chen Qi
0676240f4c oeqa/runtime/cases/rpm.py: change to use base-passwd-doc
The test cases assume that rpm-doc is built out, as it says it its
comment. This is not always true. And it sometimes results in
following error.

  |     cls.tc.target.copyTo(test_file, dst)
  | UnboundLocalError: local variable 'test_file' referenced before assignment

Change to use base-passwd-doc, as this package is more likely to be
built out than rpm-doc.

(From OE-Core rev: 2e23543b48921182307065c1fa9e8b9d7fbb3cdc)

(From OE-Core rev: 1ce378ce07d2c49f40054893a623456c8471e177)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Alexander Kanavin
c172c8fdc6 oeqa: replace Alex Kanavin's @intel email address with a personal one
As I will be leaving Intel, this address will no longer be valid,
so swap it for my personal one for now.

(From OE-Core rev: ea58ff101e28dfda3410de66d775df3d8a1e5a96)

(From OE-Core rev: 61bca5a7f6b3fc03cd88cbf8867708d28e0a3522)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Robert Yang
e8b9772ab8 oeqa: make it work for multiple users
There are failures when multiple users run oe-selftest on the same
host:

PermissionError: [Errno 13] Permission denied: '/tmp/oe-saved-
tests/201812250324_qemu'

This is because /tmp/oe-saved-tests was created by user A, while user B tries
to write data in it, then the error will happen. This patch can fix the
problem.

Move the dumped data to ${LOG_DIR}/runtime-hostdump/ rather than
/tmp/oe-saved-tests/ to fix the problem.

(From OE-Core rev: e219fe5329599cd6c3682f521eaee3852a2c8980)

(From OE-Core rev: 872c6e5101f4f27dcfc63d141d1b6568f46d2b5f)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Aníbal Limón
75bcf06098 meta/classes/testimage.bbclass: Only validate IMAGE_FSTYPES when is QEMU
When use simpleremote target the flash/boot process is executed
manually, the IMAGE_FSTYPES validation is only needed when execute
testimage against qemu.

The supported_fstypes comes from oeqa.core.target.qemu module.

(From OE-Core rev: e7dc5963adbacc091fe8943119262166977623ad)

(From OE-Core rev: 05896e2f83ffef5262ccd3a0fa20b81b2a878957)

Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Kai Kang
33504386a3 testimage.bbclass: remove boot parameter systemd.log_target
Boot parameter systemd.log_target=console affects command journalctl's
output and causes oe selftest case test_systemd_boot_time fail to pass.

| Error at obtaining the boot time from journalctl
| RESULTS:
| RESULTS - systemd.SystemdJournalTests.test_systemd_boot_time - Testcase -1: SKIPPED (0.74s)

systemd.log_target=console was introduced by oe-core commit a0bb649 and
work with parameter systemd.log_level to enable systemd debug.
systemd.log_level has been removed already, so remove systemd.log_target
too to make case test_systemd_boot_time pass.

(From OE-Core rev: caa776bdcf8ea34c857f45970370bf771075f4bc)

(From OE-Core rev: 9d8a97b43c42b87c56d3b2ac318cb5482e86c397)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Erik Botö
07b748ba62 testimage: Add possibility to pass parmeters to qemu
Add a variable called TEST_QEMUPARAMS in testimage.bbclass to make it
possible to pass parameters to qemu. This can be useful for e.g.
increasing the amount of RAM available during testimage runs.

(From OE-Core rev: 1a9163f5779d233c884c8fd50e0812eabab4fdf3)

(From OE-Core rev: 643457d350a921379600248f99d73374e6a2f5a2)

Signed-off-by: Erik Botö <erik.boto@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Yeoh Ee Peng
2e1b7400b2 testimage: Add support for slirp
Enable testimage to support qemu slirp. Configure "QEMU_USE_SLIRP"
& "TEST_SERVER_IP" variables to enable slirp.

[YOCTO#10713]

(From OE-Core rev: 3df9ee85ce7fe52f0893fd33aea3bf1fcc6ead0a)

(From OE-Core rev: 8bf8cbb82472a0547b62f94fafa5790cf67ff9cb)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Richard Purdie
3850b6021a testimage: Enable autorunning of the package manager testsuites
Now that the hangs in httpservice are fixed we can let these tests
auto skip as appropriate.

(From OE-Core rev: 42a0d70291d551578e21f590fcb85ca72a78ccb5)

(From OE-Core rev: d82f2a0a17ecad5fdb2d2450f5048d00cf0448b1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Richard Purdie
689ca19f41 testimage: Further cleanup DEFAULT_TEST_SUITES
Now the test markup of the development tools tests is complete, this
can be further tweaked to auto run the correct tests.

(From OE-Core rev: bd4f8d12fe1f9f2643ee9e68fa2bb981134294fb)

(From OE-Core rev: 4b9641505f39718fe820eb199ed6554662d4d4cf)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Richard Purdie
4cf3a9724a testimage: Simplfy DEFAULT_TEST_SUITES logic
Now that the tests have correct markup to automatically determine which images
they can run against, clean up the default test suites logic to be simpler
and not image specific.

Some cleanup of the compiler tests still needs to be completed but this
is a good first step.

The only downside to this is more noise during testing as we now see
many skipped messages for simple images like core-image-minimal.

The auto type is being removed since it currently breaks badly due to the
socat mandatory inclusion from the meta-selftest layer which is a problem
which needs to be addressed seperately.

(From OE-Core rev: 4966bc33845752eb0aeae54b72e8ba0146a7ed52)

(From OE-Core rev: eeee75d0a51ab7c15457b89233b7bb5254d7ee0b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
[Fix for sumo context]
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Jose Perez Carranza
79d42d2b2f runtime/dnf: Add new dnf test cases
Add test cases to test “exclude” and “installroot“ options, also modify
the logic of filtering packages on the feed to have all the packages
needed by the tests.

[YOCTO #10744]

(From OE-Core rev: 1121806603c6f621d084b692216f3f616a0768dc)

(From OE-Core rev: e1b050f53ece2a31cd6866d2d737d7c67a44cea4)

Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Federico Sauter
4fee712eda kernel: don't assign the build user/host
The KBUILD_BUILD_USER and KBUILD_BUILD_HOST variables were
assigned at the kernel class level, which made it impossible
to override them in the local configuration.

By setting only the default values of those variables in the
kernel class, it is now possible to override them as expected.

(From OE-Core rev: a3e8cdf9c3ba966fa4b5a21235540eb0b00fb487)

(From OE-Core rev: 2fac83ff87d9ad934250f712d2d0fd91fccb8728)

Signed-off-by: Federico Sauter <federico.sauter@ableton.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Robert Yang
122d638e22 oeqa: Fix for QEMU_USE_KVM
Fixed:
MACHINE = "qemux86"
QEMU_USE_KVM = "qemux86"
IMAGE_CLASSES += "testimage"

$ oe-selftest -r runqemu.RunqemuTests.test_boot_rootfs

[snip]
  File "/buildarea1/lyang1/poky/meta/lib/oe/types.py", line 122, in boolean
    raise ValueError("Invalid boolean value '%s'" % value)
ValueError: Invalid boolean value 'qemux86'

Now QEMU_USE_KVM can only be boolean, can not contain MACHINE any more, kvm
will be enabled if target_arch == build_arch or both of them are x86 archs.

(From OE-Core rev: 7c1a8a624cad8d967635c6cb5f99cf655bde3d44)

(From OE-Core rev: de1b80f7f7b787f6b5b62c576ca6c62d2440031c)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Douglas Royds
71bcf6c051 patch: reproducibility: Fix host umask leakage
Some patch files create entirely new files, so their permissions are subject to
the host umask. If such a file is later installed into a package with no change
in permissions, it breaks the reproducibility of the package.

This was observed on libpam, for instance: The patch file
pam-security-abstract-securetty-handling.patch creates a new file
(tty_secure.c). This file is later copied into the -dbg package with no change
in permissions.

(From OE-Core rev: 2a2bbd755b330cd63f7f6e2f2b374a3ae065b37a)

(From OE-Core rev: ae10351f4aa443fc6df5a674b0aae0731304254d)

Signed-off-by: Douglas Royds <douglas.royds@taitradio.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Yeoh Ee Peng
a739dc6c21 scripts/oe-git-archive: fix non-existent key referencing error
Without installing gitpython package, oe-git-archive will face error
below, where it was referencing key that was non-existent inside
metadata object.

Traceback (most recent call last):
  File "<poky_dir>/scripts/oe-git-archive", line 271, in <module>
    sys.exit(main())
  File "<poky_dir>/scripts/oe-git-archive", line 229, in main
    'commit_count': metadata['layers']['meta']['commit_count'],
KeyError: 'commit_count'

Fix this error by adding exception catch when referencing
non-existent key (based on inputs provided by Richard Purdie).

[YOCTO# 13082]

(From OE-Core rev: 9a3cc9b8523b78dda6c3f3f2e12798b2b907d7e5)

(From OE-Core rev: 89dcc555f57ce13645c3876b42be3846fe3b7863)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Chen Qi
16c530c0cf package.bbclass: fix python unclosed file ResourceWarning
Fix the following warning.

  ResourceWarning: unclosed file <_io.TextIOWrapper name='/.../systemd/1_239-r0/debugsources.list' mode='a' encoding='UTF-8'>

(From OE-Core rev: 91810a57f0edd8b37c5f3f989a5aca69d9a40b37)

(From OE-Core rev: f8c111891066609ed40d11fee61ca9e29b5b6029)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
[Fixup for sumo context]
Signed-off-by: Armin Kuster <akuster808@gmail.com>

Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Richard Purdie
d668ce8421 package: Rework PACKAGELOCK based upon sstate for do_packagedata
I think this lock dates from before we had sstate for do_packagedata.

Since WORKDIR is recipe specific and we write into WORKDIR, we no longer need
any write locks in the do_packagedata code itself, its handled by the sstate
task lock for the final copy in at the end. The final write lock can be simply
removed.

The only time we need read locking is when actually reading data from the
shared directory. We can therefore reduce the window the lock is held
significantly as well, hence improving the speed of packagedata tasks running
in parallel.

(From OE-Core rev: f7106cdf2190d9ec59132a1cb2bb431d653cd9c5)

(From OE-Core rev: 1af1e9c23965637ab4a23b3eaf64192694c5448d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Emmanuel Roullit
185f6a7fd8 testimage.bbclass: fix qemu_use_kvm handling
QEMU_USE_KVM can either be a boolean or a whitespace separated list
of kvm supported machines.
For the 'intel-corei7-64' machine, defined in meta-intel, kvm could not be
used as the 'x86' substring is not part of its machine name.

By changing the order of this 'or' statement and setting
the 'QEMU_USE_KVM' variable to 'intel-corei7-64', it is possible to run the
'testimage' task with kvm support successfully.

(From OE-Core rev: a22789253aa653dc50fb159b40910248c2f98dd4)

(From OE-Core rev: 3383b1f9bb4aedfb88e888e88fe316e3f361c7bf)

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Richard Purdie
fa5ebe62e2 testimage/testsdk/selftest: Avoid platform.distro_identifier deprecation warnings
Use our own lsb function instead as used elsewhere by the codebase.

(From OE-Core rev: acac45a6fd604d28ef7c23d67482af3d7e8bcfe3)

(From OE-Core rev: 570256a64af5a3fa994a20a5cc4c74d59ffc361f)

(From OE-Core rev: d58fe9d352ae7de857e7f55b88f6e7d35b2cd706)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Robert Yang
7375570a24 oeqa/utils/qemurunner: set timeout to 60s for run_serial
The 5s timeout for non-kvm is too short, especially when the load is high,
which leads to unexpected errors, so set timeout to 60s by default.

(From OE-Core rev: 8197d0f638a760fc03062c7a9009117d083d7ead)

(From OE-Core rev: 6c930a8f5c11947c3b916efe23f33af462701bee)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Armin Kuster
928528ae96 tzdata/tzcode-native: update to 2018i
2018i:

  Briefly:
    São Tomé and Príncipe switches from +01 to +00 on 2019-01-01.

  Changes to future timestamps

    Due to a change in government, São Tomé and Príncipe switches back
    from +01 to +00 on 2019-01-01 at 02:00.  (Thanks to Vadim
    Nasardinov and Michael Deckers.)

2018h:
Briefly:
    Qyzylorda, Kazakhstan moved from +06 to +05 on 2018-12-21.
    New zone Asia/Qostanay because Qostanay, Kazakhstan didn't move.
    Metlakatla, Alaska observes PST this winter only.
    Guess Morocco will continue to adjust clocks around Ramadan.
    Add predictions for Iran from 2038 through 2090.

  Changes to future timestamps

    Guess that Morocco will continue to fall back just before and
    spring forward just after Ramadan, the practice since 2012.
    (Thanks to Maamar Abdelkader.)  This means Morocco will observe
    negative DST during Ramadan in main and vanguard formats, and in
    rearguard format it stays in the +00 timezone and observes
    ordinary DST in all months other than Ramadan.  As before, extend
    this guesswork to the year 2037.  As a consequence, Morocco is
    scheduled to observe three DST transitions in some Gregorian years
    (e.g., 2033) due to the mismatch between the Gregorian and Islamic
    calendars.

    The table of exact transitions for Iranian DST has been extended.
    It formerly cut off before the year 2038 in a nod to 32-bit time_t.
    It now cuts off before 2091 as there is doubt about how the Persian
    calendar will treat 2091.  This change predicts DST transitions in
    2038-9, 2042-3, and 2046-7 to occur one day later than previously
    predicted.  As before, post-cutoff transitions are approximated.

  Changes to past and future timestamps

    Qyzylorda (aka Kyzylorda) oblast in Kazakhstan moved from +06 to
    +05 on 2018-12-21.  This is a zone split as Qostanay (aka
    Kostanay) did not switch, so create a zone Asia/Qostanay.

    Metlakatla moved from Alaska to Pacific standard time on 2018-11-04.
    It did not change clocks that day and remains on -08 this winter.
    (Thanks to Ryan Stanley.)  It will revert to the usual Alaska
    rules next spring, so this change affects only timestamps
    from 2018-11-04 through 2019-03-10.

  Change to past timestamps

    Kwajalein's 1993-08-20 transition from -12 to +12 was at 24:00,
    not 00:00.  I transcribed the time incorrectly from Shanks.
    (Thanks to Phake Nick.)

    Nauru's 1979 transition was on 02-10 at 02:00, not 05-01 at 00:00.
    (Thanks to Phake Nick.)

    Guam observed DST irregularly from 1959 through 1977.
    (Thanks to Phake Nick.)

    Hong Kong observed DST in 1941 starting 06-15 (not 04-01), then on
    10-01 changed standard time to +08:30 (not +08).  Its transition
    back to +08 after WWII was on 1945-09-15, not the previous day.
    Its 1904-10-30 change took effect at 01:00 +08 (not 00:00 LMT).
    (Thanks to Phake Nick, Steve Allen, and Joseph Myers.)  Also,
    its 1952 fallback was on 11-02 (not 10-25).

    This release contains many changes to timestamps before 1946 due
    to Japanese possession or occupation of Pacific/Chuuk,
    Pacific/Guam, Pacific/Kosrae, Pacific/Kwajalein, Pacific/Majuro,
    Pacific/Nauru, Pacific/Palau, and Pacific/Pohnpei.
    (Thanks to Phake Nick.)

    Assume that the Spanish East Indies was like the Philippines and
    observed American time until the end of 1844.  This affects
    Pacific/Chuuk, Pacific/Kosrae, Pacific/Palau, and Pacific/Pohnpei.

  Changes to past tm_isdst flags

    For the recent Morocco change, the tm_isdst flag should be 1 from
    2018-10-27 00:00 to 2018-10-28 03:00.  (Thanks to Michael Deckers.)
    Give a URL to the official decree.  (Thanks to Matt Johnson.)

(From OE-Core rev: 100d0d0f24cabedd1a89b69ac8ffb05d85663761)

(From OE-Core rev: 40679b9ee29b600a514f2fb82865a0fecca70bf7)

Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Armin Kuster
72ee6a8f79 tzcode-native: update to 2018g
Changes to code

    When generating TZif files with leap seconds, zic no longer uses a
    format that trips up older 32-bit clients, fixing a bug introduced
    in 2018f.  (Reported by Daniel Fischer.)  Also, the zic workaround
    for QTBUG-53071 now also works for TZif files with leap seconds.

    The translator to rearguard format now rewrites the line
    "Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
    "Rule Japan 1948 1951 - Sep Sun>=9  1:00 0 S".
    This caters to zic before 2007 and to Oracle TZUpdater 2.2.0
    and earlier.  (Reported by Christos Zoulas.)

  Changes to past time zone abbreviations

    Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii.
    This reverts to 2011h, as the abbreviation change in 2011i was
    likely inadvertent.

  Changes to documentation

    tzfile.5 has new sections on interoperability issues.

(From OE-Core rev: a24d0c174411a32a2793c89980ca87c4f9d98bc4)

(From OE-Core rev: fc8a9e3929a6042bd3d68755799138f417413ab3)

Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Armin Kuster
4266c061a7 tzdata: update to 2018g
Changes to code

    When generating TZif files with leap seconds, zic no longer uses a
    format that trips up older 32-bit clients, fixing a bug introduced
    in 2018f.  (Reported by Daniel Fischer.)  Also, the zic workaround
    for QTBUG-53071 now also works for TZif files with leap seconds.

    The translator to rearguard format now rewrites the line
    "Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
    "Rule Japan 1948 1951 - Sep Sun>=9  1:00 0 S".
    This caters to zic before 2007 and to Oracle TZUpdater 2.2.0
    and earlier.  (Reported by Christos Zoulas.)

  Changes to past time zone abbreviations

    Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii.
    This reverts to 2011h, as the abbreviation change in 2011i was
    likely inadvertent.

  Changes to documentation

    tzfile.5 has new sections on interoperability issues.

(From OE-Core rev: 32e5dd919a61b1c245fb6a867d0ea4a71d394aca)

(From OE-Core rev: 94c5cc56031b8558cdb75d5d4df05f6715618ab3)

Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Robert Yang
13ab7c2229 oeqa/utils/qemurunner: Print output when failed to login
This is useful for debugging.

(From OE-Core rev: da527d73f5eeae0f29b5f99aab757491d3f87ec7)

(From OE-Core rev: 7fb953573635afb1b6482dbd9f51eb0f05731eae)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Richard Purdie
0e75b95e00 busybox: Put klogd/syslogd alternative links in syslog package
Currently these are in ${PN} and ${PN}-syslog may get replaced by
other packages but update-alternatives would error in the postinst
if other files were installed first. Avoid the problems by putting
the links in the correct package.

(From OE-Core rev: ef11c54ba99af261a70ec31091216cdd1556da24)

(From OE-Core rev: a0afcd457af14c3bf3a74514be0e8a029a4fcf63)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 22:27:45 +00:00
Scott Rifenbark
7c3899304b overview-manual, mega-manual: Updated Package Feeds diagram
The diagram had a typo in it ".ipd" rather than ".ipk".
Fixed and dropped in the figures folder for each manual.

(From yocto-docs rev: 7047930390d16d0a349ee552969b72de073a7627)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 10:44:02 +00:00
Daniel Ammann
c3d45fbece ref-manual: Typo found and fixed.
(From yocto-docs rev: d94b51fca608c34019b3349763a976c27cf6abdc)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 10:44:02 +00:00
Scott Rifenbark
070fbe7316 dev-manual: Updated clone and checkout examples.
Updated the list of returned branches.  That had gone a bit stale
for the exmaple.  Updated the tag checkout example to include the
yet-to-be created "yocto-2.5.3" tag.

(From yocto-docs rev: 7d8074e7543dac90d2d6f42bdfba16810ee8dab9)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 10:44:02 +00:00
Scott Rifenbark
1c26e2219d brief-yoctoprojectqs: Updated clone and checkout example.
Including the yet-to-be established "yocto-2.5.3" tag.

(From yocto-docs rev: f31fa64c75b8e4c287d94821cd94cf9e15d64639)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 10:44:02 +00:00
Scott Rifenbark
131233f58d documentation: Updates to support a 2.5.3 release:
poky-ent: Fixed the variables and set release to March 2019
<manual>.xml: Fixed manual revision tables

(From yocto-docs rev: 16f3ecf054baa4316ab8946681eda353f7c5ece8)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-25 10:43:59 +00:00
Scott Rifenbark
c9bd4984f8 bitbake: bitbake-user-manual: Fixed section head typo
Unseting -> Unsetting

(Bitbake rev: 0cfc389598939039496488038c18286d2d9fa735)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-12 21:44:22 +00:00
Scott Rifenbark
58e82c4510 brief-yoctoprojectqs, dev-manual: Updated poky clone examples.
The examples in these manuals for checkout of poky by tag need
to be updated immediately after a release.  The reason is that the
examples use recent tags.  I have updated both the examples
that show how to checkout poky based on a specific tag.  This
particular commit makes the YP 2.5.2 release examples correct.
Note, that I use &DISTRO; ENTITY variables to do this but timing
for when they are correct for a release needs to be monitored.

(From yocto-docs rev: 2a3980300465488ef36bf2fc0d034c968ce96e34)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-16 15:35:54 +00:00
Scott Rifenbark
9e28f5aeb0 poky.ent: Updated release date to "January 2019".
(From yocto-docs rev: 9613212edae2c29e3f1b7f5c4dad0fa5fd091fdc)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-16 15:35:54 +00:00
Scott Rifenbark
623b778850 Documentation: Updated dates for 2.5.2 release.
Updated the variable in poky.ent.

(From yocto-docs rev: ae0fb9ef999478e03cd93a9e8e18700e7707c6fd)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-27 22:53:19 +00:00
Richard Purdie
78020fb639 testsdk: Improvements to the json logging
Tweak the preceeding commit to:
* Add STARTTIME to the identifier to make it unique
* Add MACHINE to the identifier
* Use LOG_DIR
* Store the layer config in a more natural json format
* Drop '_' function prefixes

(From OE-Core rev: 31f0c5e59c7fb0ae0915de584fbfcf3d95bbb061)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
e331378e17 testimage: Improvements to the json logging
Tweak the preceeding commit to:

* Add STARTTIME to the identifier to make it unique
* Log DISTRO
* Use LOG_DIR
* Store the layer config in a more natural json format
* Drop '_' function prefixes

(From OE-Core rev: fd07da4d46a8167807f6ce872497fbdc812494ad)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
6512ffb090 oeqa/selftest/esdk: Fix typo causing test failure
2018-12-06 23:19:24,564 - oe-selftest - INFO - Traceback (most recent call last):
  File "/media/build1/poky-sumo/meta/lib/oeqa/core/case.py", line 32, in _oeSetUpClass
    clss.setUpClassMethod()
  File "/media/build1/poky-sumo/meta/lib/oeqa/selftest/cases/eSDK.py", line 78, in setUpClass
    cls.tmpdir_eSDKQA = cls.tempdirobj.name
AttributeError: type object 'oeSDKExtSelfTest' has no attribute 'tempdirobj'

(From OE-Core rev: 2c60908a2039d333a9fe2651622750ff6ed4cce1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Stefan Lendl
59bc88092e default-versions.inc: Make PREFERRED_VERSION_openssl* overwritable
defaultsetup.conf and therefore default-versions.inc is sourced pretty late in bitbake.conf.
default-versions.inc overwrites previous assignments of PREFERRED_VERSION_openssl.
Assigning it with ?= allows other .conf files to assign correctly.
in particular assignment in conf/local.conf and machine config is used instead of default.

(From OE-Core rev: c9786adf81434e2d58247f55cf80fdd3131121e7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
766a95ecb2 oeqa/selftest/esdk: Ensure parent directory exists
INFO - ======================================================================
INFO - ERROR: setUpClass (eSDK.oeSDKExtSelfTest)
INFO - ----------------------------------------------------------------------
INFO - Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/core/case.py", line 32, in _oeSetUpClass
    clss.setUpClassMethod()
  File "/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/lib/oeqa/selftest/cases/eSDK.py", line 76, in setUpClass
    cls.tmpdirobj = tempfile.TemporaryDirectory(prefix="selftest-esdk-", dir=bb_vars["WORKDIR"])
  File "/usr/lib/python3.5/tempfile.py", line 929, in __init__
    self.name = mkdtemp(suffix, prefix, dir)
  File "/usr/lib/python3.5/tempfile.py", line 507, in mkdtemp
    _os.mkdir(file, 0o700)
FileNotFoundError: [Errno 2] No such file or directory: '/home/pokybuild/yocto-worker/oe-selftest-debian/build/build/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/selftest-esdk-q7ln84gc'

(From OE-Core rev: 170a601a99836d13b69e5287bee0d3e71983dd46)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
5df29d420a image-buildinfo,oeqa/selftest/containerimage: Ensure image-buildinfo doesn't break tests
Having image-buildinfo enabled causes containerimage.ContainerImageTests.test_expected_files
to fail due to the presence of an unexpected file:
  ['./',
   './etc/',
-  './etc/build',
   './etc/default/',
   './etc/default/postinst',

Tweak the class to allow it to be disabled and disable it from the test just in
case it was enabled.

(From OE-Core rev: af67bf422a4df5b7e07894512ff73a5f493682ab)

(From OE-Core rev: f49ab8b1610c045acaed7b964d12f07f969df856)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
1f1367a59d oeqa/utils/metadata: Allow to function without the git module
The python git module may or may not be enabled, allow this code to
function without it, falling back to the same method as metadata_scm.bbclass
uses. This will be cleaned up in the next round of feature development.

(From OE-Core rev: 6350586ba9f4a4107a2d457590824cd4d662d5b9)

(From OE-Core rev: 32c9169b76e13e53b6a9ab4a59932cea7863d992)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Yeoh Ee Peng
152a347f8d oeqa/selftest: Standardize json logging output directory
Currently sdk & sdkext will output json file to LOG_DIR, while
selftest will output json file to TOPDIR/log.

Standardize selftest json output file to LOG_DIR.

(From OE-Core rev: 9f2e39684cbbe9f87eeef6a81961e6db783439e3)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
f50977c3b5 oeqa/selftest: Improvements to the json logging
Tweak the preceeding commit to:

* Add STARTTIME to the identifier to make it unique
* Use LOG_DIR
* Store the layer config in a more natural json format
* Drop '_' function prefixes

(From OE-Core rev: 173f59acf9722e2ef27fdd49c20f7d3d664917eb)

(From OE-Core rev: 3b69099edc7db99c11bfb41eab2af50bd0e3d4f2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Yeoh Ee Peng
8ea47d187d testsdk.bbclass: write testresult to json files
As part of the solution to replace Testopia to store testresult,
OEQA sdk and sdkext need to output testresult into json files, where
these json testresult files will be stored into git repository
by the future test-case-management tools.

By default, json testresult file will be written to "oeqa"
directory under the "WORKDIR" directory.

To configure multiple instances of bitbake to write json testresult
to a single testresult file at custom directory, user will define
the variable "OEQA_JSON_RESULT_DIR" with the custom directory for
json testresult.

(From OE-Core rev: eefb07907873d20f2e66d3784106f6f72030b5b2)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Yeoh Ee Peng
e92ebb4295 testimage.bbclass: write testresult to json files
As part of the solution to replace Testopia to store testresult,
OEQA testimage need to output testresult into json files, where
these json testresult files will be stored into git repository
by the future test-case-management tools.

By default, json testresult file will be written to "oeqa"
directory under the "WORKDIR" directory.

To configure multiple instances of bitbake to write json testresult
to a single testresult file at custom directory, user will define
the variable "OEQA_JSON_RESULT_DIR" with the custom directory for
json testresult.

(From OE-Core rev: 2b8b47ec8ee835d2e70cc4ff3ec484f9e4e4d02d)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Yeoh Ee Peng
5a99880992 oeqa/selftest/context: write testresult to json files
As part of the solution to replace Testopia to store testresult,
OEQA selftest need to output testresult into json files, where
these json testresult files will be stored into git repository
by the future test-case-management tools.

By default, json testresult file will be written to "oeqa"
directory under the oe-selftest log directory.

To configure multiple instances of bitbake to write json testresult
to a single testresult file at custom directory, user will define
the variable "OEQA_JSON_RESULT_DIR" with the custom directory for
json testresult.

(From OE-Core rev: a95218525a4c8228fff9908ffbda85c6b85e101c)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
3f2c5e0e24 oeqa/runner: Sort the test result output by result class
We want to see failures/errors listed last since this is the most easily
visible part of the log on consoles or autobuilder output and makes
human processing easier rather than having to scroll up and scan for
a single failure.

(From OE-Core rev: 2cc07ab253f1ba6a1f07a66051c9ba6d98cd2357)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
1123da4368 oeqa/runner: Always show a summary of success/fail/error/skip counts
Its useful to have the counts of success/failure/error/skipped at the end of the
results to allow for easier human reading of what happened.

(From OE-Core rev: 5942318a261ce7a885f351e214669068ff9d8931)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
ed5c12f11f oeqa/runtime/ptest: Inject results+logs into stored json results file
This allows the ptest results from ptest-runner, run in an image to be
transferred over to the resulting json results output.

Each test is given a pass/skip/fail so individual results can be monitored
and the raw log output from the ptest-runner is also dumped into the
results json file as this means after the fact debugging becomes much easier.

Currently the log output is not split up per test but that would make a good
future enhancement.

I attempted to implement this as python subTests however it failed as the
output was too confusing, subTests don't support any kind of log
output handling, subTest successes aren't logged and it was making things
far more complex than they needed to be.

We mark ptest-runner as "EXPECTEDFAILURE" since its unlikely every ptest
will pass currently and we don't want that to fail the whole image test run.
Its assumed there would be later analysis of the json output to determine
regressions. We do have to change the test runner code so that
'unexpectedsuccess' is not a failure.

Also, the test names are manipuated to remove spaces and brackets with
"_" used as a replacement and any duplicate occurrences truncated.

(From OE-Core rev: a13e088942e2a3c3521e98954a394e61a15234e8)

(From OE-Core rev: 526ceab9d0e43f73635bb92e8dd7763ef75ad33b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Yeoh Ee Peng
eee5b0d104 oeqa/core/runner: write testresult to json files
As part of the solution to replace Testopia to store testresult,
OEQA need to output testresult into single json file, where json
testresult file will be stored in git repository by the future
test-case-management tools.

The json testresult file will store more than one set of results,
where each set of results was uniquely identified by the result_id.
The result_id would be like "runtime-qemux86-core-image-sato", where
it was a runtime test with target machine equal to qemux86 and running
on core-image-sato image. The json testresult file will only store
the latest test content for a given result_id. The json testresult
file contains the configuration (eg. COMMIT, BRANCH, MACHINE, IMAGE),
result (eg. PASSED, FAILED, ERROR), test log, and result_id.

Based on the destination json testresult file directory provided,
it could have multiple instances of bitbake trying to write json
testresult to a single testresult file, using locking a lockfile
alongside the results file directory to prevent races.

Also the library class inside this patch will be reused by the future
test-case-management tools to write json testresult for manual test
case executed.

(From OE-Core rev: 00e03b5004f1eb6d59295544b3a8620504278f51)

(From OE-Core rev: 045511425577ccbe89d8eb91e2a87e385390cabf)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Yeoh Ee Peng
b3b337adb3 oeqa/core/runner: refactor for OEQA to write json testresult
Refactor the original _getDetailsNotPassed method to return
testresult details (test status and log), which will be reused
by future OEQA code to write json testresult.

Take the opportunity to consolidate and simplify the logic used
to gather test status and log within the TestResult instance.

(From OE-Core rev: 79ee7d1c371a86edeb61c99679985118da657e5d)

(From OE-Core rev: bc444181f9658423856621b2f2c60364642ae5b1)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
52fba04068 oeqa: Remove xmlrunner
This isn't present on modern distros by default and doesn't work with
testtools, needing multiple code paths in the code. Remove it in favour
of finding a better replacement for results collection/analysis.

(From OE-Core rev: 8001d933a8dc86004db014777f094d718086687d)

(From OE-Core rev: 02449e89d62a7714d30ab6e2e58c476dc9441f7a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
d8dc75de8b oeqa/runner: Simplify code
There doesn't appear to be any reason we need this _results indirection
any more so remove it.

(From OE-Core rev: b618261811c48ff3b98eab1b340a8cd09ef183c6)

(From OE-Core rev: ab271b49d9b55ea271d519c3a4da0b639a07f0bb)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
58678f5aa7 oeqa/core/threaded: Remove in favour of using concurrenttests
We have several options for parallel processing in oeqa, parallel
execution of modules, threading and mulitple processes for the runners.

After much experimentation is appears the most scalable and least
invasive approach is multiple processes using concurrenttestsuite
from testtools. This means we can drop the current threading code
which is only used by the sdk test execution.

oeqa/decorator/depends: Remove threading code

Revert "oeqa/sdk: Enable usage of OEQA thread mode"
This reverts commit adc434c063.

Revert "oeqa/core/tests: Add tests of OEQA Threaded mode"
This reverts commit a4eef558c9.

Revert "oeqa/core/decorator/oetimeout: Add support for OEQA threaded mode"
This reverts commit d3d4ba902d.

(From OE-Core rev: a98ab5e560e73b6988512fbae5cefe9e42ceed53)

(From OE-Core rev: bb9a85e157e669d7a91c3bbefc8d5138e7b8b6ae)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
783e1ae8fa oeqa/runner: Ensure we don't print misleading results output
The current code assumes if something isn't a failure of some
kind, it was a pass. When test case IDs weren't matching, this lead
to very confusing output where things would fail, then be listed as
passing.

This adds code to track successes, ensuring we don't end up in this
position again with unmatched entries being listed as UNKNOWN.

(From OE-Core rev: 4374c296d8963e4f6a1aa7bef7983ad0a1c2fcff)

(From OE-Core rev: bcb2948773d76befef2be787be6d25cf544e49a9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
521d02e6f5 oeqa/core/runner: Improve test case comparision
We can directly compare the test case IDs rather than representations,
then if we're using subunit to split the tests, the comparisions still
work as intended.

(From OE-Core rev: 72e5f46f75454ba4c445c65c1cbc616a9e72fc6e)

(From OE-Core rev: 4c53aac5315f9d0a0ed95cbeb48b7704e274e3a9)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
fa12ad627b oeqa/selftest/context: Improve log file handling
The existing logfile is simply placed in the current directory. Since the test
changes cwd to BUILDDIR, the symlink to the log can be placed in an invalid
directory. We also see trackbacks if the symlink is invalid.

Improve things by:

* Placing logs in LOG_DIR (or BUILDDIR if unset).
* Using a full path to the log meaning the log and link are placed in the same directory.
* Using lexists instead of exists so invalid symlinks are handled correctly.

(From OE-Core rev: 750ece11bed0e62a11e0003d1d16a81f7c219761)

(From OE-Core rev: 9c4c3c876dd5d224133571fcad1095af1098ae1d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
c7a841625d oeqa/utils/qemurunner.py: Fix python regex warnings
Fix the warnings:

meta/lib/oeqa/utils/qemurunner.py:250: DeprecationWarning: invalid escape sequence \.
  ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1])
meta/lib/oeqa/utils/qemurunner.py:343: DeprecationWarning: invalid escape sequence \-
  if re.search("root@[a-zA-Z0-9\-]+:~#", output):
poky/meta/lib/oeqa/utils/qemurunner.py:350: DeprecationWarning: invalid escape sequence \-
  if re.search("root@[a-zA-Z0-9\-]+:~#", output):
meta/lib/oeqa/utils/qemurunner.py:448: DeprecationWarning: invalid escape sequence \-
  if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):

by correctly marking the regexs.

(From OE-Core rev: 8e6987735002560fca714f77ea8ece9d4b28f7fa)

(From OE-Core rev: 7eb1f0be82d7ee12f893cdd40384da306fa597a7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
ea1539b872 oeqa/selftest/context: Replace deprecated imp module usage
Avoid the warning:

meta/lib/oeqa/selftest/context.py:8: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp

In this case importlib is a direct replacement.

(From OE-Core rev: db7a60c36a2d3eefc61ae6e1ede01680dc932035)

(From OE-Core rev: 351a7b75959593922909d7e1929a6429a2bf94a7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
76d7cf2415 oeqa/utils/commands: Avoid unclosed file warnings
Avoid warnings such as:

meta/lib/oeqa/utils/commands.py:213: ResourceWarning: unclosed file <_io.BufferedReader name=4>
  return runCmd(cmd, ignore_status, timeout, output_log=output_log, **options)

(From OE-Core rev: 6a68c42de08cffbadb59ebda63fa5e19f6e5acef)

(From OE-Core rev: 682d7b2810b235e86a28a8afe034e3853dbe8c45)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
eb0dd09cf5 oeqa/loader: Fix deprecation warning
Clean up the warning:
meta/lib/oeqa/core/loader.py:27: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec()
  _failed_test_args = inspect.getargspec(unittest.loader._make_failed_test).args

(From OE-Core rev: d2deb66830be2d44532fea3d5db763b57778252a)

(From OE-Core rev: f9ab10bb08446052fd6af2a21f38d8454e466d51)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Ross Burton
5f74f3c639 oeqa/selftest/esdk: run selftest inside workdir not /tmp
We've seen issues with rootfs size calculations and we've seen systems
like opensuse which have btrfs mounted on /tmp causing selftest failures.

(From OE-Core rev: 61be3cd748d1b7321a1fc4cfe84efa9b26a6aee0)

(From OE-Core rev: d936faabfb29ea377d74e77332a2a91603747ac7)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Ross Burton
899f4baef7 oeqa: don't litter /tmp with temporary directories
If we need to create a temporary directory in targetbuild or buildproject use
tempfile.TemporaryDirectory so that when the test case is finished, the
directory is deleted.

Also synchronise the logic and don't possibly store the temporary directory in
self.tmpdir as nothing uses that.

(From OE-Core rev: db0e658097130d146752785d0d45f46a3e0bad71)

(From OE-Core rev: d39252324a13580cc96f0694b88bc10515e030a0)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
2fae64eae4 oeqa/utils/qemurunner: Avoid tracebacks on closed files
Reorder the shutdown/teardown to avoid:

  File "/home/pokybuild/yocto-worker/oe-selftest-ubuntu/build/meta/lib/oeqa/utils/qemurunner.py", line 224, in launch
    op = self.getOutput(output)
  File "/home/pokybuild/yocto-worker/oe-selftest-ubuntu/build/meta/lib/oeqa/utils/qemurunner.py", line 90, in getOutput
    fl = fcntl.fcntl(o, fcntl.F_GETFL)
ValueError: I/O operation on closed file

(From OE-Core rev: 8e7d756862d2a8d62f3c87497d6d65ddb3c1b962)

(From OE-Core rev: 48979ffbe25351f92179021a973207a71bbe7a4e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
9bd0b59f73 oeqa/selftest/runqemu: Improve testcase failure handling
assertTrue doesn't give good debug information when things fail. Update
several to use assertIn which gives information upon failure, for the
others print the log information upon failure.

(From OE-Core rev: c29cb75d5ce6b0873a934f4709b0c8824f7164d3)

(From OE-Core rev: 6f2bb2c12289422396deb793ae4b4e99cfa88c7b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Ross Burton
765f90b383 oeqa/oelib/path: don't leak temporary directories
setUp() is used to populate a directory of temporary files, and deleted in
__del__.  However setUp() is called once *per test* so __del__ would only be
able to remove the last directory created.

Fix the code by using the natural counterpart to setUp, tearDown(), to clean up.

(From OE-Core rev: 68b4723e6fb11d171869185bccf28f32f6284c18)

(From OE-Core rev: edd2ecbc86d8b02a0467491451306f67e81d9ead)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
202097fe5b oeqa/selftest/buildoptions: Ensure diskmon tests run consistently
Heartbeat events default to once a second and we need to ensure we have
enough time in the task to see them.

Add a nostamp delay task 5s long so we can have a consistently timed
task which doesn't need cleanup or have unneeded dependencies. This
ensures we should deterministically see the disk moinitor events
regardless of the state of the build. This is done in a way which
doesn't corrupt build state or need cleanup and is efficient.

(From OE-Core rev: ecc49ee8986929e2429d948000a0ca588fe63959)

(From OE-Core rev: d5ce38168238181423c9dcd1d258253e3515d0a5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
26f65c2612 oeqa/selftest/buildoptions: Improve ccache test
This test occisionally fails as m4 doesn't recompile, meaning the logfile test
then doesn't find mention of ccache.

To ensure m4 does recompile, clean m4 before force compiling it.

(Reading the test is confusing due to the test cleanup also involving a clean)

(From OE-Core rev: 6e0b9214a0d57ed45a5df0ba5c9887a9045b89b1)

(From OE-Core rev: b729a46820cce38b3d500271df19bdaf31973140)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
9901fd4842 oeqa/qemurunner: Remove resource python warnings
If runqemu fails it would leak an unclosed socket and file. Ensure we
close these in all cases to remove the resource warning.

(From OE-Core rev: ed80e46ccbc8fe8e9148d80723152066fa00ba28)

(From OE-Core rev: baa8313e492cff8c31633a558792500b10493e9e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
89b637bb9d oeqa/utils/commands: Avoid log message duplication
Each time a runqemu() fails, the log handler would be left behind meaning
messages from any subsequent run would be duplicated (or worse/more).

This ensures we remove the handler regardless and means we no longer
have the duplication.

(From OE-Core rev: 532984708436bdfa3a8cac2c684a425eb249bad0)

(From OE-Core rev: 600e71ede1977c45fed1958dd5356911e4fcf272)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
3de93e3d4a oeqa/utils/qemurunner: Fix python ResourceWarning for unclosed file
Fixes:

Stderr:
/media/build1/poky/meta/lib/oeqa/utils/qemurunner.py:381: ResourceWarning: unclosed file <_io.BufferedWriter name=16>
  self.runqemu = None

(From OE-Core rev: b9e0bf919e6fc1a58e02145a363ebe7066e5bf4f)

(From OE-Core rev: b8a9eec2c9e56181350269acd6b42a14cc4abb3e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
3260af7ab4 oeqa/utils/commands: Add extra qemu failure logging
Rather than just referring the user to the logs containing the failure, print
them on the console. This aids debugging with oe-selftest with parallelisation
as the logs may otherwise be lost.

(From OE-Core rev: 36a018e245a232f520ff946f152cc875927a6fb4)

(From OE-Core rev: 0ea441ab6a6fe752cc8820fb371e67eee92353e4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
029c414cd5 oeqa/selftest/buildoptions: Improve ccache test failure output
The current failure mode doesn't show us what the logs actually looked like
and later cleans can lose them. Show the whole log in case of failure
to aid debugging intermittent problems on the autobuilder.

(From OE-Core rev: 7c3a0dc5978cea898b1ca51decf4d6e7cf9d519f)

(From OE-Core rev: 60b58e976dcc2a45a036e18cfcc87933a8859c9f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:27 +00:00
Richard Purdie
c2fdfb7981 oeqa/selftest/case: Use bb.utils.remove() instead of shutil.remove()
This avoids problems where shutil.remove will error with:

  File "/usr/lib/python3.5/shutil.py", line 436, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra'

when there are races over file deletion (gpg agent may be slow to exit).

We already worked around speed and race issues in bb.utils.

(From OE-Core rev: 00a8fd5b93a5c19ce0b7498e2bc653ce8ad58aaf)

(From OE-Core rev: e7c0d29e063d1a47004acdc07a63996be98c74ef)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:26 +00:00
Richard Purdie
de5ed54deb oeqa/selftest/signing: Use do_populate_lic target instead of do_package
This should speed the test up signficiantly without any loss of functionality
for the purposes of the test.

(From OE-Core rev: 3dde0b749643575878bfbca2f8d2d9ec30bad166)

(From OE-Core rev: 51989db2d9eebd9f190994109c2932dac3f3034b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:26 +00:00
Richard Purdie
d030fa6043 oeqa/selftest/signing: Allow tests not to need gpg on the host
We ideally don't want to use gpg from the host. This is straightforward for package
management but not for sstate.

For sstate, create a second build directory to run the test in using gnupg-native
from the original build directory.

(From OE-Core rev: 10afa94c3f0d7eb7524a26deda86949073d55fde)

(From OE-Core rev: c5d68a24b0c6df0a16f50075a690b3aab0e273ee)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:26 +00:00
Richard Purdie
ac34287384 oeqa/selftest/signing: Skip tests if gpg isn't found
Raising an assertionError in the class setup isn't a particuarly good way to
indicate gpg isn't installed. Instead skip the tests if the required binary
isn't present. For the signing tests we do require it to be present and can't
use a prebuilt one.

(From OE-Core rev: 2d486af97e51b9daa9c40482c31d637c9ab4ae79)

(From OE-Core rev: 65403bb556f7e3132722288a62ef36631af0b557)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:26 +00:00
Richard Purdie
30148ab874 scripts/runqemu: Improve lockfile handling for python with close_fd=True
On python versions with close_fds=True (python 3.2 onwards), the tap
device lockfile isn't passed to the child process.

Since this guards against use of an active interface, we really want this
here, so pass it in pass_fds. This means if the parent exits early, the child
still holds the lock, avoiding messages like:

runqemu - ERROR - Failed to run qemu: qemu-system-x86_64: could not configure /dev/net/tun (tap0): Device or resource busy

(From OE-Core rev: 17a0a067d597c445c5892ff9914e91a2187f7e09)

(From OE-Core rev: d3b3c55ddc312039380ce8e23e68dd8bb2439388)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:26 +00:00
Richard Purdie
d99e6afb8d scripts/runqemu: Tidy up lock handling code
Various tweaks:
- Balance up the aquire/release functions
- Use debug messge for both acquiring and release message for consistency in logs
- Use None instead of an empty string
- Reset the value of the field if we don't have the lock any more

(From OE-Core rev: d3c052e6ccd81d544b23a3bee80ba00cafaedbbd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:26 +00:00
Michael Halstead
f7b5f33ae1 scripts/runqemu: Replace subprocess.run() for compatibilty
subprocess.run() was introduced in Python 3.5. We currently support down to
Python 3.4 so I've replaced it with subprocess.check_call() which is available
in that version.

(From OE-Core rev: 1c61f3017a6a2d95747883c722c376763ec77c9d)

Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-16 14:31:26 +00:00
Scott Rifenbark
c5ee326ea9 documentation: Prepared for 2.5.2 document release
Updated poky.ent to use "TBD" for the release date variable.
Updated the mega-manual.sed file to use "2.5.2"
Updated all the <manual>.xml files to include a new entry for
  the 2.5.2 release date
Updated poky.ent to have all applicable 2.5.2 variables changed.

(From yocto-docs rev: 189ec469aa8797d75567cfef444b9896d3467e7a)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-15 11:49:10 +00:00
Yong, Jonathan
a4c7d28688 bitbake: bitbake-user-manual: Added "usehead" parameter.
(Bitbake rev: 17fb5216c9a5b5d4305bef6dcb267345040280c6)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-10 20:41:28 +00:00
Richard Purdie
fa962ec72f bitbake: main: Don't use print() directly, use logger
Avoid failures like:

2018-12-04 03:30:56,033 - oe-selftest - INFO - ======================================================================
2018-12-04 03:30:56,033 - oe-selftest - INFO - FAIL: pkgdata.OePkgdataUtilTests.test_find_path (subunit.RemotedTestCase)
2018-12-04 03:30:56,033 - oe-selftest - INFO - ----------------------------------------------------------------------
2018-12-04 03:30:56,033 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
[...]
AssertionError: 'Previous bitbake instance shutting down?,[77 chars]xist' != 'ERROR: Unable to find any package produci[14 chars]xist'
- Previous bitbake instance shutting down?, waiting to retry...
  ERROR: Unable to find any package producing path /not/exist

We need to use the logger so output is correctly handled in such cases.

(Bitbake rev: 34a2ef91e6172c9d63819f4d8005a382956d741a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-06 10:28:05 +00:00
Richard Purdie
a13af733dc bitbake: process: Flush key output to logs
Small tweak to ensure these items are printed into the log since there
is other logging code which looks for the header and this makes it clearer
the server did start but is slow somewhere in startup.

(Bitbake rev: e698ff1817e3536211f40af161c563d15e2ef3b5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-06 10:28:05 +00:00
Richard Purdie
61125e3e8f bitbake: runqueue: Ensure disk monitor is started when no setscene tasks are run
Currently if there are no setscene tasks, the disk monitor isn't started.

Move the startup code to somewhere to ensure it always is started. This
issue would partially explain occasional selftest failures.

(Bitbake rev: 9f72f5af7eb04c87be0e11a9c519a3941789bf7e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-06 10:28:04 +00:00
Richard Purdie
fdb46449d9 bitbake: server/process: Fix ConnectionRefusedError tracebacks
Improve connetion refused error handling:

NOTE: Retrying server connection...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection... (Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-opensuse/build/bitbake/lib/bb/server/process.py", line 471, in connectProcessServer
    sock.connect(os.path.basename(sockname))
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-opensuse/build/bitbake/lib/bb/main.py", line 464, in setup_bitbake
    server_connection = bb.server.process.connectProcessServer(sockname, featureset)
  File "/home/pokybuild/yocto-worker/oe-selftest-opensuse/build/bitbake/lib/bb/server/process.py", line 502, in connectProcessServer
    os.close(i)
TypeError: an integer is required (got type NoneType)
)
WARNING: /home/pokybuild/yocto-worker/oe-selftest-opensuse/build/bitbake/lib/bb/main.py:481: ResourceWarning: unclosed <socket.socket fd=14, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
  logger.info("Retrying server connection... (%s)" % traceback.format_exc())

(Bitbake rev: 0d0d8558d753ab3723325246c7d6c11e93cd18b8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-06 10:28:04 +00:00
Richard Purdie
caf1c2c1ef bitbake: lib/bb/server: Avoid UnboundLocalError traceback
Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/main.py", line 464, in setup_bitbake
    server_connection = bb.server.process.connectProcessServer(sockname, featureset)
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/server/process.py", line 490, in connectProcessServer
    if command_chan_recv:
UnboundLocalError: local variable 'command_chan_recv' referenced before assignment

(Bitbake rev: bdffac83bcbd12668d262867f3a6e329327ff1e4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-06 10:28:04 +00:00
Richard Purdie
005d59b13d bitbake: server/process: Fix unclosed socket warnings upon server connection refused
Extend the server error handling to avoid:

Reconnecting to bitbake server...
NOTE: Retrying server connection... (Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/main.py", line 464, in setup_bitbake
    server_connection = bb.server.process.connectProcessServer(sockname, featureset)
  File "/home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/server/process.py", line 457, in connectProcessServer
    sock.connect(os.path.basename(sockname))
ConnectionRefusedError: [Errno 111] Connection refused
)
WARNING: /home/pokybuild/yocto-worker/nightly-oe-selftest/build/bitbake/lib/bb/main.py:481: ResourceWarning: unclosed <socket.socket fd=20, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
  logger.info("Retrying server connection... (%s)" % traceback.format_exc())

NOTE: Starting bitbake server...

(Bitbake rev: 115919f0c11e22df783348422e06ab95f5c943e1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-12-06 10:28:04 +00:00
150 changed files with 7162 additions and 1436 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# bitbake-diffsigs
# BitBake task signature data comparison utility
# bitbake-diffsigs / bitbake-dumpsig
# BitBake task signature data dump and comparison utility
#
# Copyright (C) 2012-2013, 2017 Intel Corporation
#
@@ -21,7 +21,6 @@
import os
import sys
import warnings
import fnmatch
import argparse
import logging
import pickle
@@ -32,7 +31,10 @@ import bb.tinfoil
import bb.siggen
import bb.msg
logger = bb.msg.logger_create('bitbake-diffsigs')
myname = os.path.basename(sys.argv[0])
logger = bb.msg.logger_create(myname)
is_dump = myname == 'bitbake-dumpsig'
def find_siginfo(tinfoil, pn, taskname, sigs=None):
result = None
@@ -59,8 +61,8 @@ def find_siginfo(tinfoil, pn, taskname, sigs=None):
sys.exit(2)
return result
def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None, color=False):
""" Find the most recent signature files for the specified PN/task and compare them """
def find_siginfo_task(bbhandler, pn, taskname, sig1=None, sig2=None):
""" Find the most recent signature files for the specified PN/task """
if not taskname.startswith('do_'):
taskname = 'do_%s' % taskname
@@ -79,73 +81,81 @@ def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None, color=False
latestfiles = [sigfiles[sig1], sigfiles[sig2]]
else:
filedates = find_siginfo(bbhandler, pn, taskname)
latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-3:]
latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:]
if not latestfiles:
logger.error('No sigdata files found matching %s %s' % (pn, taskname))
sys.exit(1)
elif len(latestfiles) < 2:
logger.error('Only one matching sigdata file found for the specified task (%s %s)' % (pn, taskname))
sys.exit(1)
# Define recursion callback
def recursecb(key, hash1, hash2):
hashes = [hash1, hash2]
hashfiles = find_siginfo(bbhandler, key, None, hashes)
return latestfiles
recout = []
if len(hashfiles) == 0:
recout.append("Unable to find matching sigdata for %s with hashes %s or %s" % (key, hash1, hash2))
elif not hash1 in hashfiles:
recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash1))
elif not hash2 in hashfiles:
recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash2))
else:
out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb, color=color)
for change in out2:
for line in change.splitlines():
recout.append(' ' + line)
return recout
# Define recursion callback
def recursecb(key, hash1, hash2):
hashes = [hash1, hash2]
hashfiles = find_siginfo(tinfoil, key, None, hashes)
# Recurse into signature comparison
logger.debug("Signature file (previous): %s" % latestfiles[-2])
logger.debug("Signature file (latest): %s" % latestfiles[-1])
output = bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-1], recursecb, color=color)
if output:
print('\n'.join(output))
sys.exit(0)
recout = []
if len(hashfiles) == 0:
recout.append("Unable to find matching sigdata for %s with hashes %s or %s" % (key, hash1, hash2))
elif not hash1 in hashfiles:
recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash1))
elif not hash2 in hashfiles:
recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash2))
else:
out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb, color=color)
for change in out2:
for line in change.splitlines():
recout.append(' ' + line)
return recout
parser = argparse.ArgumentParser(
description="Compares siginfo/sigdata files written out by BitBake")
description=("Dumps" if is_dump else "Compares") + " siginfo/sigdata files written out by BitBake")
parser.add_argument('-d', '--debug',
parser.add_argument('-D', '--debug',
help='Enable debug output',
action='store_true')
parser.add_argument('--color',
help='Colorize output (where %(metavar)s is %(choices)s)',
choices=['auto', 'always', 'never'], default='auto', metavar='color')
if is_dump:
parser.add_argument("-t", "--task",
help="find the signature data file for the last run of the specified task",
action="store", dest="taskargs", nargs=2, metavar=('recipename', 'taskname'))
parser.add_argument("-t", "--task",
help="find the signature data files for last two runs of the specified task and compare them",
action="store", dest="taskargs", nargs=2, metavar=('recipename', 'taskname'))
parser.add_argument("sigdatafile1",
help="Signature file to dump. Not used when using -t/--task.",
action="store", nargs='?', metavar="sigdatafile")
else:
parser.add_argument('-c', '--color',
help='Colorize the output (where %(metavar)s is %(choices)s)',
choices=['auto', 'always', 'never'], default='auto', metavar='color')
parser.add_argument("-s", "--signature",
help="With -t/--task, specify the signatures to look for instead of taking the last two",
action="store", dest="sigargs", nargs=2, metavar=('fromsig', 'tosig'))
parser.add_argument('-d', '--dump',
help='Dump the last signature data instead of comparing (equivalent to using bitbake-dumpsig)',
action='store_true')
parser.add_argument("sigdatafile1",
help="First signature file to compare (or signature file to dump, if second not specified). Not used when using -t/--task.",
action="store", nargs='?')
parser.add_argument("-t", "--task",
help="find the signature data files for the last two runs of the specified task and compare them",
action="store", dest="taskargs", nargs=2, metavar=('recipename', 'taskname'))
parser.add_argument("sigdatafile2",
help="Second signature file to compare",
action="store", nargs='?')
parser.add_argument("-s", "--signature",
help="With -t/--task, specify the signatures to look for instead of taking the last two",
action="store", dest="sigargs", nargs=2, metavar=('fromsig', 'tosig'))
parser.add_argument("sigdatafile1",
help="First signature file to compare (or signature file to dump, if second not specified). Not used when using -t/--task.",
action="store", nargs='?')
parser.add_argument("sigdatafile2",
help="Second signature file to compare",
action="store", nargs='?')
options = parser.parse_args()
if is_dump:
options.color = 'never'
options.dump = True
options.sigdatafile2 = None
options.sigargs = None
if options.debug:
logger.setLevel(logging.DEBUG)
@@ -155,17 +165,32 @@ color = (options.color == 'always' or (options.color == 'auto' and sys.stdout.is
if options.taskargs:
with bb.tinfoil.Tinfoil() as tinfoil:
tinfoil.prepare(config_only=True)
if options.sigargs:
find_compare_task(tinfoil, options.taskargs[0], options.taskargs[1], options.sigargs[0], options.sigargs[1], color=color)
if not options.dump and options.sigargs:
files = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1], options.sigargs[0], options.sigargs[1])
else:
find_compare_task(tinfoil, options.taskargs[0], options.taskargs[1], color=color)
files = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1])
if options.dump:
logger.debug("Signature file: %s" % files[-1])
output = bb.siggen.dump_sigfile(files[-1])
else:
if len(files) < 2:
logger.error('Only one matching sigdata file found for the specified task (%s %s)' % (options.taskargs[0], options.taskargs[1]))
sys.exit(1)
# Recurse into signature comparison
logger.debug("Signature file (previous): %s" % files[-2])
logger.debug("Signature file (latest): %s" % files[-1])
output = bb.siggen.compare_sigfiles(files[-2], files[-1], recursecb, color=color)
else:
if options.sigargs:
logger.error('-s/--signature can only be used together with -t/--task')
sys.exit(1)
try:
if options.sigdatafile1 and options.sigdatafile2:
output = bb.siggen.compare_sigfiles(options.sigdatafile1, options.sigdatafile2, color=color)
if not options.dump and options.sigdatafile1 and options.sigdatafile2:
with bb.tinfoil.Tinfoil() as tinfoil:
tinfoil.prepare(config_only=True)
output = bb.siggen.compare_sigfiles(options.sigdatafile1, options.sigdatafile2, recursecb, color=color)
elif options.sigdatafile1:
output = bb.siggen.dump_sigfile(options.sigdatafile1)
else:
@@ -179,5 +204,5 @@ else:
logger.error('Invalid signature data - ensure you are specifying sigdata/siginfo files')
sys.exit(1)
if output:
print('\n'.join(output))
if output:
print('\n'.join(output))

View File

@@ -1,94 +0,0 @@
#!/usr/bin/env python3
# bitbake-dumpsig
# BitBake task signature dump utility
#
# Copyright (C) 2013 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os
import sys
import warnings
import optparse
import logging
import pickle
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
import bb.tinfoil
import bb.siggen
import bb.msg
logger = bb.msg.logger_create('bitbake-dumpsig')
def find_siginfo_task(bbhandler, pn, taskname):
""" Find the most recent signature file for the specified PN/task """
if not hasattr(bb.siggen, 'find_siginfo'):
logger.error('Metadata does not support finding signature data files')
sys.exit(1)
if not taskname.startswith('do_'):
taskname = 'do_%s' % taskname
filedates = bb.siggen.find_siginfo(pn, taskname, None, bbhandler.config_data)
latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-1:]
if not latestfiles:
logger.error('No sigdata files found matching %s %s' % (pn, taskname))
sys.exit(1)
return latestfiles[0]
parser = optparse.OptionParser(
description = "Dumps siginfo/sigdata files written out by BitBake",
usage = """
%prog -t recipename taskname
%prog sigdatafile""")
parser.add_option("-D", "--debug",
help = "enable debug",
action = "store_true", dest="debug", default = False)
parser.add_option("-t", "--task",
help = "find the signature data file for the specified task",
action="store", dest="taskargs", nargs=2, metavar='recipename taskname')
options, args = parser.parse_args(sys.argv)
if options.debug:
logger.setLevel(logging.DEBUG)
if options.taskargs:
tinfoil = bb.tinfoil.Tinfoil()
tinfoil.prepare(config_only = True)
file = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1])
logger.debug("Signature file: %s" % file)
elif len(args) == 1:
parser.print_help()
sys.exit(0)
else:
file = args[1]
try:
output = bb.siggen.dump_sigfile(file)
except IOError as e:
logger.error(str(e))
sys.exit(1)
except (pickle.UnpicklingError, EOFError):
logger.error('Invalid signature data - ensure you are specifying a sigdata/siginfo file')
sys.exit(1)
if output:
print('\n'.join(output))

1
bitbake/bin/bitbake-dumpsig Symbolic link
View File

@@ -0,0 +1 @@
bitbake-diffsigs

View File

@@ -588,6 +588,14 @@
The name of the path in which to place the checkout.
By default, the path is <filename>git/</filename>.
</para></listitem>
<listitem><para><emphasis>"usehead":</emphasis>
Enables local <filename>git://</filename> URLs to use the
current branch HEAD as the revision for use with
<filename>AUTOREV</filename>.
The "usehead" parameter implies no branch and only works
when the transfer protocol is
<filename>file://</filename>.
</para></listitem>
</itemizedlist>
Here are some example URLs:
<literallayout class='monospaced'>

View File

@@ -502,7 +502,7 @@
</section>
<section id='unsetting-variables'>
<title>Unseting variables</title>
<title>Unsetting variables</title>
<para>
It is possible to completely remove a variable or a variable flag

View File

@@ -150,7 +150,7 @@ class COWDictMeta(COWMeta):
yield value
if type == "items":
yield (key, value)
raise StopIteration()
return
def iterkeys(cls):
return cls.iter("keys")

View File

@@ -175,18 +175,31 @@ class BBCooker:
self.configuration = configuration
bb.debug(1, "BBCooker starting %s" % time.time())
sys.stdout.flush()
self.configwatcher = pyinotify.WatchManager()
bb.debug(1, "BBCooker pyinotify1 %s" % time.time())
sys.stdout.flush()
self.configwatcher.bbseen = []
self.configwatcher.bbwatchedfiles = []
self.confignotifier = pyinotify.Notifier(self.configwatcher, self.config_notifications)
bb.debug(1, "BBCooker pyinotify2 %s" % time.time())
sys.stdout.flush()
self.watchmask = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_CREATE | pyinotify.IN_DELETE | \
pyinotify.IN_DELETE_SELF | pyinotify.IN_MODIFY | pyinotify.IN_MOVE_SELF | \
pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO
self.watcher = pyinotify.WatchManager()
bb.debug(1, "BBCooker pyinotify3 %s" % time.time())
sys.stdout.flush()
self.watcher.bbseen = []
self.watcher.bbwatchedfiles = []
self.notifier = pyinotify.Notifier(self.watcher, self.notifications)
bb.debug(1, "BBCooker pyinotify complete %s" % time.time())
sys.stdout.flush()
# If being called by something like tinfoil, we need to clean cached data
# which may now be invalid
bb.parse.clear_cache()
@@ -196,6 +209,9 @@ class BBCooker:
self.initConfigurationData()
bb.debug(1, "BBCooker parsed base configuration %s" % time.time())
sys.stdout.flush()
# we log all events to a file if so directed
if self.configuration.writeeventlog:
# register the log file writer as UI Handler
@@ -233,6 +249,9 @@ class BBCooker:
# Let SIGHUP exit as SIGTERM
signal.signal(signal.SIGHUP, self.sigterm_exception)
bb.debug(1, "BBCooker startup complete %s" % time.time())
sys.stdout.flush()
def process_inotify_updates(self):
for n in [self.confignotifier, self.notifier]:
if n.check_events(timeout=0):

View File

@@ -1457,7 +1457,7 @@ class FetchMethod(object):
else:
cmd = 'rpm2cpio.sh %s | cpio -id' % (file)
elif file.endswith('.deb') or file.endswith('.ipk'):
output = subprocess.check_output('ar -t %s' % file, preexec_fn=subprocess_setup, shell=True)
output = subprocess.check_output(['ar', '-t', file], preexec_fn=subprocess_setup)
datafile = None
if output:
for line in output.decode().splitlines():

View File

@@ -448,7 +448,7 @@ def setup_bitbake(configParams, configuration, extrafeatures=None):
else:
logger.info("Reconnecting to bitbake server...")
if not os.path.exists(sockname):
print("Previous bitbake instance shutting down?, waiting to retry...")
logger.info("Previous bitbake instance shutting down?, waiting to retry...")
i = 0
lock = None
# Wait for 5s or until we can get the lock

View File

@@ -1371,6 +1371,12 @@ class RunQueue:
bb.event.fire(bb.event.DepTreeGenerated(depgraph), self.cooker.data)
if self.state is runQueueSceneInit:
if not self.dm_event_handler_registered:
res = bb.event.register(self.dm_event_handler_name,
lambda x: self.dm.check(self) if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp] else False,
('bb.event.HeartbeatEvent',))
self.dm_event_handler_registered = True
dump = self.cooker.configuration.dump_signatures
if dump:
self.rqdata.init_progress_reporter.finish()
@@ -1387,11 +1393,6 @@ class RunQueue:
self.rqexe = RunQueueExecuteScenequeue(self)
if self.state is runQueueSceneRun:
if not self.dm_event_handler_registered:
res = bb.event.register(self.dm_event_handler_name,
lambda x: self.dm.check(self) if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp] else False,
('bb.event.HeartbeatEvent',))
self.dm_event_handler_registered = True
retval = self.rqexe.execute()
if self.state is runQueueRunInit:

View File

@@ -130,6 +130,7 @@ class ProcessServer(multiprocessing.Process):
bb.utils.set_process_name("Cooker")
ready = []
newconnections = []
self.controllersock = False
fds = [self.sock]
@@ -138,37 +139,48 @@ class ProcessServer(multiprocessing.Process):
print("Entering server connection loop")
def disconnect_client(self, fds):
if not self.haveui:
return
print("Disconnecting Client")
fds.remove(self.controllersock)
fds.remove(self.command_channel)
bb.event.unregister_UIHhandler(self.event_handle, True)
self.command_channel_reply.writer.close()
self.event_writer.writer.close()
del self.event_writer
self.controllersock.close()
self.controllersock = False
self.haveui = False
self.lastui = time.time()
self.cooker.clientComplete()
if self.timeout is None:
if self.controllersock:
fds.remove(self.controllersock)
self.controllersock.close()
self.controllersock = False
if self.haveui:
fds.remove(self.command_channel)
bb.event.unregister_UIHhandler(self.event_handle, True)
self.command_channel_reply.writer.close()
self.event_writer.writer.close()
self.command_channel.close()
self.command_channel = False
del self.event_writer
self.lastui = time.time()
self.cooker.clientComplete()
self.haveui = False
ready = select.select(fds,[],[],0)[0]
if newconnections:
print("Starting new client")
conn = newconnections.pop(-1)
fds.append(conn)
self.controllersock = conn
elif self.timeout is None and not ready:
print("No timeout, exiting.")
self.quit = True
while not self.quit:
if self.sock in ready:
self.controllersock, address = self.sock.accept()
if self.haveui:
print("Dropping connection attempt as we have a UI %s" % (str(ready)))
self.controllersock.close()
else:
print("Accepting %s" % (str(ready)))
fds.append(self.controllersock)
while select.select([self.sock],[],[],0)[0]:
controllersock, address = self.sock.accept()
if self.controllersock:
print("Queuing %s (%s)" % (str(ready), str(newconnections)))
newconnections.append(controllersock)
else:
print("Accepting %s (%s)" % (str(ready), str(newconnections)))
self.controllersock = controllersock
fds.append(controllersock)
if self.controllersock in ready:
try:
print("Connecting Client")
print("Processing Client")
ui_fds = recvfds(self.controllersock, 3)
print("Connecting Client")
# Where to write events to
writer = ConnectionWriter(ui_fds[0])
@@ -239,6 +251,12 @@ class ProcessServer(multiprocessing.Process):
while not lock:
with bb.utils.timeout(3):
lock = bb.utils.lockfile(lockfile, shared=False, retry=False, block=True)
if lock:
# We hold the lock so we can remove the file (hide stale pid data)
bb.utils.remove(lockfile)
bb.utils.unlockfile(lock)
return
if not lock:
# Some systems may not have lsof available
procs = None
@@ -259,10 +277,6 @@ class ProcessServer(multiprocessing.Process):
if procs:
msg += ":\n%s" % str(procs)
print(msg)
return
# We hold the lock so we can remove the file (hide stale pid data)
bb.utils.remove(lockfile)
bb.utils.unlockfile(lock)
def idle_commands(self, delay, fds=None):
nextsleep = delay
@@ -396,7 +410,10 @@ class BitBakeServer(object):
self.bitbake_lock.close()
ready = ConnectionReader(self.readypipe)
r = ready.poll(30)
r = ready.poll(5)
if not r:
bb.note("Bitbake server didn't start within 5 seconds, waiting for 90")
r = ready.poll(90)
if r:
r = ready.get()
if not r or r != "ready":
@@ -406,28 +423,40 @@ class BitBakeServer(object):
logstart_re = re.compile(self.start_log_format % ('([0-9]+)', '([0-9-]+ [0-9:.]+)'))
started = False
lines = []
lastlines = []
with open(logfile, "r") as f:
for line in f:
if started:
lines.append(line)
else:
lastlines.append(line)
res = logstart_re.match(line.rstrip())
if res:
ldatetime = datetime.datetime.strptime(res.group(2), self.start_log_datetime_format)
if ldatetime >= startdatetime:
started = True
lines.append(line)
if len(lastlines) > 60:
lastlines = lastlines[-60:]
if lines:
if len(lines) > 10:
bb.error("Last 10 lines of server log for this session (%s):\n%s" % (logfile, "".join(lines[-10:])))
if len(lines) > 60:
bb.error("Last 60 lines of server log for this session (%s):\n%s" % (logfile, "".join(lines[-60:])))
else:
bb.error("Server log for this session (%s):\n%s" % (logfile, "".join(lines)))
elif lastlines:
bb.error("Server didn't start, last 60 loglines (%s):\n%s" % (logfile, "".join(lastlines)))
else:
bb.error("%s doesn't exist" % logfile)
raise SystemExit(1)
ready.close()
os.close(self.readypipein)
def _startServer(self):
print(self.start_log_format % (os.getpid(), datetime.datetime.now().strftime(self.start_log_datetime_format)))
sys.stdout.flush()
server = ProcessServer(self.bitbake_lock, self.sock, self.sockname)
self.configuration.setServerRegIdleCallback(server.register_idle_function)
writer = ConnectionWriter(self.readypipein)
@@ -443,6 +472,8 @@ class BitBakeServer(object):
server.server_timeout = self.configuration.server_timeout
server.xmlrpcinterface = self.configuration.xmlrpcinterface
print("Started bitbake server pid %d" % os.getpid())
sys.stdout.flush()
server.start()
def connectProcessServer(sockname, featureset):
@@ -451,16 +482,24 @@ def connectProcessServer(sockname, featureset):
# AF_UNIX has path length issues so chdir here to workaround
cwd = os.getcwd()
try:
os.chdir(os.path.dirname(sockname))
sock.connect(os.path.basename(sockname))
finally:
os.chdir(cwd)
readfd = writefd = readfd1 = writefd1 = readfd2 = writefd2 = None
eq = command_chan_recv = command_chan = None
sock.settimeout(10)
try:
try:
os.chdir(os.path.dirname(sockname))
finished = False
while not finished:
try:
sock.connect(os.path.basename(sockname))
finished = True
except IOError as e:
if e.errno == errno.EWOULDBLOCK:
pass
finally:
os.chdir(cwd)
# Send an fd for the remote to write events to
readfd, writefd = os.pipe()
@@ -489,7 +528,8 @@ def connectProcessServer(sockname, featureset):
command_chan.close()
for i in [writefd, readfd1, writefd2]:
try:
os.close(i)
if i:
os.close(i)
except OSError:
pass
sock.close()

View File

@@ -1290,7 +1290,7 @@ def edit_metadata_file(meta_file, variables, varfunc):
return updated
def edit_bblayers_conf(bblayers_conf, add, remove):
def edit_bblayers_conf(bblayers_conf, add, remove, edit_cb=None):
"""Edit bblayers.conf, adding and/or removing layers
Parameters:
bblayers_conf: path to bblayers.conf file to edit
@@ -1298,6 +1298,8 @@ def edit_bblayers_conf(bblayers_conf, add, remove):
list to add nothing
remove: layer path (or list of layer paths) to remove; None or
empty list to remove nothing
edit_cb: optional callback function that will be called after
processing adds/removes once per existing entry.
Returns a tuple:
notadded: list of layers specified to be added but weren't
(because they were already in the list)
@@ -1361,6 +1363,17 @@ def edit_bblayers_conf(bblayers_conf, add, remove):
bblayers.append(addlayer)
del addlayers[:]
if edit_cb:
newlist = []
for layer in bblayers:
res = edit_cb(layer, canonicalise_path(layer))
if res != layer:
newlist.append(res)
updated = True
else:
newlist.append(layer)
bblayers = newlist
if updated:
if op == '+=' and not bblayers:
bblayers = None

View File

@@ -133,7 +133,7 @@ class LayerIndexPlugin(ActionPlugin):
layerdir = os.path.join(repodir, subdir)
if not os.path.exists(repodir):
if fetch_layer:
result = subprocess.call('git clone %s %s' % (url, repodir), shell = True)
result = subprocess.call(['git', 'clone', url, repodir])
if result:
logger.error("Failed to download %s" % url)
return None, None

View File

@@ -131,19 +131,43 @@
<literallayout class='monospaced'>
$ git clone git://git.yoctoproject.org/poky
Cloning into 'poky'...
remote: Counting objects: 361782, done.
remote: Compressing objects: 100% (87100/87100), done.
remote: Total 361782 (delta 268619), reused 361439 (delta 268277)
Receiving objects: 100% (361782/361782), 131.94 MiB | 6.88 MiB/s, done.
Resolving deltas: 100% (268619/268619), done.
remote: Counting objects: 431956, done.
remote: Compressing objects: 100% (101918/101918), done.
remote: Total 431956 (delta 322982), reused 431910 (delta 322936)
Receiving objects: 100% (431956/431956), 153.76 MiB | 6.86 MiB/s, done.
Resolving deltas: 100% (322982/322982), done.
Checking connectivity... done.
$ git checkout tags/yocto-2.5 -b my-yocto-2.5
</literallayout>
The previous Git checkout command creates a local branch
named my-&DISTRO_REL_TAG;. The files available to you in that
branch exactly match the repository's files in the
"&DISTRO_NAME_NO_CAP;" development branch at the time of the
Yocto Project &DISTRO; release.
Move to the poky directory and take a look at the tags:
<literallayout class='monospaced'>
$ cd poky
$ git fetch --tags
$ git tag
1.1_M1.final
1.1_M1.rc1
1.1_M1.rc2
1.1_M2.final
1.1_M2.rc1
.
.
.
yocto-2.5.2
yocto-2.5.3
yocto-2.6
yocto-2.6.1
yocto_1.5_M5.rc8
</literallayout>
For this example, check out the branch based on the
yocto-&DISTRO; release:
<literallayout class='monospaced'>
$ git checkout tags/yocto-&DISTRO; -b my-yocto-&DISTRO;
Switched to a new branch 'my-yocto-&DISTRO;'
</literallayout>
The previous Git checkout command creates a local branch named
my-yocto-&DISTRO;.
The files available to you in that branch exactly match the
repository's files in the "&DISTRO_NAME_NO_CAP;" development
branch at the time of the Yocto Project yocto-&DISTRO; release.
</para>
<para>

View File

@@ -126,6 +126,16 @@
<date>September 2018</date>
<revremark>The initial document released with the Yocto Project 2.5.1 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.2</revnumber>
<date>January 2019</date>
<revremark>The initial document released with the Yocto Project 2.5.2 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.3</revnumber>
<date>&REL_MONTH_YEAR;</date>
<revremark>The initial document released with the Yocto Project 2.5.3 Release.</revremark>
</revision>
</revhistory>
<copyright>

View File

@@ -881,11 +881,11 @@
<literallayout class='monospaced'>
$ git clone git://git.yoctoproject.org/poky
Cloning into 'poky'...
remote: Counting objects: 367178, done.
remote: Compressing objects: 100% (88161/88161), done.
remote: Total 367178 (delta 272761), reused 366942 (delta 272525)
Receiving objects: 100% (367178/367178), 133.26 MiB | 6.40 MiB/s, done.
Resolving deltas: 100% (272761/272761), done.
remote: Counting objects: 431956, done.
remote: Compressing objects: 100% (101918/101918), done.
remote: Total 431956 (delta 322982), reused 431910 (delta 322936)
Receiving objects: 100% (431956/431956), 153.76 MiB | 6.86 MiB/s, done.
Resolving deltas: 100% (322982/322982), done.
Checking connectivity... done.
</literallayout>
Unless you specify a specific development branch or
@@ -963,13 +963,12 @@
.
.
.
remotes/origin/master-next
remotes/origin/master-next2
remotes/origin/morty
remotes/origin/pinky
remotes/origin/purple
remotes/origin/pyro
remotes/origin/rocko
remotes/origin/rocko-next
remotes/origin/sumo
remotes/origin/sumo-next
remotes/origin/thud
remotes/origin/thud-next
</literallayout>
</para></listitem>
<listitem><para>
@@ -1048,11 +1047,10 @@
.
.
.
yocto-2.2
yocto-2.2.1
yocto-2.3
yocto-2.3.1
yocto-2.4
yocto-2.5.2
yocto-2.5.3
yocto-2.6
yocto-2.6.1
yocto_1.5_M5.rc8
</literallayout>
</para></listitem>

View File

@@ -111,6 +111,16 @@
<date>September 2018</date>
<revremark>The initial document released with the Yocto Project 2.5.1 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.2</revnumber>
<date>January 2019</date>
<revremark>The initial document released with the Yocto Project 2.5.2 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.3</revnumber>
<date>&REL_MONTH_YEAR;</date>
<revremark>The initial document released with the Yocto Project 2.5.3 Release.</revremark>
</revision>
</revhistory>
<copyright>

View File

@@ -96,6 +96,16 @@
<date>September 2018</date>
<revremark>The initial document released with the Yocto Project 2.5.1 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.2</revnumber>
<date>January 2019</date>
<revremark>The initial document released with the Yocto Project 2.5.2 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.3</revnumber>
<date>&REL_MONTH_YEAR;</date>
<revremark>The initial document released with the Yocto Project 2.5.3 Release.</revremark>
</revision>
</revhistory>
<copyright>

BIN
documentation/mega-manual/figures/package-feeds.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -80,6 +80,16 @@
<date>September 2018</date>
<revremark>The initial document released with the Yocto Project 2.5.1 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.2</revnumber>
<date>January 2019</date>
<revremark>The initial document released with the Yocto Project 2.5.2 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.3</revnumber>
<date>&REL_MONTH_YEAR;</date>
<revremark>The initial document released with the Yocto Project 2.5.3 Release.</revremark>
</revision>
</revhistory>
<copyright>

BIN
documentation/overview-manual/figures/package-feeds.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -41,6 +41,16 @@
<date>September 2018</date>
<revremark>The initial document released with the Yocto Project 2.5.1 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.2</revnumber>
<date>January 2019</date>
<revremark>The initial document released with the Yocto Project 2.5.2 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.3</revnumber>
<date>&REL_MONTH_YEAR;</date>
<revremark>The initial document released with the Yocto Project 2.5.3 Release.</revremark>
</revision>
</revhistory>
<copyright>

View File

@@ -1,19 +1,19 @@
<!ENTITY DISTRO "2.5.1">
<!ENTITY DISTRO_COMPRESSED "251">
<!ENTITY DISTRO "2.5.3">
<!ENTITY DISTRO_COMPRESSED "253">
<!ENTITY DISTRO_NAME_NO_CAP "sumo">
<!ENTITY DISTRO_NAME "Sumo">
<!ENTITY DISTRO_NAME_NO_CAP_MINUS_ONE "rocko">
<!ENTITY DISTRO_NAME_MINUS_ONE "Rocko">
<!ENTITY YOCTO_DOC_VERSION "2.5.1">
<!ENTITY YOCTO_DOC_VERSION_MINUS_ONE "2.4">
<!ENTITY DISTRO_REL_TAG "yocto-2.5.1">
<!ENTITY METAINTELVERSION "9.0">
<!ENTITY REL_MONTH_YEAR "September 2018">
<!ENTITY YOCTO_DOC_VERSION "2.5.3">
<!ENTITY YOCTO_DOC_VERSION_MINUS_ONE "2.4.4">
<!ENTITY DISTRO_REL_TAG "yocto-2.5.3">
<!ENTITY METAINTELVERSION "9.2">
<!ENTITY REL_MONTH_YEAR "March 2019">
<!ENTITY META_INTEL_REL_TAG "&METAINTELVERSION;-&DISTRO_NAME_NO_CAP;-&YOCTO_DOC_VERSION;">
<!ENTITY POKYVERSION "20.0.1">
<!ENTITY POKYVERSION_COMPRESSED "2001">
<!ENTITY POKYVERSION "20.0.3">
<!ENTITY POKYVERSION_COMPRESSED "2003">
<!ENTITY YOCTO_POKY "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;">
<!ENTITY COPYRIGHT_YEAR "2010-2018">
<!ENTITY COPYRIGHT_YEAR "2010-2019">
<!ENTITY YOCTO_DL_URL "http://downloads.yoctoproject.org">
<!ENTITY YOCTO_HOME_URL "http://www.yoctoproject.org">
<!ENTITY YOCTO_LISTS_URL "http://lists.yoctoproject.org">

View File

@@ -96,6 +96,16 @@
<date>September 2018</date>
<revremark>The initial document released with the Yocto Project 2.5.1 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.2</revnumber>
<date>January 2019</date>
<revremark>The initial document released with the Yocto Project 2.5.2 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.3</revnumber>
<date>&REL_MONTH_YEAR;</date>
<revremark>The initial document released with the Yocto Project 2.5.3 Release.</revremark>
</revision>
</revhistory>
<copyright>

View File

@@ -127,6 +127,16 @@
<date>September 2018</date>
<revremark>The initial document released with the Yocto Project 2.5.1 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.2</revnumber>
<date>January 2019</date>
<revremark>The initial document released with the Yocto Project 2.5.2 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.3</revnumber>
<date>&REL_MONTH_YEAR;</date>
<revremark>The initial document released with the Yocto Project 2.5.3 Release.</revremark>
</revision>
</revhistory>
<copyright>

View File

@@ -13301,7 +13301,7 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3"
</para></listitem>
<listitem><para><emphasis><filename>maxdate</filename> -</emphasis>
Apply the patch only if <filename>SRCDATE</filename>
is not later than <filename>mindate</filename>.
is not later than <filename>maxdate</filename>.
</para></listitem>
<listitem><para><emphasis><filename>minrev</filename> -</emphasis>
Apply the patch only if <filename>SRCREV</filename>
@@ -16412,7 +16412,7 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3"
USERADD_PACKAGES = "${PN}"
</literallayout>
<note>
If follows that if you are going to use the
It follows that if you are going to use the
<filename>USERADD_PACKAGES</filename> variable,
you need to set one or more of the
<link linkend='var-USERADD_PARAM'><filename>USERADD_PARAM</filename></link>,

View File

@@ -61,6 +61,16 @@
<date>September 2018</date>
<revremark>The initial document released with the Yocto Project 2.5.1 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.2</revnumber>
<date>January 2019</date>
<revremark>The initial document released with the Yocto Project 2.5.2 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.3</revnumber>
<date>&REL_MONTH_YEAR;</date>
<revremark>The initial document released with the Yocto Project 2.5.3 Release.</revremark>
</revision>
</revhistory>
<copyright>

View File

@@ -71,6 +71,16 @@
<date>September 2018</date>
<revremark>The initial document released with the Yocto Project 2.5.1 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.2</revnumber>
<date>January 2019</date>
<revremark>The initial document released with the Yocto Project 2.5.2 Release.</revremark>
</revision>
<revision>
<revnumber>2.5.3</revnumber>
<date>&REL_MONTH_YEAR;</date>
<revremark>The initial document released with the Yocto Project 2.5.3 Release.</revremark>
</revision>
</revhistory>
<copyright>

View File

@@ -2,39 +2,39 @@
# This style is for manual folders like "yocto-project-qs" and "poky-ref-manual".
# This is the old way that did it. Can't do that now that we have "bitbake-user-manual" strings
# in the mega-manual.
# s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/[a-z]*-[a-z]*-[a-z]*/[a-z]*-[a-z]*-[a-z]*.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/yocto-project-qs/yocto-project-qs.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/poky-ref-manual/poky-ref-manual.html#@"link" href="#@g
# s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/[a-z]*-[a-z]*-[a-z]*/[a-z]*-[a-z]*-[a-z]*.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/yocto-project-qs/yocto-project-qs.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/poky-ref-manual/poky-ref-manual.html#@"link" href="#@g
# Processes all other manuals (<word>-<word> style) except for the BitBake User Manual because
# it is not included in the mega-manual.
# This style is for manual folders that use two word, which is the standard now (e.g. "ref-manual").
# This was the one-liner that worked before we introduced the BitBake User Manual, which is
# not in the mega-manual.
# s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/[a-z]*-[a-z]*/[a-z]*-[a-z]*.html#@"link" href="#@g
# s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/[a-z]*-[a-z]*/[a-z]*-[a-z]*.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/sdk-manual/sdk-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/bsp-guide/bsp-guide.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/dev-manual/dev-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/overview-manual/overview-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/brief-yoctoprojectqs/brief-yoctoprojectqs.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/kernel-dev/kernel-dev.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/profile-manual/profile-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/ref-manual/ref-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.1/toaster-manual/toaster-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/sdk-manual/sdk-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/bsp-guide/bsp-guide.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/dev-manual/dev-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/overview-manual/overview-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/brief-yoctoprojectqs/brief-yoctoprojectqs.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/kernel-dev/kernel-dev.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/profile-manual/profile-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/ref-manual/ref-manual.html#@"link" href="#@g
s@"ulink" href="http://www.yoctoproject.org/docs/2.5.2/toaster-manual/toaster-manual.html#@"link" href="#@g
# Process cases where just an external manual is referenced without an id anchor
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/brief-yoctoprojectqs/brief-yoctoprojectqs.html" target="_top">Yocto Project Quick Build</a>@Yocto Project Quick Build@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/yocto-project-qs/yocto-project-qs.html" target="_top">Yocto Project Quick Start</a>@Yocto Project Quick Start@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/dev-manual/dev-manual.html" target="_top">Yocto Project Development Tasks Manual</a>@Yocto Project Development Tasks Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/overview-manual/overview-manual.html" target="_top">Yocto Project Overview and Concepts Manual</a>@Yocto project Overview and Concepts Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/sdk-manual/sdk-manual.html" target="_top">Yocto Project Application Development and the Extensible Software Development Kit (eSDK)</a>@Yocto Project Application Development and the Extensible Software Development Kit (eSDK)@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/bsp-guide/bsp-guide.html" target="_top">Yocto Project Board Support Package (BSP) Developer's Guide</a>@Yocto Project Board Support Package (BSP) Developer's Guide@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/profile-manual/profile-manual.html" target="_top">Yocto Project Profiling and Tracing Manual</a>@Yocto Project Profiling and Tracing Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/kernel-dev/kernel-dev.html" target="_top">Yocto Project Linux Kernel Development Manual</a>@Yocto Project Linux Kernel Development Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/ref-manual/ref-manual.html" target="_top">Yocto Project Reference Manual</a>@Yocto Project Reference Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/toaster-manual/toaster-manual.html" target="_top">Toaster User Manual</a>@Toaster User Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/brief-yoctoprojectqs/brief-yoctoprojectqs.html" target="_top">Yocto Project Quick Build</a>@Yocto Project Quick Build@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/yocto-project-qs/yocto-project-qs.html" target="_top">Yocto Project Quick Start</a>@Yocto Project Quick Start@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/dev-manual/dev-manual.html" target="_top">Yocto Project Development Tasks Manual</a>@Yocto Project Development Tasks Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/overview-manual/overview-manual.html" target="_top">Yocto Project Overview and Concepts Manual</a>@Yocto project Overview and Concepts Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/sdk-manual/sdk-manual.html" target="_top">Yocto Project Application Development and the Extensible Software Development Kit (eSDK)</a>@Yocto Project Application Development and the Extensible Software Development Kit (eSDK)@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/bsp-guide/bsp-guide.html" target="_top">Yocto Project Board Support Package (BSP) Developer's Guide</a>@Yocto Project Board Support Package (BSP) Developer's Guide@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/profile-manual/profile-manual.html" target="_top">Yocto Project Profiling and Tracing Manual</a>@Yocto Project Profiling and Tracing Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/kernel-dev/kernel-dev.html" target="_top">Yocto Project Linux Kernel Development Manual</a>@Yocto Project Linux Kernel Development Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/ref-manual/ref-manual.html" target="_top">Yocto Project Reference Manual</a>@Yocto Project Reference Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/toaster-manual/toaster-manual.html" target="_top">Toaster User Manual</a>@Toaster User Manual@g
# Process a single, rouge occurrence of a linked reference to the Mega-Manual.
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.1/mega-manual/mega-manual.html" target="_top">Yocto Project Mega-Manual</a>@Yocto Project Mega-Manual@g
s@<a class="ulink" href="http://www.yoctoproject.org/docs/2.5.2/mega-manual/mega-manual.html" target="_top">Yocto Project Mega-Manual</a>@Yocto Project Mega-Manual@g

View File

@@ -1,6 +1,6 @@
DISTRO = "poky"
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
DISTRO_VERSION = "2.5.2"
DISTRO_VERSION = "2.5.3"
DISTRO_CODENAME = "sumo"
SDK_VENDOR = "-pokysdk"
SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}"

View File

@@ -27,7 +27,7 @@ class DnfSelftest(DnfTest):
Expected: 1. Feeds were correctly set for dnf
2. Update recovers packages from host's repo
Author: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Author: Alexander Kanavin <alexander.kanavin@intel.com>
Author: Alexander Kanavin <alex.kanavin@gmail.com>
"""
# When we created an image, we had to supply fake ip and port
# for the feeds. Now we can patch the real ones into the config file.

View File

@@ -0,0 +1,12 @@
SUMMARY = "Recipe with a fixed delay task"
DESCRIPTION = "Contains a delay task to be used to for testing."
LICENSE = "MIT"
INHIBIT_DEFAULT_DEPS = "1"
EXCLUDE_FROM_WORLD = "1"
do_delay() {
sleep 5
}
do_delay[nostamp] = "1"
addtask delay

View File

@@ -40,8 +40,11 @@ ARCHIVER_MODE[recipe] ?= "0"
DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources"
ARCHIVER_TOPDIR ?= "${WORKDIR}/deploy-sources"
ARCHIVER_OUTDIR = "${ARCHIVER_TOPDIR}/${TARGET_SYS}/${PF}/"
ARCHIVER_RPMTOPDIR ?= "${WORKDIR}/deploy-sources-rpm"
ARCHIVER_RPMOUTDIR = "${ARCHIVER_RPMTOPDIR}/${TARGET_SYS}/${PF}/"
ARCHIVER_WORKDIR = "${WORKDIR}/archiver-work/"
do_dumpdata[dirs] = "${ARCHIVER_OUTDIR}"
do_ar_recipe[dirs] = "${ARCHIVER_OUTDIR}"
do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}"
@@ -117,6 +120,9 @@ python () {
if d.getVarFlag('ARCHIVER_MODE', 'srpm') == "1" and d.getVar('PACKAGES'):
if "package_rpm" in d.getVar('PACKAGE_CLASSES'):
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_package_write_rpm' % pn)
d.appendVarFlag('do_package_write_rpm', 'dirs', ' ${ARCHIVER_RPMTOPDIR}')
d.appendVarFlag('do_package_write_rpm', 'sstate-inputdirs', ' ${ARCHIVER_RPMTOPDIR}')
d.appendVarFlag('do_package_write_rpm', 'sstate-outputdirs', ' ${DEPLOY_DIR_SRC}')
if ar_dumpdata == "1":
d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_dumpdata' % pn)
if ar_recipe == "1":

View File

@@ -64,6 +64,8 @@ def buildinfo_target(d):
# Write build information to target filesystem
python buildinfo () {
if not d.getVar('IMAGE_BUILDINFO_FILE'):
return
with open(d.expand('${IMAGE_ROOTFS}${IMAGE_BUILDINFO_FILE}'), 'w') as build:
build.writelines((
'''-----------------------

View File

@@ -239,6 +239,7 @@ EXTRA_IMAGECMD_ext4 ?= "-i 4096"
EXTRA_IMAGECMD_btrfs ?= "-n 4096"
EXTRA_IMAGECMD_f2fs ?= ""
do_image_cpio[depends] += "cpio-native:do_populate_sysroot"
do_image_jffs2[depends] += "mtd-utils-native:do_populate_sysroot"
do_image_cramfs[depends] += "util-linux-native:do_populate_sysroot"
do_image_ext2[depends] += "e2fsprogs-native:do_populate_sysroot"

View File

@@ -152,8 +152,8 @@ PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-firmware-.*"
export OS = "${TARGET_OS}"
export CROSS_COMPILE = "${TARGET_PREFIX}"
export KBUILD_BUILD_VERSION = "1"
export KBUILD_BUILD_USER = "oe-user"
export KBUILD_BUILD_HOST = "oe-host"
export KBUILD_BUILD_USER ?= "oe-user"
export KBUILD_BUILD_HOST ?= "oe-host"
KERNEL_RELEASE ?= "${KERNEL_VERSION}"

View File

@@ -0,0 +1,32 @@
#
# Recipe needs to set MULTILIB_SCRIPTS in the form <pkgname>:<scriptname>, e.g.
# MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/file1 ${PN}:${base_bindir}/file2"
# to indicate which script files to process from which packages.
#
inherit update-alternatives
MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
PACKAGE_PREPROCESS_FUNCS += "multilibscript_rename"
multilibscript_rename() {
:
}
python () {
# Do nothing if multilib isn't being used
if not d.getVar("MULTILIB_VARIANTS"):
return
# Do nothing for native/cross
if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d):
return
for entry in (d.getVar("MULTILIB_SCRIPTS", False) or "").split():
pkg, script = entry.split(":")
scriptname = os.path.basename(script)
d.setVar("ALTERNATIVE_" + pkg, scriptname)
d.setVarFlag("ALTERNATIVE_LINK_NAME", scriptname, script)
d.setVarFlag("ALTERNATIVE_TARGET", scriptname, script + "-${MULTILIB_SUFFIX}")
d.appendVar("multilibscript_rename", "\n mv ${PKGD}" + script + " ${PKGD}" + script + "-${MULTILIB_SUFFIX}")
}

View File

@@ -359,7 +359,8 @@ def append_source_info(file, sourcefile, d, fatal=True):
# of rpm's debugedit, which was writing them out that way, and the code elsewhere
# is still assuming that.
debuglistoutput = '\0'.join(debugsources) + '\0'
open(sourcefile, 'a').write(debuglistoutput)
with open(sourcefile, 'a') as sf:
sf.write(debuglistoutput)
def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
@@ -1411,9 +1412,6 @@ fi
pkgdest = d.getVar('PKGDEST')
pkgdatadir = d.getVar('PKGDESTWORK')
# Take shared lock since we're only reading, not writing
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
data_file = pkgdatadir + d.expand("/${PN}" )
f = open(data_file, 'w')
f.write("PACKAGES: %s\n" % packages)
@@ -1518,7 +1516,6 @@ fi
if bb.data.inherits_class('allarch', d) and not bb.data.inherits_class('packagegroup', d):
write_extra_runtime_pkgs(global_variants, packages, pkgdatadir)
bb.utils.unlockfile(lf)
}
emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides"
@@ -1617,9 +1614,6 @@ python package_do_shlibs() {
shlibswork_dir = d.getVar('SHLIBSWORKDIR')
# Take shared lock since we're only reading, not writing
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
def linux_so(file, needed, sonames, renames, pkgver):
needs_ldconfig = False
ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
@@ -1732,7 +1726,11 @@ python package_do_shlibs() {
use_ldconfig = bb.utils.contains('DISTRO_FEATURES', 'ldconfig', True, False, d)
needed = {}
# Take shared lock since we're only reading, not writing
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
shlib_provider = oe.package.read_shlib_providers(d)
bb.utils.unlockfile(lf)
for pkg in packages.split():
private_libs = d.getVar('PRIVATE_LIBS_' + pkg) or d.getVar('PRIVATE_LIBS') or ""
@@ -1788,8 +1786,6 @@ python package_do_shlibs() {
d.setVar('pkg_postinst_%s' % pkg, postinst)
bb.debug(1, 'LIBNAMES: pkg %s sonames %s' % (pkg, sonames))
bb.utils.unlockfile(lf)
assumed_libs = d.getVar('ASSUME_SHLIBS')
if assumed_libs:
libdir = d.getVar("libdir")
@@ -1902,9 +1898,6 @@ python package_do_pkgconfig () {
if hdr == 'Requires':
pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
# Take shared lock since we're only reading, not writing
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
for pkg in packages.split():
pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist")
if pkgconfig_provided[pkg] != []:
@@ -1913,6 +1906,9 @@ python package_do_pkgconfig () {
f.write('%s\n' % p)
f.close()
# Take shared lock since we're only reading, not writing
lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
# Go from least to most specific since the last one found wins
for dir in reversed(shlibs_dirs):
if not os.path.exists(dir):
@@ -1928,6 +1924,8 @@ python package_do_pkgconfig () {
for l in lines:
pkgconfig_provided[pkg].append(l.rstrip())
bb.utils.unlockfile(lf)
for pkg in packages.split():
deps = []
for n in pkgconfig_needed[pkg]:
@@ -1945,8 +1943,6 @@ python package_do_pkgconfig () {
for dep in deps:
fd.write(dep + '\n')
fd.close()
bb.utils.unlockfile(lf)
}
def read_libdep_files(d):

View File

@@ -113,6 +113,10 @@ python write_specfile () {
source_list = os.listdir(ar_outdir)
source_number = 0
for source in source_list:
# do_deploy_archives may have already run (from sstate) meaning a .src.rpm may already
# exist in ARCHIVER_OUTDIR so skip if present.
if source.endswith(".src.rpm"):
continue
# The rpmbuild doesn't need the root permission, but it needs
# to know the file's user and group name, the only user and
# group in fakeroot is "root" when working in fakeroot.
@@ -690,7 +694,7 @@ python do_package_rpm () {
cmd = cmd + " --define '_tmppath " + workdir + "'"
if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
cmd = cmd + " --define '_sourcedir " + d.getVar('ARCHIVER_OUTDIR') + "'"
cmdsrpm = cmd + " --define '_srcrpmdir " + d.getVar('ARCHIVER_OUTDIR') + "'"
cmdsrpm = cmd + " --define '_srcrpmdir " + d.getVar('ARCHIVER_RPMOUTDIR') + "'"
cmdsrpm = cmdsrpm + " -bs " + outspecfile
# Build the .src.rpm
d.setVar('SBUILDSPEC', cmdsrpm + "\n")

View File

@@ -153,6 +153,7 @@ python patch_do_patch() {
patch_do_patch[vardepsexclude] = "PATCHRESOLVE"
addtask patch after do_unpack
do_patch[umask] = "022"
do_patch[dirs] = "${WORKDIR}"
do_patch[depends] = "${PATCHDEPENDENCY}"

View File

@@ -325,8 +325,9 @@ python copy_buildsystem () {
f.write('TCLIBCAPPEND = ""\n')
f.write('DL_DIR = "${TOPDIR}/downloads"\n')
f.write('INHERIT += "%s"\n' % 'uninative')
f.write('UNINATIVE_CHECKSUM[%s] = "%s"\n\n' % (d.getVar('BUILD_ARCH'), uninative_checksum))
if bb.data.inherits_class('uninative', d):
f.write('INHERIT += "%s"\n' % 'uninative')
f.write('UNINATIVE_CHECKSUM[%s] = "%s"\n\n' % (d.getVar('BUILD_ARCH'), uninative_checksum))
f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False))
# Some classes are not suitable for SDK, remove them from INHERIT

View File

@@ -2,7 +2,7 @@
#
# Released under the MIT license (see COPYING.MIT)
inherit metadata_scm
# testimage.bbclass enables testing of qemu images using python unittests.
# Most of the tests are commands run on target image over ssh.
# To use it add testimage to global inherit and call your target image with -c testimage
@@ -26,6 +26,7 @@
# TEST_LOG_DIR contains a command ssh log and may contain infromation about what command is running, output and return codes and for qemu a boot log till login.
# Booting is handled by this class, and it's not a test in itself.
# TEST_QEMUBOOT_TIMEOUT can be used to set the maximum time in seconds the launch code will wait for the login prompt.
# TEST_QEMUPARAMS can be used to pass extra parameters to qemu, e.g. "-m 1024" for setting the amount of ram to 1 GB.
TEST_LOG_DIR ?= "${WORKDIR}/testimage"
@@ -35,26 +36,13 @@ TEST_NEEDED_PACKAGES_DIR ?= "${WORKDIR}/testimage/packages"
TEST_EXTRACTED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/extracted"
TEST_PACKAGED_DIR ?= "${TEST_NEEDED_PACKAGES_DIR}/packaged"
RPMTESTSUITE = "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'dnf rpm', '', d)}"
SYSTEMDSUITE = "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
MINTESTSUITE = "ping"
NETTESTSUITE = "${MINTESTSUITE} ssh df date scp oe_syslog ${SYSTEMDSUITE}"
DEVTESTSUITE = "gcc kernelmodule ldd"
BASICTESTSUITE = "\
ping date df ssh scp python perl gi ptest parselogs \
logrotate connman systemd oe_syslog pam stap ldd xorg \
kernelmodule gcc buildcpio buildlzip buildgalculator \
dnf rpm opkg apt"
DEFAULT_TEST_SUITES = "${MINTESTSUITE} auto"
DEFAULT_TEST_SUITES_pn-core-image-minimal = "${MINTESTSUITE}"
DEFAULT_TEST_SUITES_pn-core-image-minimal-dev = "${MINTESTSUITE}"
DEFAULT_TEST_SUITES_pn-core-image-full-cmdline = "${NETTESTSUITE} perl python logrotate ptest"
DEFAULT_TEST_SUITES_pn-core-image-x11 = "${MINTESTSUITE}"
DEFAULT_TEST_SUITES_pn-core-image-lsb = "${NETTESTSUITE} pam parselogs ${RPMTESTSUITE} ptest"
DEFAULT_TEST_SUITES_pn-core-image-sato = "${NETTESTSUITE} connman xorg parselogs ${RPMTESTSUITE} \
${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'python', '', d)} ptest gi"
DEFAULT_TEST_SUITES_pn-core-image-sato-sdk = "${NETTESTSUITE} buildcpio buildlzip buildgalculator \
connman ${DEVTESTSUITE} logrotate perl parselogs python ${RPMTESTSUITE} xorg ptest gi stap"
DEFAULT_TEST_SUITES_pn-core-image-lsb-dev = "${NETTESTSUITE} pam perl python parselogs ${RPMTESTSUITE} ptest gi"
DEFAULT_TEST_SUITES_pn-core-image-lsb-sdk = "${NETTESTSUITE} buildcpio buildlzip buildgalculator \
connman ${DEVTESTSUITE} logrotate pam parselogs perl python ${RPMTESTSUITE} ptest gi stap"
DEFAULT_TEST_SUITES_pn-meta-toolchain = "auto"
DEFAULT_TEST_SUITES = "${BASICTESTSUITE}"
# aarch64 has no graphics
DEFAULT_TEST_SUITES_remove_aarch64 = "xorg"
@@ -71,6 +59,7 @@ TEST_SUITES ?= "${DEFAULT_TEST_SUITES}"
TEST_QEMUBOOT_TIMEOUT ?= "1000"
TEST_TARGET ?= "qemu"
TEST_QEMUPARAMS ?= ""
TESTIMAGEDEPENDS = ""
TESTIMAGEDEPENDS_qemuall = "qemu-native:do_populate_sysroot qemu-helper-native:do_populate_sysroot qemu-helper-native:do_addto_recipe_sysroot"
@@ -85,7 +74,7 @@ TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'createrepo-c-
TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
TESTIMAGELOCK_qemuall = ""
TESTIMAGE_DUMP_DIR ?= "/tmp/oe-saved-tests/"
TESTIMAGE_DUMP_DIR ?= "${LOG_DIR}/runtime-hostdump/"
TESTIMAGE_UPDATE_VARS ?= "DL_DIR WORKDIR DEPLOY_DIR"
@@ -132,6 +121,30 @@ def testimage_sanity(d):
bb.fatal('When TEST_TARGET is set to "simpleremote" '
'TEST_TARGET_IP and TEST_SERVER_IP are needed too.')
def get_testimage_configuration(d, test_type, machine):
import platform
from oeqa.utils.metadata import get_layers
configuration = {'TEST_TYPE': test_type,
'MACHINE': machine,
'DISTRO': d.getVar("DISTRO"),
'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
'STARTTIME': d.getVar("DATETIME"),
'HOST_DISTRO': oe.lsb.distro_identifier().replace(' ', '-'),
'LAYERS': get_layers(d.getVar("BBLAYERS"))}
return configuration
get_testimage_configuration[vardepsexclude] = "DATETIME"
def get_testimage_json_result_dir(d):
json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
if custom_json_result_dir:
json_result_dir = custom_json_result_dir
return json_result_dir
def get_testimage_result_id(configuration):
return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['MACHINE'], configuration['STARTTIME'])
def testimage_main(d):
import os
import json
@@ -185,12 +198,13 @@ def testimage_main(d):
machine = d.getVar("MACHINE")
# Get rootfs
fstypes = [fs for fs in d.getVar('IMAGE_FSTYPES').split(' ')
if fs in supported_fstypes]
if not fstypes:
bb.fatal('Unsupported image type built. Add a comptible image to '
'IMAGE_FSTYPES. Supported types: %s' %
', '.join(supported_fstypes))
fstypes = d.getVar('IMAGE_FSTYPES').split()
if d.getVar("TEST_TARGET") == "qemu":
fstypes = [fs for fs in fstypes if fs in supported_fstypes]
if not fstypes:
bb.fatal('Unsupported image type built. Add a comptible image to '
'IMAGE_FSTYPES. Supported types: %s' %
', '.join(supported_fstypes))
rootfs = '%s.%s' % (image_name, fstypes[0])
# Get tmpdir (not really used, just for compatibility)
@@ -214,13 +228,11 @@ def testimage_main(d):
boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT"))
# Get use_kvm
qemu_use_kvm = d.getVar("QEMU_USE_KVM")
if qemu_use_kvm and \
(oe.types.boolean(qemu_use_kvm) and 'x86' in machine or \
d.getVar('MACHINE') in qemu_use_kvm.split()):
kvm = True
else:
kvm = False
kvm = oe.types.qemu_use_kvm(d.getVar('QEMU_USE_KVM'), d.getVar('TARGET_ARCH'))
slirp = False
if d.getVar("QEMU_USE_SLIRP"):
slirp = True
# TODO: We use the current implementatin of qemu runner because of
# time constrains, qemu runner really needs a refactor too.
@@ -233,6 +245,8 @@ def testimage_main(d):
'boottime' : boottime,
'bootlog' : bootlog,
'kvm' : kvm,
'slirp' : slirp,
'dump_dir' : d.getVar("TESTIMAGE_DUMP_DIR"),
}
# TODO: Currently BBPATH is needed for custom loading of targets.
@@ -272,17 +286,12 @@ def testimage_main(d):
package_extraction(d, tc.suites)
bootparams = None
if d.getVar('VIRTUAL-RUNTIME_init_manager', '') == 'systemd':
# Add systemd.log_level=debug to enable systemd debug logging
bootparams = 'systemd.log_target=console'
results = None
orig_sigterm_handler = signal.signal(signal.SIGTERM, sigterm_exception)
try:
# We need to check if runqemu ends unexpectedly
# or if the worker send us a SIGTERM
tc.target.start(extra_bootparams=bootparams)
tc.target.start(params=d.getVar("TEST_QEMUPARAMS"))
results = tc.runTests()
except (RuntimeError, BlockingIOError) as err:
if isinstance(err, RuntimeError):
@@ -299,7 +308,10 @@ def testimage_main(d):
# Show results (if we have them)
if not results:
bb.fatal('%s - FAILED - tests were interrupted during execution' % pn, forcelog=True)
results.logDetails()
configuration = get_testimage_configuration(d, 'runtime', machine)
results.logDetails(get_testimage_json_result_dir(d),
configuration,
get_testimage_result_id(configuration))
results.logSummary(pn)
if not results.wasSuccessful():
bb.fatal('%s - FAILED - check the task log and the ssh log' % pn, forcelog=True)
@@ -336,6 +348,7 @@ def create_index(arg):
return None
def create_rpm_index(d):
import glob
# Index RPMs
rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo_c")
index_cmds = []
@@ -352,9 +365,13 @@ def create_rpm_index(d):
lf = bb.utils.lockfile(lockfilename, False)
oe.path.copyhardlinktree(rpm_dir, idx_path)
# Full indexes overload a 256MB image so reduce the number of rpms
# in the feed. Filter to r* since we use the run-postinst packages and
# this leaves some allarch and machine arch packages too.
bb.utils.remove(idx_path + "*/[a-qs-z]*.rpm")
# in the feed by filtering to specific packages needed by the tests.
package_list = glob.glob(idx_path + "*/*.rpm")
for pkg in package_list:
if not os.path.basename(pkg).startswith(("rpm", "run-postinsts", "busybox", "bash", "update-alternatives", "libc6", "curl", "musl")):
bb.utils.remove(pkg)
bb.utils.unlockfile(lf)
cmd = '%s --update -q %s' % (rpm_createrepo, idx_path)

View File

@@ -14,6 +14,30 @@
#
# where "<image-name>" is an image like core-image-sato.
def get_sdk_configuration(d, test_type):
import platform
from oeqa.utils.metadata import get_layers
configuration = {'TEST_TYPE': test_type,
'MACHINE': d.getVar("MACHINE"),
'SDKMACHINE': d.getVar("SDKMACHINE"),
'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
'STARTTIME': d.getVar("DATETIME"),
'HOST_DISTRO': oe.lsb.distro_identifier().replace(' ', '-'),
'LAYERS': get_layers(d.getVar("BBLAYERS"))}
return configuration
get_sdk_configuration[vardepsexclude] = "DATETIME"
def get_sdk_json_result_dir(d):
json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
if custom_json_result_dir:
json_result_dir = custom_json_result_dir
return json_result_dir
def get_sdk_result_id(configuration):
return '%s_%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDKMACHINE'], configuration['MACHINE'], configuration['STARTTIME'])
def testsdk_main(d):
import os
import subprocess
@@ -24,8 +48,6 @@ def testsdk_main(d):
from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor
from oeqa.utils import make_logger_bitbake_compatible
bb.event.enable_threadlock()
pn = d.getVar("PN")
logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
@@ -71,8 +93,10 @@ def testsdk_main(d):
component = "%s %s" % (pn, OESDKTestContextExecutor.name)
context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env))
result.logDetails()
configuration = get_sdk_configuration(d, 'sdk')
result.logDetails(get_sdk_json_result_dir(d),
configuration,
get_sdk_result_id(configuration))
result.logSummary(component, context_msg)
if not result.wasSuccessful():
@@ -99,8 +123,6 @@ def testsdkext_main(d):
from oeqa.utils import avoid_paths_in_environ, make_logger_bitbake_compatible, subprocesstweak
from oeqa.sdkext.context import OESDKExtTestContext, OESDKExtTestContextExecutor
bb.event.enable_threadlock()
pn = d.getVar("PN")
logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
@@ -176,8 +198,10 @@ def testsdkext_main(d):
component = "%s %s" % (pn, OESDKExtTestContextExecutor.name)
context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env))
result.logDetails()
configuration = get_sdk_configuration(d, 'sdkext')
result.logDetails(get_sdk_json_result_dir(d),
configuration,
get_sdk_result_id(configuration))
result.logSummary(component, context_msg)
if not result.wasSuccessful():

View File

@@ -2,6 +2,6 @@
# Default preferred versions
#
PREFERRED_VERSION_openssl = "1.0.%"
PREFERRED_VERSION_openssl-native = "1.0.%"
PREFERRED_VERSION_nativesdk-openssl = "1.0.%"
PREFERRED_VERSION_openssl ?= "1.0.%"
PREFERRED_VERSION_openssl-native ?= "1.0.%"
PREFERRED_VERSION_nativesdk-openssl ?= "1.0.%"

View File

@@ -6,9 +6,8 @@
# to the distro running on the build machine.
#
UNINATIVE_MAXGLIBCVERSION = "2.28"
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/2.3/"
UNINATIVE_CHECKSUM[i686] ?= "44253cddbf629082568cea4fff59419106871a0cf81b4845b5d34e7014887b20"
UNINATIVE_CHECKSUM[x86_64] ?= "c6954563dad3c95608117c6fc328099036c832bbd924ebf5fdccb622fc0a8684"
UNINATIVE_MAXGLIBCVERSION = "2.29"
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/2.4/"
UNINATIVE_CHECKSUM[i686] ?= "fafacfc537a6ce2bd122bd16c146881ab5ac69bd575abf6cb68a0dd33fa70ea2"
UNINATIVE_CHECKSUM[x86_64] ?= "06f91685b782f2ccfedf3070b3ba0fe4a5ba2f0766dad5c9d1642dccf95accd0"

View File

@@ -151,3 +151,27 @@ def path(value, relativeto='', normalize='true', mustexist='false'):
raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT)))
return value
def is_x86(arch):
"""
Check whether arch is x86 or x86_64
"""
if arch.startswith('x86_') or re.match('i.*86', arch):
return True
else:
return False
def qemu_use_kvm(kvm, target_arch):
"""
Enable kvm if target_arch == build_arch or both of them are x86 archs.
"""
use_kvm = False
if kvm and boolean(kvm):
build_arch = os.uname()[4]
if is_x86(build_arch) and is_x86(target_arch):
use_kvm = True
elif build_arch == target_arch:
use_kvm = True
return use_kvm

View File

@@ -27,7 +27,6 @@ class OETestContext(object):
self.logger = logger
self._registry = {}
self._registry['cases'] = collections.OrderedDict()
self._results = {}
def _read_modules_from_manifest(self, manifest):
if not os.path.exists(manifest):

View File

@@ -3,7 +3,6 @@
from unittest import SkipTest
from oeqa.core.threaded import OETestRunnerThreaded
from oeqa.core.exception import OEQADependency
from . import OETestDiscover, registerDecorator
@@ -64,16 +63,10 @@ def _order_test_case_by_depends(cases, depends):
return [cases[case_id] for case_id in cases_ordered]
def _skipTestDependency(case, depends):
if isinstance(case.tc.runner, OETestRunnerThreaded):
import threading
results = case.tc._results[threading.get_ident()]
else:
results = case.tc._results
skipReasons = ['errors', 'failures', 'skipped']
for reason in skipReasons:
for test, _ in results[reason]:
for test, _ in getattr(case.tc.results, reason):
if test.id() in depends:
raise SkipTest("Test case %s depends on %s and was in %s." \
% (case.id(), test.id(), reason))

View File

@@ -1,12 +1,8 @@
# Copyright (C) 2016 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
from . import OETestDecorator, registerDecorator
import signal
from threading import Timer
from oeqa.core.threaded import OETestRunnerThreaded
from . import OETestDecorator, registerDecorator
from oeqa.core.exception import OEQATimeoutError
@registerDecorator
@@ -14,32 +10,16 @@ class OETimeout(OETestDecorator):
attrs = ('oetimeout',)
def setUpDecorator(self):
self.logger.debug("Setting up a %d second(s) timeout" % self.oetimeout)
if isinstance(self.case.tc.runner, OETestRunnerThreaded):
self.timeouted = False
def _timeoutHandler():
self.timeouted = True
self.timer = Timer(self.oetimeout, _timeoutHandler)
self.timer.start()
else:
timeout = self.oetimeout
def _timeoutHandler(signum, frame):
raise OEQATimeoutError("Timed out after %s "
timeout = self.oetimeout
def _timeoutHandler(signum, frame):
raise OEQATimeoutError("Timed out after %s "
"seconds of execution" % timeout)
self.alarmSignal = signal.signal(signal.SIGALRM, _timeoutHandler)
signal.alarm(self.oetimeout)
self.logger.debug("Setting up a %d second(s) timeout" % self.oetimeout)
self.alarmSignal = signal.signal(signal.SIGALRM, _timeoutHandler)
signal.alarm(self.oetimeout)
def tearDownDecorator(self):
if isinstance(self.case.tc.runner, OETestRunnerThreaded):
self.timer.cancel()
self.logger.debug("Removed Timer handler")
if self.timeouted:
raise OEQATimeoutError("Timed out after %s "
"seconds of execution" % self.oetimeout)
else:
signal.alarm(0)
signal.signal(signal.SIGALRM, self.alarmSignal)
self.logger.debug("Removed SIGALRM handler")
signal.alarm(0)
signal.signal(signal.SIGALRM, self.alarmSignal)
self.logger.debug("Removed SIGALRM handler")

View File

@@ -24,7 +24,7 @@ from oeqa.core.decorator import decoratorClasses, OETestDecorator, \
# Generate the function definition because this differ across python versions
# Python >= 3.4.4 uses tree parameters instead four but for example Python 3.5.3
# ueses four parameters so isn't incremental.
_failed_test_args = inspect.getargspec(unittest.loader._make_failed_test).args
_failed_test_args = inspect.getfullargspec(unittest.loader._make_failed_test).args
exec("""def _make_failed_test(%s): raise exception""" % ', '.join(_failed_test_args))
unittest.loader._make_failed_test = _make_failed_test

View File

@@ -6,17 +6,10 @@ import time
import unittest
import logging
import re
import json
xmlEnabled = False
try:
import xmlrunner
from xmlrunner.result import _XMLTestResult as _TestResult
from xmlrunner.runner import XMLTestRunner as _TestRunner
xmlEnabled = True
except ImportError:
# use the base runner instead
from unittest import TextTestResult as _TestResult
from unittest import TextTestRunner as _TestRunner
from unittest import TextTestResult as _TestResult
from unittest import TextTestRunner as _TestRunner
class OEStreamLogger(object):
def __init__(self, logger):
@@ -42,8 +35,12 @@ class OETestResult(_TestResult):
def __init__(self, tc, *args, **kwargs):
super(OETestResult, self).__init__(*args, **kwargs)
self.successes = []
# Inject into tc so that TestDepends decorator can see results
tc.results = self
self.tc = tc
self._tc_map_results()
def startTest(self, test):
# Allow us to trigger the testcase buffer mode on a per test basis
@@ -53,12 +50,6 @@ class OETestResult(_TestResult):
self.buffer = test.buffer
super(OETestResult, self).startTest(test)
def _tc_map_results(self):
self.tc._results['failures'] = self.failures
self.tc._results['errors'] = self.errors
self.tc._results['skipped'] = self.skipped
self.tc._results['expectedFailures'] = self.expectedFailures
def logSummary(self, component, context_msg=''):
elapsed_time = self.tc._run_end_time - self.tc._run_start_time
self.tc.logger.info("SUMMARY:")
@@ -70,67 +61,60 @@ class OETestResult(_TestResult):
msg = "%s - OK - All required tests passed" % component
else:
msg = "%s - FAIL - Required tests failed" % component
skipped = len(self.tc._results['skipped'])
if skipped:
msg += " (skipped=%d)" % skipped
msg += " (successes=%d, skipped=%d, failures=%d, errors=%d)" % (len(self.successes), len(self.skipped), len(self.failures), len(self.errors))
self.tc.logger.info(msg)
def _getDetailsNotPassed(self, case, type, desc):
found = False
def _getTestResultDetails(self, case):
result_types = {'failures': 'FAILED', 'errors': 'ERROR', 'skipped': 'SKIPPED',
'expectedFailures': 'EXPECTEDFAIL', 'successes': 'PASSED'}
for (scase, msg) in self.tc._results[type]:
# XXX: When XML reporting is enabled scase is
# xmlrunner.result._TestInfo instance instead of
# string.
if xmlEnabled:
if case.id() == scase.test_id:
for rtype in result_types:
found = False
for (scase, msg) in getattr(self, rtype):
if case.id() == scase.id():
found = True
break
scase_str = scase.test_id
else:
if case == scase:
found = True
break
scase_str = str(scase)
scase_str = str(scase.id())
# When fails at module or class level the class name is passed as string
# so figure out to see if match
m = re.search("^setUpModule \((?P<module_name>.*)\)$", scase_str)
if m:
if case.__class__.__module__ == m.group('module_name'):
found = True
break
# When fails at module or class level the class name is passed as string
# so figure out to see if match
m = re.search("^setUpModule \((?P<module_name>.*)\)$", scase_str)
if m:
if case.__class__.__module__ == m.group('module_name'):
found = True
break
m = re.search("^setUpClass \((?P<class_name>.*)\)$", scase_str)
if m:
class_name = "%s.%s" % (case.__class__.__module__,
case.__class__.__name__)
m = re.search("^setUpClass \((?P<class_name>.*)\)$", scase_str)
if m:
class_name = "%s.%s" % (case.__class__.__module__,
case.__class__.__name__)
if class_name == m.group('class_name'):
found = True
break
if class_name == m.group('class_name'):
found = True
break
if found:
return (found, msg)
if found:
return result_types[rtype], msg
return (found, None)
return 'UNKNOWN', None
def logDetails(self):
def addSuccess(self, test):
#Added so we can keep track of successes too
self.successes.append((test, None))
super(OETestResult, self).addSuccess(test)
def logDetails(self, json_file_dir=None, configuration=None, result_id=None):
self.tc.logger.info("RESULTS:")
result = {}
logs = {}
if hasattr(self.tc, "extraresults"):
result = self.tc.extraresults
for case_name in self.tc._registry['cases']:
case = self.tc._registry['cases'][case_name]
result_types = ['failures', 'errors', 'skipped', 'expectedFailures']
result_desc = ['FAILED', 'ERROR', 'SKIPPED', 'EXPECTEDFAIL']
fail = False
desc = None
for idx, name in enumerate(result_types):
(fail, msg) = self._getDetailsNotPassed(case, result_types[idx],
result_desc[idx])
if fail:
desc = result_desc[idx]
break
(status, log) = self._getTestResultDetails(case)
oeid = -1
if hasattr(case, 'decorators'):
@@ -138,12 +122,27 @@ class OETestResult(_TestResult):
if hasattr(d, 'oeid'):
oeid = d.oeid
if fail:
self.tc.logger.info("RESULTS - %s - Testcase %s: %s" % (case.id(),
oeid, desc))
if status not in logs:
logs[status] = []
logs[status].append("RESULTS - %s - Testcase %s: %s" % (case.id(), oeid, status))
if log:
result[case.id()] = {'status': status, 'log': log}
else:
self.tc.logger.info("RESULTS - %s - Testcase %s: %s" % (case.id(),
oeid, 'PASSED'))
result[case.id()] = {'status': status}
for i in ['PASSED', 'SKIPPED', 'EXPECTEDFAIL', 'ERROR', 'FAILED', 'UNKNOWN']:
if i not in logs:
continue
for l in logs[i]:
self.tc.logger.info(l)
if json_file_dir:
tresultjsonhelper = OETestResultJSONHelper()
tresultjsonhelper.dump_testresult_file(json_file_dir, configuration, result_id, result)
def wasSuccessful(self):
# Override as we unexpected successes aren't failures for us
return (len(self.failures) == len(self.errors) == 0)
class OEListTestsResult(object):
def wasSuccessful(self):
@@ -153,33 +152,14 @@ class OETestRunner(_TestRunner):
streamLoggerClass = OEStreamLogger
def __init__(self, tc, *args, **kwargs):
if xmlEnabled:
if not kwargs.get('output'):
kwargs['output'] = os.path.join(os.getcwd(),
'TestResults_%s_%s' % (time.strftime("%Y%m%d%H%M%S"), os.getpid()))
kwargs['stream'] = self.streamLoggerClass(tc.logger)
super(OETestRunner, self).__init__(*args, **kwargs)
self.tc = tc
self.resultclass = OETestResult
# XXX: The unittest-xml-reporting package defines _make_result method instead
# of _makeResult standard on unittest.
if xmlEnabled:
def _make_result(self):
"""
Creates a TestResult object which will be used to store
information about the executed tests.
"""
# override in subclasses if necessary.
return self.resultclass(self.tc,
self.stream, self.descriptions, self.verbosity, self.elapsed_times
)
else:
def _makeResult(self):
return self.resultclass(self.tc, self.stream, self.descriptions,
self.verbosity)
def _makeResult(self):
return self.resultclass(self.tc, self.stream, self.descriptions,
self.verbosity)
def _walk_suite(self, suite, func):
for obj in suite:
@@ -275,3 +255,29 @@ class OETestRunner(_TestRunner):
self._list_tests_module(suite)
return OEListTestsResult()
class OETestResultJSONHelper(object):
testresult_filename = 'testresults.json'
def _get_existing_testresults_if_available(self, write_dir):
testresults = {}
file = os.path.join(write_dir, self.testresult_filename)
if os.path.exists(file):
with open(file, "r") as f:
testresults = json.load(f)
return testresults
def _write_file(self, write_dir, file_name, file_content):
file_path = os.path.join(write_dir, file_name)
with open(file_path, 'w') as the_file:
the_file.write(file_content)
def dump_testresult_file(self, write_dir, configuration, result_id, test_result):
bb.utils.mkdirhier(write_dir)
lf = bb.utils.lockfile(os.path.join(write_dir, 'jsontestresult.lock'))
test_results = self._get_existing_testresults_if_available(write_dir)
test_results[result_id] = {'configuration': configuration, 'result': test_result}
json_testresults = json.dumps(test_results, sort_keys=True, indent=4)
self._write_file(write_dir, self.testresult_filename, json_testresults)
bb.utils.unlockfile(lf)

View File

@@ -12,15 +12,14 @@ from oeqa.utils.qemurunner import QemuRunner
supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic']
class OEQemuTarget(OESSHTarget):
def __init__(self, logger, ip, server_ip, timeout=300, user='root',
def __init__(self, logger, server_ip, timeout=300, user='root',
port=None, machine='', rootfs='', kernel='', kvm=False,
dump_dir='', dump_host_cmds='', display='', bootlog='',
tmpdir='', dir_image='', boottime=60, **kwargs):
super(OEQemuTarget, self).__init__(logger, ip, server_ip, timeout,
super(OEQemuTarget, self).__init__(logger, None, server_ip, timeout,
user, port)
self.ip = ip
self.server_ip = server_ip
self.machine = machine
self.rootfs = rootfs

View File

@@ -1,12 +0,0 @@
# Copyright (C) 2017 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
from oeqa.core.case import OETestCase
class ThreadedTest(OETestCase):
def test_threaded_no_depends(self):
self.assertTrue(True, msg='How is this possible?')
class ThreadedTest2(OETestCase):
def test_threaded_same_module(self):
self.assertTrue(True, msg='How is this possible?')

View File

@@ -1,8 +0,0 @@
# Copyright (C) 2017 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
from oeqa.core.case import OETestCase
class ThreadedTestAlone(OETestCase):
def test_threaded_alone(self):
self.assertTrue(True, msg='How is this possible?')

View File

@@ -1,10 +0,0 @@
# Copyright (C) 2017 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
from oeqa.core.case import OETestCase
from oeqa.core.decorator.depends import OETestDepends
class ThreadedTest3(OETestCase):
@OETestDepends(['threaded.ThreadedTest.test_threaded_no_depends'])
def test_threaded_depends(self):
self.assertTrue(True, msg='How is this possible?')

View File

@@ -1,12 +0,0 @@
# Copyright (C) 2017 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
from oeqa.core.case import OETestCase
class ThreadedTestModule(OETestCase):
def test_threaded_module(self):
self.assertTrue(True, msg='How is this possible?')
class ThreadedTestModule2(OETestCase):
def test_threaded_module2(self):
self.assertTrue(True, msg='How is this possible?')

View File

@@ -33,13 +33,3 @@ class TestBase(unittest.TestCase):
tc.loadTests(self.cases_path, modules=modules, tests=tests,
filters=filters)
return tc
def _testLoaderThreaded(self, d={}, modules=[],
tests=[], filters={}):
from oeqa.core.threaded import OETestContextThreaded
tc = OETestContextThreaded(d, self.logger)
tc.loadTests(self.cases_path, modules=modules, tests=tests,
filters=filters)
return tc

View File

@@ -21,7 +21,7 @@ class TestData(TestBase):
tc = self._testLoader(modules=self.modules)
self.assertEqual(False, tc.runTests().wasSuccessful())
for test, data in tc._results['errors']:
for test, data in tc.errors:
expect = False
if expectedException in data:
expect = True
@@ -34,7 +34,7 @@ class TestData(TestBase):
tc = self._testLoader(d=d, modules=self.modules)
self.assertEqual(False, tc.runTests().wasSuccessful())
for test, data in tc._results['failures']:
for test, data in tc.failures:
expect = False
if expectedError in data:
expect = True

View File

@@ -131,17 +131,5 @@ class TestTimeoutDecorator(TestBase):
msg = "OETestTimeout didn't restore SIGALRM"
self.assertIs(alarm_signal, signal.getsignal(signal.SIGALRM), msg=msg)
def test_timeout_thread(self):
tests = ['timeout.TimeoutTest.testTimeoutPass']
msg = 'Failed to run test using OETestTimeout'
tc = self._testLoaderThreaded(modules=self.modules, tests=tests)
self.assertTrue(tc.runTests().wasSuccessful(), msg=msg)
def test_timeout_threaded_fail(self):
tests = ['timeout.TimeoutTest.testTimeoutFail']
msg = "OETestTimeout test didn't timeout as expected"
tc = self._testLoaderThreaded(modules=self.modules, tests=tests)
self.assertFalse(tc.runTests().wasSuccessful(), msg=msg)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright (C) 2016-2017 Intel Corporation
# Copyright (C) 2016 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
import os
@@ -82,33 +82,5 @@ class TestLoader(TestBase):
msg = 'Expected modules from two different paths'
self.assertEqual(modules, expected_modules, msg=msg)
def test_loader_threaded(self):
cases_path = self.cases_path
self.cases_path = [os.path.join(self.cases_path, 'loader', 'threaded')]
tc = self._testLoaderThreaded()
self.assertEqual(len(tc.suites), 3, "Expected to be 3 suites")
case_ids = ['threaded.ThreadedTest.test_threaded_no_depends',
'threaded.ThreadedTest2.test_threaded_same_module',
'threaded_depends.ThreadedTest3.test_threaded_depends']
for case in tc.suites[0]._tests:
self.assertEqual(case.id(),
case_ids[tc.suites[0]._tests.index(case)])
case_ids = ['threaded_alone.ThreadedTestAlone.test_threaded_alone']
for case in tc.suites[1]._tests:
self.assertEqual(case.id(),
case_ids[tc.suites[1]._tests.index(case)])
case_ids = ['threaded_module.ThreadedTestModule.test_threaded_module',
'threaded_module.ThreadedTestModule2.test_threaded_module2']
for case in tc.suites[2]._tests:
self.assertEqual(case.id(),
case_ids[tc.suites[2]._tests.index(case)])
self.cases_path = cases_path
if __name__ == '__main__':
unittest.main()

View File

@@ -1,275 +0,0 @@
# Copyright (C) 2017 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
import threading
import multiprocessing
import queue
import time
from unittest.suite import TestSuite
from oeqa.core.loader import OETestLoader
from oeqa.core.runner import OEStreamLogger, OETestResult, OETestRunner
from oeqa.core.context import OETestContext
class OETestLoaderThreaded(OETestLoader):
def __init__(self, tc, module_paths, modules, tests, modules_required,
filters, process_num=0, *args, **kwargs):
super(OETestLoaderThreaded, self).__init__(tc, module_paths, modules,
tests, modules_required, filters, *args, **kwargs)
self.process_num = process_num
def discover(self):
suite = super(OETestLoaderThreaded, self).discover()
if self.process_num <= 0:
self.process_num = min(multiprocessing.cpu_count(),
len(suite._tests))
suites = []
for _ in range(self.process_num):
suites.append(self.suiteClass())
def _search_for_module_idx(suites, case):
"""
Cases in the same module needs to be run
in the same thread because PyUnit keeps track
of setUp{Module, Class,} and tearDown{Module, Class,}.
"""
for idx in range(self.process_num):
suite = suites[idx]
for c in suite._tests:
if case.__module__ == c.__module__:
return idx
return -1
def _search_for_depend_idx(suites, depends):
"""
Dependency cases needs to be run in the same
thread, because OEQA framework look at the state
of dependant test to figure out if skip or not.
"""
for idx in range(self.process_num):
suite = suites[idx]
for case in suite._tests:
if case.id() in depends:
return idx
return -1
def _get_best_idx(suites):
sizes = [len(suite._tests) for suite in suites]
return sizes.index(min(sizes))
def _fill_suites(suite):
idx = -1
for case in suite:
if isinstance(case, TestSuite):
_fill_suites(case)
else:
idx = _search_for_module_idx(suites, case)
depends = {}
if 'depends' in self.tc._registry:
depends = self.tc._registry['depends']
if idx == -1 and case.id() in depends:
case_depends = depends[case.id()]
idx = _search_for_depend_idx(suites, case_depends)
if idx == -1:
idx = _get_best_idx(suites)
suites[idx].addTest(case)
_fill_suites(suite)
suites_tmp = suites
suites = []
for suite in suites_tmp:
if len(suite._tests) > 0:
suites.append(suite)
return suites
class OEStreamLoggerThreaded(OEStreamLogger):
_lock = threading.Lock()
buffers = {}
def write(self, msg):
tid = threading.get_ident()
if not tid in self.buffers:
self.buffers[tid] = ""
if msg:
self.buffers[tid] += msg
def finish(self):
tid = threading.get_ident()
self._lock.acquire()
self.logger.info('THREAD: %d' % tid)
self.logger.info('-' * 70)
for line in self.buffers[tid].split('\n'):
self.logger.info(line)
self._lock.release()
class OETestResultThreadedInternal(OETestResult):
def _tc_map_results(self):
tid = threading.get_ident()
# PyUnit generates a result for every test module run, test
# if the thread already has an entry to avoid lose the previous
# test module results.
if not tid in self.tc._results:
self.tc._results[tid] = {}
self.tc._results[tid]['failures'] = self.failures
self.tc._results[tid]['errors'] = self.errors
self.tc._results[tid]['skipped'] = self.skipped
self.tc._results[tid]['expectedFailures'] = self.expectedFailures
class OETestResultThreaded(object):
_results = {}
_lock = threading.Lock()
def __init__(self, tc):
self.tc = tc
def _fill_tc_results(self):
tids = list(self.tc._results.keys())
fields = ['failures', 'errors', 'skipped', 'expectedFailures']
for tid in tids:
result = self.tc._results[tid]
for field in fields:
if not field in self.tc._results:
self.tc._results[field] = []
self.tc._results[field].extend(result[field])
def addResult(self, result, run_start_time, run_end_time):
tid = threading.get_ident()
self._lock.acquire()
self._results[tid] = {}
self._results[tid]['result'] = result
self._results[tid]['run_start_time'] = run_start_time
self._results[tid]['run_end_time'] = run_end_time
self._results[tid]['result'] = result
self._lock.release()
def wasSuccessful(self):
wasSuccessful = True
for tid in self._results.keys():
wasSuccessful = wasSuccessful and \
self._results[tid]['result'].wasSuccessful()
return wasSuccessful
def stop(self):
for tid in self._results.keys():
self._results[tid]['result'].stop()
def logSummary(self, component, context_msg=''):
elapsed_time = (self.tc._run_end_time - self.tc._run_start_time)
self.tc.logger.info("SUMMARY:")
self.tc.logger.info("%s (%s) - Ran %d tests in %.3fs" % (component,
context_msg, len(self.tc._registry['cases']), elapsed_time))
if self.wasSuccessful():
msg = "%s - OK - All required tests passed" % component
else:
msg = "%s - FAIL - Required tests failed" % component
self.tc.logger.info(msg)
def logDetails(self):
if list(self._results):
tid = list(self._results)[0]
result = self._results[tid]['result']
result.logDetails()
class _Worker(threading.Thread):
"""Thread executing tasks from a given tasks queue"""
def __init__(self, tasks, result, stream):
threading.Thread.__init__(self)
self.tasks = tasks
self.result = result
self.stream = stream
def run(self):
while True:
try:
func, args, kargs = self.tasks.get(block=False)
except queue.Empty:
break
try:
run_start_time = time.time()
rc = func(*args, **kargs)
run_end_time = time.time()
self.result.addResult(rc, run_start_time, run_end_time)
self.stream.finish()
except Exception as e:
print(e)
finally:
self.tasks.task_done()
class _ThreadedPool:
"""Pool of threads consuming tasks from a queue"""
def __init__(self, num_workers, num_tasks, stream=None, result=None):
self.tasks = queue.Queue(num_tasks)
self.workers = []
for _ in range(num_workers):
worker = _Worker(self.tasks, result, stream)
self.workers.append(worker)
def start(self):
for worker in self.workers:
worker.start()
def add_task(self, func, *args, **kargs):
"""Add a task to the queue"""
self.tasks.put((func, args, kargs))
def wait_completion(self):
"""Wait for completion of all the tasks in the queue"""
self.tasks.join()
for worker in self.workers:
worker.join()
class OETestRunnerThreaded(OETestRunner):
streamLoggerClass = OEStreamLoggerThreaded
def __init__(self, tc, *args, **kwargs):
super(OETestRunnerThreaded, self).__init__(tc, *args, **kwargs)
self.resultclass = OETestResultThreadedInternal # XXX: XML reporting overrides at __init__
def run(self, suites):
result = OETestResultThreaded(self.tc)
pool = _ThreadedPool(len(suites), len(suites), stream=self.stream,
result=result)
for s in suites:
pool.add_task(super(OETestRunnerThreaded, self).run, s)
pool.start()
pool.wait_completion()
result._fill_tc_results()
return result
class OETestContextThreaded(OETestContext):
loaderClass = OETestLoaderThreaded
runnerClass = OETestRunnerThreaded
def loadTests(self, module_paths, modules=[], tests=[],
modules_manifest="", modules_required=[], filters={}, process_num=0):
if modules_manifest:
modules = self._read_modules_from_manifest(modules_manifest)
self.loader = self.loaderClass(self, module_paths, modules, tests,
modules_required, filters, process_num)
self.suites = self.loader.discover()

View File

@@ -1,2 +0,0 @@
$a = 9.01e+21 - 9.01e+21 + 0.01;
print ("the value of a is ", $a, "\n");

View File

@@ -0,0 +1,40 @@
{
"runtime_core-image-minimal_qemuarm_20181225195701": {
"configuration": {
"DISTRO": "poky",
"HOST_DISTRO": "ubuntu-16.04",
"IMAGE_BASENAME": "core-image-minimal",
"IMAGE_PKGTYPE": "rpm",
"LAYERS": {
"meta": {
"branch": "master",
"commit": "801745d918e83f976c706f29669779f5b292ade3",
"commit_count": 52782
},
"meta-poky": {
"branch": "master",
"commit": "801745d918e83f976c706f29669779f5b292ade3",
"commit_count": 52782
},
"meta-yocto-bsp": {
"branch": "master",
"commit": "801745d918e83f976c706f29669779f5b292ade3",
"commit_count": 52782
}
},
"MACHINE": "qemuarm",
"STARTTIME": "20181225195701",
"TEST_TYPE": "runtime"
},
"result": {
"apt.AptRepoTest.test_apt_install_from_repo": {
"log": "Test requires apt to be installed",
"status": "PASSED"
},
"buildcpio.BuildCpioTest.test_cpio": {
"log": "Test requires autoconf to be installed",
"status": "ERROR"
}
}
}
}

View File

@@ -18,7 +18,7 @@ class AptRepoTest(AptTest):
@classmethod
def setUpClass(cls):
service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_DEB'], 'all')
cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip)
cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip, logger=cls.tc.logger)
cls.repo_server.start()
@classmethod

View File

@@ -1,7 +1,7 @@
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
from oeqa.runtime.utils.targetbuildproject import TargetBuildProject
@@ -13,17 +13,18 @@ class BuildCpioTest(OERuntimeTestCase):
cls.project = TargetBuildProject(cls.tc.target,
uri,
dl_dir = cls.tc.td['DL_DIR'])
cls.project.download_archive()
@classmethod
def tearDownClass(cls):
cls.project.clean()
@OETestID(205)
@skipIfNotFeature('tools-sdk',
'Test requires tools-sdk to be in IMAGE_FEATURES')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['gcc'])
@OEHasPackage(['make'])
@OEHasPackage(['autoconf'])
def test_cpio(self):
self.project.download_archive()
self.project.run_configure()
self.project.run_make()
self.project.run_install()

View File

@@ -1,7 +1,7 @@
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
from oeqa.runtime.utils.targetbuildproject import TargetBuildProject
@@ -13,16 +13,17 @@ class GalculatorTest(OERuntimeTestCase):
cls.project = TargetBuildProject(cls.tc.target,
uri,
dl_dir = cls.tc.td['DL_DIR'])
cls.project.download_archive()
@classmethod
def tearDownClass(cls):
cls.project.clean()
@OETestID(1526)
@skipIfNotFeature('tools-sdk',
'Test requires tools-sdk to be in IMAGE_FEATURES')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['gcc'])
@OEHasPackage(['make'])
@OEHasPackage(['autoconf'])
def test_galculator(self):
self.project.download_archive()
self.project.run_configure()
self.project.run_make()

View File

@@ -1,7 +1,7 @@
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
from oeqa.runtime.utils.targetbuildproject import TargetBuildProject
@@ -14,21 +14,19 @@ class BuildLzipTest(OERuntimeTestCase):
cls.project = TargetBuildProject(cls.tc.target,
uri,
dl_dir = cls.tc.td['DL_DIR'])
cls.project.download_archive()
@classmethod
def tearDownClass(cls):
cls.project.clean()
@OETestID(206)
@skipIfNotFeature('tools-sdk',
'Test requires tools-sdk to be in IMAGE_FEATURES')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['gcc'])
@OEHasPackage(['make'])
@OEHasPackage(['autoconf'])
def test_lzip(self):
self.project.download_archive()
self.project.run_configure()
self.project.run_make()
self.project.run_install()
@classmethod
def tearDownClass(self):
self.project.clean()

View File

@@ -3,6 +3,7 @@ import re
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.runtime.decorator.package import OEHasPackage
class DateTest(OERuntimeTestCase):
@@ -18,6 +19,7 @@ class DateTest(OERuntimeTestCase):
@OETestID(211)
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['coreutils', 'busybox'])
def test_date(self):
(status, output) = self.target.run('date +"%Y-%m-%d %T"')
msg = 'Failed to get initial date, output: %s' % output

View File

@@ -1,11 +1,13 @@
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.runtime.decorator.package import OEHasPackage
class DfTest(OERuntimeTestCase):
@OETestID(234)
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['coreutils', 'busybox'])
def test_df(self):
cmd = "df / | sed -n '2p' | awk '{print $4}'"
(status,output) = self.target.run(cmd)

View File

@@ -55,7 +55,7 @@ class DnfRepoTest(DnfTest):
@classmethod
def setUpClass(cls):
cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-testimage-repo'),
cls.tc.target.server_ip)
cls.tc.target.server_ip, logger=cls.tc.logger)
cls.repo_server.start()
@classmethod
@@ -67,7 +67,8 @@ class DnfRepoTest(DnfTest):
deploy_url = 'http://%s:%s/' %(self.target.server_ip, self.repo_server.port)
cmdlinerepoopts = ["--repofrompath=oe-testimage-repo-%s,%s%s" %(arch, deploy_url, arch) for arch in pkgarchs]
self.dnf(" ".join(cmdlinerepoopts) + " --nogpgcheck " + command)
output = self.dnf(" ".join(cmdlinerepoopts) + " --nogpgcheck " + command)
return output
@OETestDepends(['dnf.DnfBasicTest.test_dnf_help'])
@OETestID(1744)
@@ -88,6 +89,9 @@ class DnfRepoTest(DnfTest):
@OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache'])
@OETestID(1740)
def test_dnf_install(self):
output = self.dnf_with_repo('list run-postinsts-dev')
if 'Installed Packages' in output:
self.dnf_with_repo('remove -y run-postinsts-dev')
self.dnf_with_repo('install -y run-postinsts-dev')
@OETestDepends(['dnf.DnfRepoTest.test_dnf_install'])
@@ -120,4 +124,44 @@ class DnfRepoTest(DnfTest):
def test_dnf_reinstall(self):
self.dnf_with_repo('reinstall -y run-postinsts-dev')
@OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache'])
@OETestID(1771)
def test_dnf_installroot(self):
rootpath = '/home/root/chroot/test'
#Copy necessary files to avoid errors with not yet installed tools on
#installroot directory.
self.target.run('mkdir -p %s/etc' % rootpath, 1500)
self.target.run('mkdir -p %s/bin %s/sbin %s/usr/bin %s/usr/sbin' % (rootpath, rootpath, rootpath, rootpath), 1500)
self.target.run('mkdir -p %s/dev' % rootpath, 1500)
#Handle different architectures lib dirs
self.target.run('mkdir -p %s/lib' % rootpath, 1500)
self.target.run('mkdir -p %s/libx32' % rootpath, 1500)
self.target.run('mkdir -p %s/lib64' % rootpath, 1500)
self.target.run('cp /lib/libtinfo.so.5 %s/lib' % rootpath, 1500)
self.target.run('cp /libx32/libtinfo.so.5 %s/libx32' % rootpath, 1500)
self.target.run('cp /lib64/libtinfo.so.5 %s/lib64' % rootpath, 1500)
self.target.run('cp -r /etc/rpm %s/etc' % rootpath, 1500)
self.target.run('cp -r /etc/dnf %s/etc' % rootpath, 1500)
self.target.run('cp /bin/sh %s/bin' % rootpath, 1500)
self.target.run('mount -o bind /dev %s/dev/' % rootpath, 1500)
self.dnf_with_repo('install --installroot=%s -v -y --rpmverbosity=debug busybox run-postinsts' % rootpath)
status, output = self.target.run('test -e %s/var/cache/dnf' % rootpath, 1500)
self.assertEqual(0, status, output)
status, output = self.target.run('test -e %s/bin/busybox' % rootpath, 1500)
self.assertEqual(0, status, output)
@OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache'])
@OETestID(1772)
def test_dnf_exclude(self):
excludepkg = 'curl-dev'
self.dnf_with_repo('install -y curl*')
self.dnf('list %s' % excludepkg, 0)
#Avoid remove dependencies to skip some errors on different archs and images
self.dnf_with_repo('remove --setopt=clean_requirements_on_remove=0 -y curl*')
#check curl-dev is not installed adter removing all curl occurrences
status, output = self.target.run('dnf list --installed | grep %s'% excludepkg, 1500)
self.assertEqual(1, status, "%s was not removed, is listed as installed"%excludepkg)
self.dnf_with_repo('install -y --exclude=%s --exclude=curl-staticdev curl*' % excludepkg)
#check curl-dev is not installed after being excluded
status, output = self.target.run('dnf list --installed | grep %s'% excludepkg , 1500)
self.assertEqual(1, status, "%s was not excluded, is listed as installed"%excludepkg)

View File

@@ -3,12 +3,12 @@ import os
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
class GccCompileTest(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
def setUp(cls):
dst = '/tmp/'
src = os.path.join(cls.tc.files_dir, 'test.c')
cls.tc.target.copyTo(src, dst)
@@ -20,14 +20,13 @@ class GccCompileTest(OERuntimeTestCase):
cls.tc.target.copyTo(src, dst)
@classmethod
def tearDownClass(cls):
def tearDown(cls):
files = '/tmp/test.c /tmp/test.o /tmp/test /tmp/testmakefile'
cls.tc.target.run('rm %s' % files)
@OETestID(203)
@skipIfNotFeature('tools-sdk',
'Test requires tools-sdk to be in IMAGE_FEATURES')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['gcc'])
def test_gcc_compile(self):
status, output = self.target.run('gcc /tmp/test.c -o /tmp/test -lm')
msg = 'gcc compile failed, output: %s' % output
@@ -38,9 +37,8 @@ class GccCompileTest(OERuntimeTestCase):
self.assertEqual(status, 0, msg=msg)
@OETestID(200)
@skipIfNotFeature('tools-sdk',
'Test requires tools-sdk to be in IMAGE_FEATURES')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['g++'])
def test_gpp_compile(self):
status, output = self.target.run('g++ /tmp/test.c -o /tmp/test -lm')
msg = 'g++ compile failed, output: %s' % output
@@ -51,9 +49,8 @@ class GccCompileTest(OERuntimeTestCase):
self.assertEqual(status, 0, msg=msg)
@OETestID(1142)
@skipIfNotFeature('tools-sdk',
'Test requires tools-sdk to be in IMAGE_FEATURES')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['g++'])
def test_gpp2_compile(self):
status, output = self.target.run('g++ /tmp/test.cpp -o /tmp/test -lm')
msg = 'g++ compile failed, output: %s' % output
@@ -64,9 +61,9 @@ class GccCompileTest(OERuntimeTestCase):
self.assertEqual(status, 0, msg=msg)
@OETestID(204)
@skipIfNotFeature('tools-sdk',
'Test requires tools-sdk to be in IMAGE_FEATURES')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['gcc'])
@OEHasPackage(['make'])
def test_make(self):
status, output = self.target.run('cd /tmp; make -f testmakefile')
msg = 'running make failed, output %s' % output

View File

@@ -4,11 +4,12 @@ from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
class KernelModuleTest(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
def setUp(cls):
src = os.path.join(cls.tc.runtime_files_dir, 'hellomod.c')
dst = '/tmp/hellomod.c'
cls.tc.target.copyTo(src, dst)
@@ -18,7 +19,7 @@ class KernelModuleTest(OERuntimeTestCase):
cls.tc.target.copyTo(src, dst)
@classmethod
def tearDownClass(cls):
def tearDown(cls):
files = '/tmp/Makefile /tmp/hellomod.c'
cls.tc.target.run('rm %s' % files)
@@ -26,6 +27,9 @@ class KernelModuleTest(OERuntimeTestCase):
@skipIfNotFeature('tools-sdk',
'Test requires tools-sdk to be in IMAGE_FEATURES')
@OETestDepends(['gcc.GccCompileTest.test_gcc_compile'])
@OEHasPackage(['kernel-devsrc'])
@OEHasPackage(['make'])
@OEHasPackage(['gcc'])
def test_kernel_module(self):
cmds = [
'cd /usr/src/kernel && make scripts prepare',

View File

@@ -8,9 +8,13 @@ from oeqa.runtime.decorator.package import OEHasPackage
class LogrotateTest(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
cls.tc.target.run('cp /etc/logrotate.d/wtmp $HOME/wtmp.oeqabak')
@classmethod
def tearDownClass(cls):
cls.tc.target.run('rm -rf $HOME/logrotate_dir')
cls.tc.target.run('mv -f $HOME/wtmp.oeqabak /etc/logrotate.d/wtmp && rm -rf $HOME/logrotate_dir')
@OETestID(1544)
@OETestDepends(['ssh.SSHTest.test_ssh'])

View File

@@ -16,13 +16,13 @@ class OpkgTest(OERuntimeTestCase):
class OpkgRepoTest(OpkgTest):
@classmethod
def setUpClass(cls):
def setUp(cls):
service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_IPK'], 'all')
cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip)
cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip, logger=cls.tc.logger)
cls.repo_server.start()
@classmethod
def tearDownClass(cls):
def tearDown(cls):
cls.repo_server.stop()
def setup_source_config_for_package_install(self):

View File

@@ -6,32 +6,10 @@ from oeqa.core.decorator.oeid import OETestID
from oeqa.runtime.decorator.package import OEHasPackage
class PerlTest(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
src = os.path.join(cls.tc.files_dir, 'test.pl')
dst = '/tmp/test.pl'
cls.tc.target.copyTo(src, dst)
@classmethod
def tearDownClass(cls):
dst = '/tmp/test.pl'
cls.tc.target.run('rm %s' % dst)
@OETestID(1141)
@OETestID(208)
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['perl'])
def test_perl_exists(self):
status, output = self.target.run('which perl')
msg = 'Perl binary not in PATH or not on target.'
self.assertEqual(status, 0, msg=msg)
@OETestID(208)
@OETestDepends(['perl.PerlTest.test_perl_exists'])
def test_perl_works(self):
status, output = self.target.run('perl /tmp/test.pl')
msg = 'Exit status was not 0. Output: %s' % output
self.assertEqual(status, 0, msg=msg)
msg = 'Incorrect output: %s' % output
self.assertEqual(output, "the value of a is 0.01", msg=msg)
status, output = self.target.run("perl -e '$_=\"Uryyb, jbeyq\"; tr/a-zA-Z/n-za-mN-ZA-M/;print'")
self.assertEqual(status, 0)
self.assertEqual(output, "Hello, world")

View File

@@ -1,7 +1,11 @@
import unittest
import pprint
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
from oeqa.utils.logparser import Lparser, Result
class PtestRunnerTest(OERuntimeTestCase):
@@ -49,6 +53,8 @@ class PtestRunnerTest(OERuntimeTestCase):
@OETestID(1600)
@skipIfNotFeature('ptest', 'Test requires ptest to be in DISTRO_FEATURES')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['ptest-runner'])
@unittest.expectedFailure
def test_ptestrunner(self):
status, output = self.target.run('which ptest-runner', 0)
if status != 0:
@@ -76,6 +82,11 @@ class PtestRunnerTest(OERuntimeTestCase):
# status != 0 is OK since some ptest tests may fail
self.assertTrue(status != 127, msg="Cannot execute ptest-runner!")
if not hasattr(self.tc, "extraresults"):
self.tc.extraresults = {}
extras = self.tc.extraresults
extras['ptestresult.rawlogs'] = {'log': output}
# Parse and save results
parse_result = self.parse_ptest(ptest_runner_log)
parse_result.log_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip'])
@@ -84,10 +95,18 @@ class PtestRunnerTest(OERuntimeTestCase):
os.remove(ptest_log_dir_link)
os.symlink(os.path.basename(ptest_log_dir), ptest_log_dir_link)
trans = str.maketrans("()", "__")
resmap = {'pass': 'PASSED', 'skip': 'SKIPPED', 'fail': 'FAILED'}
for section in parse_result.result_dict:
for test, result in parse_result.result_dict[section]:
testname = "ptestresult." + section + "." + "_".join(test.translate(trans).split())
extras[testname] = {'status': resmap[result]}
failed_tests = {}
for section in parse_result.result_dict:
failed_testcases = [ test for test, result in parse_result.result_dict[section] if result == 'fail' ]
failed_testcases = [ "_".join(test.translate(trans).split()) for test, result in parse_result.result_dict[section] if result == 'fail' ]
if failed_testcases:
failed_tests[section] = failed_testcases
self.assertFalse(failed_tests, msg = "Failed ptests: %s" %(str(failed_tests)))
if failed_tests:
self.fail("Failed ptests:\n%s" % pprint.pformat(failed_tests))

View File

@@ -1,43 +1,17 @@
import os
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.runtime.decorator.package import OEHasPackage
class PythonTest(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
src = os.path.join(cls.tc.files_dir, 'test.py')
dst = '/tmp/test.py'
cls.tc.target.copyTo(src, dst)
@classmethod
def tearDownClass(cls):
dst = '/tmp/test.py'
cls.tc.target.run('rm %s' % dst)
@OETestID(1145)
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['python-core'])
def test_python_exists(self):
status, output = self.target.run('which python')
msg = 'Python binary not in PATH or not on target.'
self.assertEqual(status, 0, msg=msg)
@OETestID(965)
@OETestDepends(['python.PythonTest.test_python_exists'])
def test_python_stdout(self):
status, output = self.target.run('python /tmp/test.py')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['python3-core'])
def test_python3(self):
cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\""
status, output = self.target.run(cmd)
msg = 'Exit status was not 0. Output: %s' % output
self.assertEqual(status, 0, msg=msg)
msg = 'Incorrect output: %s' % output
self.assertEqual(output, "the value of a is 0.01", msg=msg)
@OETestID(1146)
@OETestDepends(['python.PythonTest.test_python_stdout'])
def test_python_testfile(self):
status, output = self.target.run('ls /tmp/testfile.python')
self.assertEqual(status, 0, msg='Python test file generate failed.')
self.assertEqual(output, "Hello, world", msg=msg)

View File

@@ -10,11 +10,6 @@ from oeqa.core.utils.path import findFile
class RpmBasicTest(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
if cls.tc.td['PACKAGE_CLASSES'].split()[0] != 'package_rpm':
cls.skipTest('Tests require image to be build from rpm')
@OETestID(960)
@OEHasPackage(['rpm'])
@OETestDepends(['ssh.SSHTest.test_ssh'])
@@ -26,6 +21,9 @@ class RpmBasicTest(OERuntimeTestCase):
@OETestID(191)
@OETestDepends(['rpm.RpmBasicTest.test_rpm_help'])
def test_rpm_query(self):
status, output = self.target.run('ls /var/lib/rpm/')
if status != 0:
self.skipTest('No /var/lib/rpm on target')
status, output = self.target.run('rpm -q rpm')
msg = 'status and output: %s and %s' % (status, output)
self.assertEqual(status, 0, msg=msg)
@@ -34,36 +32,31 @@ class RpmInstallRemoveTest(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
if cls.tc.td['PACKAGE_CLASSES'].split()[0] != 'package_rpm':
cls.skipTest('Tests require image to be build from rpm')
pkgarch = cls.td['TUNE_PKGARCH'].replace('-', '_')
rpmdir = os.path.join(cls.tc.td['DEPLOY_DIR'], 'rpm', pkgarch)
# Pick rpm-doc as a test file to get installed, because it's small
# Pick base-passwd-doc as a test file to get installed, because it's small
# and it will always be built for standard targets
rpm_doc = 'rpm-doc-*.%s.rpm' % pkgarch
rpm_doc = 'base-passwd-doc-*.%s.rpm' % pkgarch
if not os.path.exists(rpmdir):
return
for f in fnmatch.filter(os.listdir(rpmdir), rpm_doc):
test_file = os.path.join(rpmdir, f)
dst = '/tmp/rpm-doc.rpm'
cls.tc.target.copyTo(test_file, dst)
@classmethod
def tearDownClass(cls):
dst = '/tmp/rpm-doc.rpm'
cls.tc.target.run('rm -f %s' % dst)
cls.test_file = os.path.join(rpmdir, f)
cls.dst = '/tmp/base-passwd-doc.rpm'
@OETestID(192)
@OETestDepends(['rpm.RpmBasicTest.test_rpm_help'])
@OETestDepends(['rpm.RpmBasicTest.test_rpm_query'])
def test_rpm_install(self):
status, output = self.target.run('rpm -ivh /tmp/rpm-doc.rpm')
msg = 'Failed to install rpm-doc package: %s' % output
self.tc.target.copyTo(self.test_file, self.dst)
status, output = self.target.run('rpm -ivh /tmp/base-passwd-doc.rpm')
msg = 'Failed to install base-passwd-doc package: %s' % output
self.assertEqual(status, 0, msg=msg)
self.tc.target.run('rm -f %s' % self.dst)
@OETestID(194)
@OETestDepends(['rpm.RpmInstallRemoveTest.test_rpm_install'])
def test_rpm_remove(self):
status,output = self.target.run('rpm -e rpm-doc')
msg = 'Failed to remove rpm-doc package: %s' % output
status,output = self.target.run('rpm -e base-passwd-doc')
msg = 'Failed to remove base-passwd-doc package: %s' % output
self.assertEqual(status, 0, msg=msg)
@OETestID(1096)
@@ -107,7 +100,7 @@ class RpmInstallRemoveTest(OERuntimeTestCase):
Expected: There should be some RPM prefixed entries in the above file.
Product: BSPs
Author: Alexandru Georgescu <alexandru.c.georgescu@intel.com>
Author: Alexander Kanavin <alexander.kanavin@intel.com>
Author: Alexander Kanavin <alex.kanavin@gmail.com>
AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
"""
db_files_cmd = 'ls /var/lib/rpm/__db.*'
@@ -118,19 +111,23 @@ class RpmInstallRemoveTest(OERuntimeTestCase):
msg = 'Failed to find database files under /var/lib/rpm/ as __db.xxx'
self.assertEqual(0, status, msg=msg)
self.tc.target.copyTo(self.test_file, self.dst)
# Remove the package just in case
self.target.run('rpm -e rpm-doc')
self.target.run('rpm -e base-passwd-doc')
# Install/Remove a package 10 times
for i in range(10):
status, output = self.target.run('rpm -ivh /tmp/rpm-doc.rpm')
msg = 'Failed to install rpm-doc package. Reason: {}'.format(output)
status, output = self.target.run('rpm -ivh /tmp/base-passwd-doc.rpm')
msg = 'Failed to install base-passwd-doc package. Reason: {}'.format(output)
self.assertEqual(0, status, msg=msg)
status, output = self.target.run('rpm -e rpm-doc')
msg = 'Failed to remove rpm-doc package. Reason: {}'.format(output)
status, output = self.target.run('rpm -e base-passwd-doc')
msg = 'Failed to remove base-passwd-doc package. Reason: {}'.format(output)
self.assertEqual(0, status, msg=msg)
self.tc.target.run('rm -f %s' % self.dst)
# if using systemd this should ensure all entries are flushed to /var
status, output = self.target.run("journalctl --sync")
# Get the amount of entries in the log file

View File

@@ -4,6 +4,7 @@ from tempfile import mkstemp
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.runtime.decorator.package import OEHasPackage
class ScpTest(OERuntimeTestCase):
@@ -20,6 +21,7 @@ class ScpTest(OERuntimeTestCase):
@OETestID(220)
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['openssh-scp', 'dropbear'])
def test_scp_file(self):
dst = '/tmp/test_scp_file'

View File

@@ -1,11 +1,13 @@
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.runtime.decorator.package import OEHasPackage
class SSHTest(OERuntimeTestCase):
@OETestID(224)
@OETestDepends(['ping.PingTest.test_ping'])
@OEHasPackage(['dropbear', 'openssh-sshd'])
def test_ssh(self):
(status, output) = self.target.run('uname -a')
self.assertEqual(status, 0, msg='SSH Test failed: %s' % output)

View File

@@ -4,17 +4,18 @@ from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
class StapTest(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
def setUp(cls):
src = os.path.join(cls.tc.runtime_files_dir, 'hello.stp')
dst = '/tmp/hello.stp'
cls.tc.target.copyTo(src, dst)
@classmethod
def tearDownClass(cls):
def tearDown(cls):
files = '/tmp/hello.stp'
cls.tc.target.run('rm %s' % files)
@@ -22,6 +23,7 @@ class StapTest(OERuntimeTestCase):
@skipIfNotFeature('tools-profile',
'Test requires tools-profile to be in IMAGE_FEATURES')
@OETestDepends(['kernelmodule.KernelModuleTest.test_kernel_module'])
@OEHasPackage(['systemtap'])
def test_stap(self):
cmds = [
'cd /usr/src/kernel && make scripts prepare',

View File

@@ -2,6 +2,7 @@ from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.oeid import OETestID
from oeqa.core.decorator.data import skipIfNotFeature
from oeqa.runtime.decorator.package import OEHasPackage
class XorgTest(OERuntimeTestCase):
@@ -9,6 +10,7 @@ class XorgTest(OERuntimeTestCase):
@skipIfNotFeature('x11-base',
'Test requires x11 to be in IMAGE_FEATURES')
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['xserver-nodm-init'])
def test_xorg_running(self):
cmd ='%s | grep -v xinit | grep [X]org' % self.tc.target_cmds['ps']
status, output = self.target.run(cmd)

View File

@@ -49,7 +49,6 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
default_manifest = 'data/manifest'
default_server_ip = '192.168.7.1'
default_target_ip = '192.168.7.2'
default_host_dumper_dir = '/tmp/oe-saved-tests'
default_extract_dir = 'packages/extracted'
def register_commands(self, logger, subparsers):
@@ -71,9 +70,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
% self.default_server_ip)
runtime_group.add_argument('--host-dumper-dir', action='store',
default=self.default_host_dumper_dir,
help="Directory where host status is dumped, if tests fails, default: %s" \
% self.default_host_dumper_dir)
help="Directory where host status is dumped, if tests fails")
runtime_group.add_argument('--packages-manifest', action='store',
default=self.default_manifest,
@@ -101,7 +98,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
if target_type == 'simpleremote':
target = OESSHTarget(logger, target_ip, server_ip, **kwargs)
elif target_type == 'qemu':
target = OEQemuTarget(logger, target_ip, server_ip, **kwargs)
target = OEQemuTarget(logger, server_ip, **kwargs)
else:
# XXX: This code uses the old naming convention for controllers and
# targets, the idea it is to leave just targets as the controller

View File

@@ -1,8 +1,4 @@
import os
import shutil
import unittest
from oeqa.core.utils.path import remove_safe
from oeqa.sdk.case import OESDKTestCase
class PerlTest(OESDKTestCase):
@@ -12,17 +8,10 @@ class PerlTest(OESDKTestCase):
self.tc.hasHostPackage("perl-native")):
raise unittest.SkipTest("No perl package in the SDK")
for f in ['test.pl']:
shutil.copyfile(os.path.join(self.tc.files_dir, f),
os.path.join(self.tc.sdk_dir, f))
self.testfile = os.path.join(self.tc.sdk_dir, "test.pl")
def test_perl_exists(self):
self._run('which perl')
def test_perl_works(self):
self._run('perl %s' % self.testfile)
@classmethod
def tearDownClass(self):
remove_safe(self.testfile)
def test_perl(self):
try:
cmd = "perl -e '$_=\"Uryyb, jbeyq\"; tr/a-zA-Z/n-za-mN-ZA-M/;print'"
output = self._run(cmd)
self.assertEqual(output, "Hello, world")
except subprocess.CalledProcessError as e:
self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output))

View File

@@ -6,10 +6,9 @@ import sys
import glob
import re
from oeqa.core.context import OETestContextExecutor
from oeqa.core.threaded import OETestContextThreaded
from oeqa.core.context import OETestContext, OETestContextExecutor
class OESDKTestContext(OETestContextThreaded):
class OESDKTestContext(OETestContext):
sdk_files_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "files")
def __init__(self, td=None, logger=None, sdk_dir=None, sdk_env=None,

View File

@@ -12,6 +12,8 @@ import oeqa.utils.ftools as ftools
from oeqa.utils.commands import runCmd, bitbake, get_bb_var
from oeqa.core.case import OETestCase
import bb.utils
class OESelftestTestCase(OETestCase):
def __init__(self, methodName="runTest"):
self._extra_tear_down_commands = []
@@ -167,7 +169,7 @@ to ensure accurate results.")
if self._track_for_cleanup:
for path in self._track_for_cleanup:
if os.path.isdir(path):
shutil.rmtree(path)
bb.utils.remove(path, recurse=True)
if os.path.isfile(path):
os.remove(path)
self._track_for_cleanup = []

View File

@@ -38,10 +38,12 @@ class ImageOptionsTests(OESelftestTestCase):
self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p)
self.write_config('INHERIT += "ccache"')
self.add_command_to_tearDown('bitbake -c clean m4')
bitbake("m4 -c clean")
bitbake("m4 -f -c compile")
log_compile = os.path.join(get_bb_var("WORKDIR","m4"), "temp/log.do_compile")
res = runCmd("grep ccache %s" % log_compile, ignore_status=True)
self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % log_compile)
with open(log_compile, "r") as f:
loglines = "".join(f.readlines())
self.assertIn("ccache", loglines, msg="No match for ccache in m4 log.do_compile. For further details: %s" % log_compile)
@OETestID(1435)
def test_read_only_image(self):
@@ -57,15 +59,15 @@ class DiskMonTest(OESelftestTestCase):
@OETestID(277)
def test_stoptask_behavior(self):
self.write_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"')
res = bitbake("m4", ignore_status = True)
res = bitbake("delay -c delay", ignore_status = True)
self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.output, msg = "Tasks should have stopped. Disk monitor is set to STOPTASK: %s" % res.output)
self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
self.write_config('BB_DISKMON_DIRS = "ABORT,${TMPDIR},100000G,100K"')
res = bitbake("m4", ignore_status = True)
res = bitbake("delay -c delay", ignore_status = True)
self.assertTrue('ERROR: Immediately abort since the disk space monitor action is "ABORT"!' in res.output, "Tasks should have been aborted immediatelly. Disk monitor is set to ABORT: %s" % res.output)
self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
self.write_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"')
res = bitbake("m4")
res = bitbake("delay -c delay")
self.assertTrue('WARNING: The free space' in res.output, msg = "A warning should have been displayed for disk monitor is set to WARN: %s" %res.output)
class SanityOptionsTest(OESelftestTestCase):

View File

@@ -39,6 +39,7 @@ class ContainerImageTests(OESelftestTestCase):
IMAGE_FSTYPES = "container"
PACKAGE_CLASSES = "package_ipk"
IMAGE_FEATURES = ""
IMAGE_BUILDINFO_FILE = ""
""")
bbvars = get_bb_vars(['bindir', 'sysconfdir', 'localstatedir',

View File

@@ -11,6 +11,71 @@ from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer
from oeqa.utils.commands import get_bb_vars, runqemu, get_test_layer
from oeqa.core.decorator.oeid import OETestID
oldmetapath = None
def setUpModule():
import bb.utils
global templayerdir
templayerdir = tempfile.mkdtemp(prefix='devtoolqa')
corecopydir = os.path.join(templayerdir, 'core-copy')
bblayers_conf = os.path.join(os.environ['BUILDDIR'], 'conf', 'bblayers.conf')
edited_layers = []
# We need to take a copy of the meta layer so we can modify it and not
# have any races against other tests that might be running in parallel
# however things like COREBASE mean that you can't just copy meta, you
# need the whole repository.
def bblayers_edit_cb(layerpath, canonical_layerpath):
global oldmetapath
if not canonical_layerpath.endswith('/'):
# This helps us match exactly when we're using this path later
canonical_layerpath += '/'
if not edited_layers and canonical_layerpath.endswith('/meta/'):
canonical_layerpath = os.path.realpath(canonical_layerpath) + '/'
edited_layers.append(layerpath)
oldmetapath = os.path.realpath(layerpath)
result = runCmd('git rev-parse --show-toplevel', cwd=canonical_layerpath)
oldreporoot = result.output.rstrip()
newmetapath = os.path.join(corecopydir, os.path.relpath(oldmetapath, oldreporoot))
runCmd('git clone %s %s' % (oldreporoot, corecopydir), cwd=templayerdir)
# Now we need to copy any modified files
# You might ask "why not just copy the entire tree instead of
# cloning and doing this?" - well, the problem with that is
# TMPDIR or an equally large subdirectory might exist
# under COREBASE and we don't want to copy that, so we have
# to be selective.
result = runCmd('git status --porcelain', cwd=oldreporoot)
for line in result.output.splitlines():
if line.startswith(' M ') or line.startswith('?? '):
relpth = line.split()[1]
pth = os.path.join(oldreporoot, relpth)
if pth.startswith(canonical_layerpath):
if relpth.endswith('/'):
destdir = os.path.join(corecopydir, relpth)
shutil.copytree(pth, destdir)
else:
destdir = os.path.join(corecopydir, os.path.dirname(relpth))
bb.utils.mkdirhier(destdir)
shutil.copy2(pth, destdir)
return newmetapath
else:
return layerpath
bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb)
def tearDownModule():
if oldmetapath:
edited_layers = []
def bblayers_edit_cb(layerpath, canonical_layerpath):
if not edited_layers and canonical_layerpath.endswith('/meta'):
edited_layers.append(layerpath)
return oldmetapath
else:
return layerpath
bblayers_conf = os.path.join(os.environ['BUILDDIR'], 'conf', 'bblayers.conf')
bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb)
shutil.rmtree(templayerdir)
class DevtoolBase(OESelftestTestCase):
buffer = True

View File

@@ -21,7 +21,7 @@ class Distrodata(OESelftestTestCase):
Summary: Test that upstream version checks do not regress
Expected: Upstream version checks should succeed except for the recipes listed in the exception list.
Product: oe-core
Author: Alexander Kanavin <alexander.kanavin@intel.com>
Author: Alexander Kanavin <alex.kanavin@gmail.com>
"""
checkpkg_result = open(os.path.join(get_bb_var("LOG_DIR"), "checkpkg.csv")).readlines()[1:]
regressed_failures = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] if pkg_data[11] == 'UNKNOWN_BROKEN']
@@ -46,7 +46,7 @@ but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re
Summary: Test that oe-core recipes have a maintainer
Expected: All oe-core recipes (except a few special static/testing ones) should have a maintainer listed in maintainers.inc file.
Product: oe-core
Author: Alexander Kanavin <alexander.kanavin@intel.com>
Author: Alexander Kanavin <alex.kanavin@gmail.com>
"""
def is_exception(pkg):
exceptions = ["packagegroup-", "initramfs-", "systemd-machine-units", "target-sdk-provides-dummy"]

View File

@@ -70,11 +70,13 @@ CORE_IMAGE_EXTRA_INSTALL = "perl"
@classmethod
def setUpClass(cls):
super(oeSDKExtSelfTest, cls).setUpClass()
cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA')
sstate_dir = get_bb_var('SSTATE_DIR')
cls.image = 'core-image-minimal'
bb_vars = get_bb_vars(['SSTATE_DIR', 'WORKDIR'], cls.image)
bb.utils.mkdirhier(bb_vars["WORKDIR"])
cls.tmpdirobj = tempfile.TemporaryDirectory(prefix="selftest-esdk-", dir=bb_vars["WORKDIR"])
cls.tmpdir_eSDKQA = cls.tmpdirobj.name
oeSDKExtSelfTest.generate_eSDK(cls.image)
# Install eSDK
@@ -87,14 +89,14 @@ CORE_IMAGE_EXTRA_INSTALL = "perl"
sstate_config="""
SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS"
SSTATE_MIRRORS = "file://.* file://%s/PATH"
""" % sstate_dir
""" % bb_vars["SSTATE_DIR"]
with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f:
f.write(sstate_config)
@classmethod
def tearDownClass(cls):
shutil.rmtree(cls.tmpdir_eSDKQA, ignore_errors=True)
super(oeSDKExtSelfTest, cls).tearDownClass()
cls.tmpdirobj.cleanup()
super().tearDownClass()
@OETestID(1602)
def test_install_libraries_headers(self):

View File

@@ -38,13 +38,6 @@ class TestRealPath(TestCase):
( "b/test", errno.ENOENT ),
]
def __del__(self):
try:
#os.system("tree -F %s" % self.tmpdir)
shutil.rmtree(self.tmpdir)
except:
pass
def setUp(self):
self.tmpdir = tempfile.mkdtemp(prefix = "oe-test_path")
self.root = os.path.join(self.tmpdir, "R")
@@ -59,6 +52,9 @@ class TestRealPath(TestCase):
for l in self.LINKS:
os.symlink(l[1], os.path.join(self.root, l[0]))
def tearDown(self):
shutil.rmtree(self.tmpdir)
def __realpath(self, file, use_physdir, assume_dir = True):
return oe.path.realpath(os.path.join(self.root, file), self.root,
use_physdir, assume_dir = assume_dir)

View File

@@ -0,0 +1,94 @@
import os
import sys
basepath = os.path.abspath(os.path.dirname(__file__) + '/../../../../../')
lib_path = basepath + '/scripts/lib'
sys.path = sys.path + [lib_path]
from resulttool.report import ResultsTextReport
from resulttool import regression as regression
from resulttool import resultutils as resultutils
from oeqa.selftest.case import OESelftestTestCase
class ResultToolTests(OESelftestTestCase):
base_results_data = {'base_result1': {'configuration': {"TEST_TYPE": "runtime",
"TESTSERIES": "series1",
"IMAGE_BASENAME": "image",
"IMAGE_PKGTYPE": "ipk",
"DISTRO": "mydistro",
"MACHINE": "qemux86"},
'result': {}},
'base_result2': {'configuration': {"TEST_TYPE": "runtime",
"TESTSERIES": "series1",
"IMAGE_BASENAME": "image",
"IMAGE_PKGTYPE": "ipk",
"DISTRO": "mydistro",
"MACHINE": "qemux86-64"},
'result': {}}}
target_results_data = {'target_result1': {'configuration': {"TEST_TYPE": "runtime",
"TESTSERIES": "series1",
"IMAGE_BASENAME": "image",
"IMAGE_PKGTYPE": "ipk",
"DISTRO": "mydistro",
"MACHINE": "qemux86"},
'result': {}},
'target_result2': {'configuration': {"TEST_TYPE": "runtime",
"TESTSERIES": "series1",
"IMAGE_BASENAME": "image",
"IMAGE_PKGTYPE": "ipk",
"DISTRO": "mydistro",
"MACHINE": "qemux86"},
'result': {}},
'target_result3': {'configuration': {"TEST_TYPE": "runtime",
"TESTSERIES": "series1",
"IMAGE_BASENAME": "image",
"IMAGE_PKGTYPE": "ipk",
"DISTRO": "mydistro",
"MACHINE": "qemux86-64"},
'result': {}}}
def test_report_can_aggregate_test_result(self):
result_data = {'result': {'test1': {'status': 'PASSED'},
'test2': {'status': 'PASSED'},
'test3': {'status': 'FAILED'},
'test4': {'status': 'ERROR'},
'test5': {'status': 'SKIPPED'}}}
report = ResultsTextReport()
result_report = report.get_aggregated_test_result(None, result_data)
self.assertTrue(result_report['passed'] == 2, msg="Passed count not correct:%s" % result_report['passed'])
self.assertTrue(result_report['failed'] == 2, msg="Failed count not correct:%s" % result_report['failed'])
self.assertTrue(result_report['skipped'] == 1, msg="Skipped count not correct:%s" % result_report['skipped'])
def test_regression_can_get_regression_base_target_pair(self):
results = {}
resultutils.append_resultsdata(results, ResultToolTests.base_results_data)
resultutils.append_resultsdata(results, ResultToolTests.target_results_data)
self.assertTrue('target_result1' in results['runtime/mydistro/qemux86/image'], msg="Pair not correct:%s" % results)
self.assertTrue('target_result3' in results['runtime/mydistro/qemux86-64/image'], msg="Pair not correct:%s" % results)
def test_regrresion_can_get_regression_result(self):
base_result_data = {'result': {'test1': {'status': 'PASSED'},
'test2': {'status': 'PASSED'},
'test3': {'status': 'FAILED'},
'test4': {'status': 'ERROR'},
'test5': {'status': 'SKIPPED'}}}
target_result_data = {'result': {'test1': {'status': 'PASSED'},
'test2': {'status': 'FAILED'},
'test3': {'status': 'PASSED'},
'test4': {'status': 'ERROR'},
'test5': {'status': 'SKIPPED'}}}
result, text = regression.compare_result(self.logger, "BaseTestRunName", "TargetTestRunName", base_result_data, target_result_data)
self.assertTrue(result['test2']['base'] == 'PASSED',
msg="regression not correct:%s" % result['test2']['base'])
self.assertTrue(result['test2']['target'] == 'FAILED',
msg="regression not correct:%s" % result['test2']['target'])
self.assertTrue(result['test3']['base'] == 'FAILED',
msg="regression not correct:%s" % result['test3']['base'])
self.assertTrue(result['test3']['target'] == 'PASSED',
msg="regression not correct:%s" % result['test3']['target'])
def test_merge_can_merged_results(self):
results = {}
resultutils.append_resultsdata(results, ResultToolTests.base_results_data, configmap=resultutils.flatten_map)
resultutils.append_resultsdata(results, ResultToolTests.target_results_data, configmap=resultutils.flatten_map)
self.assertEqual(len(results[''].keys()), 5, msg="Flattened results not correct %s" % str(results))

View File

@@ -5,6 +5,7 @@
import re
import tempfile
import time
import oe.types
from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import bitbake, runqemu, get_bb_var, runCmd
from oeqa.core.decorator.oeid import OETestID
@@ -24,6 +25,10 @@ class RunqemuTests(OESelftestTestCase):
self.fstypes = "ext4 iso hddimg wic.vmdk wic.qcow2 wic.vdi"
self.cmd_common = "runqemu nographic"
kvm = oe.types.qemu_use_kvm(get_bb_var('QEMU_USE_KVM'), 'x86_64')
if kvm:
self.cmd_common += " kvm"
self.write_config(
"""
MACHINE = "%s"
@@ -44,7 +49,8 @@ SYSLINUX_TIMEOUT = "10"
"""Test runqemu machine"""
cmd = "%s %s" % (self.cmd_common, self.machine)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)
with open(qemu.qemurunnerlog) as f:
self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read()))
@OETestID(2002)
def test_boot_machine_ext4(self):
@@ -52,7 +58,7 @@ SYSLINUX_TIMEOUT = "10"
cmd = "%s %s ext4" % (self.cmd_common, self.machine)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
with open(qemu.qemurunnerlog) as f:
self.assertTrue('rootfs.ext4' in f.read(), "Failed: %s" % cmd)
self.assertIn('rootfs.ext4', f.read(), "Failed: %s" % cmd)
@OETestID(2003)
def test_boot_machine_iso(self):
@@ -60,14 +66,16 @@ SYSLINUX_TIMEOUT = "10"
cmd = "%s %s iso" % (self.cmd_common, self.machine)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
with open(qemu.qemurunnerlog) as f:
self.assertTrue('media=cdrom' in f.read(), "Failed: %s" % cmd)
self.assertIn('media=cdrom', f.read(), "Failed: %s" % cmd)
@OETestID(2004)
def test_boot_recipe_image(self):
"""Test runqemu recipe-image"""
cmd = "%s %s" % (self.cmd_common, self.recipe)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)
with open(qemu.qemurunnerlog) as f:
self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read()))
@OETestID(2005)
def test_boot_recipe_image_vmdk(self):
@@ -75,7 +83,7 @@ SYSLINUX_TIMEOUT = "10"
cmd = "%s %s wic.vmdk" % (self.cmd_common, self.recipe)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
with open(qemu.qemurunnerlog) as f:
self.assertTrue('format=vmdk' in f.read(), "Failed: %s" % cmd)
self.assertIn('format=vmdk', f.read(), "Failed: %s" % cmd)
@OETestID(2006)
def test_boot_recipe_image_vdi(self):
@@ -83,14 +91,16 @@ SYSLINUX_TIMEOUT = "10"
cmd = "%s %s wic.vdi" % (self.cmd_common, self.recipe)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
with open(qemu.qemurunnerlog) as f:
self.assertTrue('format=vdi' in f.read(), "Failed: %s" % cmd)
self.assertIn('format=vdi', f.read(), "Failed: %s" % cmd)
@OETestID(2007)
def test_boot_deploy(self):
"""Test runqemu deploy_dir_image"""
cmd = "%s %s" % (self.cmd_common, self.deploy_dir_image)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)
with open(qemu.qemurunnerlog) as f:
self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read()))
@OETestID(2008)
def test_boot_deploy_hddimg(self):
@@ -98,7 +108,7 @@ SYSLINUX_TIMEOUT = "10"
cmd = "%s %s hddimg" % (self.cmd_common, self.deploy_dir_image)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
with open(qemu.qemurunnerlog) as f:
self.assertTrue(re.search('file=.*.hddimg', f.read()), "Failed: %s" % cmd)
self.assertTrue(re.search('file=.*.hddimg', f.read()), "Failed: %s, %s" % (cmd, f.read()))
@OETestID(2009)
def test_boot_machine_slirp(self):
@@ -106,7 +116,7 @@ SYSLINUX_TIMEOUT = "10"
cmd = "%s slirp %s" % (self.cmd_common, self.machine)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
with open(qemu.qemurunnerlog) as f:
self.assertTrue(' -netdev user' in f.read(), "Failed: %s" % cmd)
self.assertIn(' -netdev user', f.read(), "Failed: %s" % cmd)
@OETestID(2009)
def test_boot_machine_slirp_qcow2(self):
@@ -114,7 +124,7 @@ SYSLINUX_TIMEOUT = "10"
cmd = "%s slirp wic.qcow2 %s" % (self.cmd_common, self.machine)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
with open(qemu.qemurunnerlog) as f:
self.assertTrue('format=qcow2' in f.read(), "Failed: %s" % cmd)
self.assertIn('format=qcow2', f.read(), "Failed: %s" % cmd)
@OETestID(2010)
def test_boot_qemu_boot(self):
@@ -125,7 +135,8 @@ SYSLINUX_TIMEOUT = "10"
self.skipTest("%s not found" % qemuboot_conf)
cmd = "%s %s" % (self.cmd_common, qemuboot_conf)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)
with open(qemu.qemurunnerlog) as f:
self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read()))
@OETestID(2011)
def test_boot_rootfs(self):
@@ -136,7 +147,9 @@ SYSLINUX_TIMEOUT = "10"
self.skipTest("%s not found" % rootfs)
cmd = "%s %s" % (self.cmd_common, rootfs)
with runqemu(self.recipe, ssh=False, launch_cmd=cmd) as qemu:
self.assertTrue(qemu.runner.logged, "Failed: %s" % cmd)
with open(qemu.qemurunnerlog) as f:
self.assertTrue(qemu.runner.logged, "Failed: %s, %s" % (cmd, f.read()))
# This test was designed as a separate class to test that shutdown
# command will shutdown qemu as expected on each qemu architecture

View File

@@ -135,7 +135,7 @@ class TestImage(OESelftestTestCase):
Summary: Check package feeds functionality for dnf
Expected: 1. Check that remote package feeds can be accessed
Product: oe-core
Author: Alexander Kanavin <alexander.kanavin@intel.com>
Author: Alexander Kanavin <alex.kanavin@gmail.com>
"""
if get_bb_var('DISTRO') == 'poky-tiny':
self.skipTest('core-image-full-cmdline not buildable for poky-tiny')
@@ -233,7 +233,7 @@ class Postinst(OESelftestTestCase):
Expected: The scriptlet failure is properly reported.
The file that is created after the error in the scriptlet is not present.
Product: oe-core
Author: Alexander Kanavin <alexander.kanavin@intel.com>
Author: Alexander Kanavin <alex.kanavin@gmail.com>
"""
import oe.path

View File

@@ -1,10 +1,12 @@
from oeqa.selftest.case import OESelftestTestCase
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
import os
import oe
import glob
import re
import shutil
import tempfile
from contextlib import contextmanager
from oeqa.core.decorator.oeid import OETestID
from oeqa.utils.ftools import write_file
@@ -15,23 +17,39 @@ class Signing(OESelftestTestCase):
pub_key_path = ""
secret_key_path = ""
@classmethod
def setUpClass(cls):
super(Signing, cls).setUpClass()
# Check that we can find the gpg binary and fail early if we can't
if not shutil.which("gpg"):
raise AssertionError("This test needs GnuPG")
def setup_gpg(self):
bitbake('gnupg-native -c addto_recipe_sysroot')
cls.gpg_dir = tempfile.mkdtemp(prefix="oeqa-signing-")
self.gpg_dir = tempfile.mkdtemp(prefix="oeqa-signing-")
self.track_for_cleanup(self.gpg_dir)
cls.pub_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.pub")
cls.secret_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.secret")
self.pub_key_path = os.path.join(self.testlayer_path, 'files', 'signing', "key.pub")
self.secret_key_path = os.path.join(self.testlayer_path, 'files', 'signing', "key.secret")
runCmd('gpg --batch --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path))
nsysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native")
runCmd('gpg --batch --homedir %s --import %s %s' % (self.gpg_dir, self.pub_key_path, self.secret_key_path), native_sysroot=nsysroot)
return nsysroot + get_bb_var("bindir_native")
@classmethod
def tearDownClass(cls):
shutil.rmtree(cls.gpg_dir, ignore_errors=True)
@contextmanager
def create_new_builddir(self, builddir, newbuilddir):
bb.utils.mkdirhier(newbuilddir)
oe.path.copytree(builddir + "/conf", newbuilddir + "/conf")
oe.path.copytree(builddir + "/cache", newbuilddir + "/cache")
origenv = os.environ.copy()
for e in os.environ:
if builddir in os.environ[e]:
os.environ[e] = os.environ[e].replace(builddir, newbuilddir)
os.chdir(newbuilddir)
try:
yield
finally:
for e in origenv:
os.environ[e] = origenv[e]
os.chdir(builddir)
@OETestID(1362)
def test_signing_packages(self):
@@ -41,11 +59,13 @@ class Signing(OESelftestTestCase):
Expected: Images can be created from signed packages
Product: oe-core
Author: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Author: Alexander Kanavin <alexander.kanavin@intel.com>
Author: Alexander Kanavin <alex.kanavin@gmail.com>
AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
"""
import oe.packagedata
self.setup_gpg()
package_classes = get_bb_var('PACKAGE_CLASSES')
if 'package_rpm' not in package_classes:
self.skipTest('This test requires RPM Packaging.')
@@ -108,11 +128,12 @@ class Signing(OESelftestTestCase):
test_recipe = 'ed'
builddir = os.environ.get('BUILDDIR')
# Since we need gpg but we can't use gpg-native for sstate signatures, we
# build gpg-native in our original builddir then run the tests in a second one.
builddir = os.environ.get('BUILDDIR') + "-testsign"
sstatedir = os.path.join(builddir, 'test-sstate')
self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)
self.add_command_to_tearDown('rm -rf %s' % sstatedir)
nsysroot = self.setup_gpg()
feature = 'SSTATE_SIG_KEY ?= "testuser"\n'
feature += 'SSTATE_SIG_PASSPHRASE ?= "test123"\n'
@@ -124,19 +145,26 @@ class Signing(OESelftestTestCase):
self.write_config(feature)
bitbake('-c clean %s' % test_recipe)
bitbake(test_recipe)
with self.create_new_builddir(os.environ['BUILDDIR'], builddir):
recipe_sig = glob.glob(sstatedir + '/*/*:ed:*_package.tgz.sig')
recipe_tgz = glob.glob(sstatedir + '/*/*:ed:*_package.tgz')
os.environ["PATH"] = nsysroot + ":" + os.environ["PATH"]
self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)
self.add_command_to_tearDown('rm -rf %s' % sstatedir)
self.add_command_to_tearDown('rm -rf %s' % builddir)
self.assertEqual(len(recipe_sig), 1, 'Failed to find .sig file.')
self.assertEqual(len(recipe_tgz), 1, 'Failed to find .tgz file.')
bitbake('-c clean %s' % test_recipe)
bitbake('-c populate_lic %s' % test_recipe)
ret = runCmd('gpg --homedir %s --verify %s %s' % (self.gpg_dir, recipe_sig[0], recipe_tgz[0]))
# gpg: Signature made Thu 22 Oct 2015 01:45:09 PM EEST using RSA key ID 61EEFB30
# gpg: Good signature from "testuser (nocomment) <testuser@email.com>"
self.assertIn('gpg: Good signature from', ret.output, 'Package signed incorrectly.')
recipe_sig = glob.glob(sstatedir + '/*/*:ed:*_populate_lic.tgz.sig')
recipe_tgz = glob.glob(sstatedir + '/*/*:ed:*_populate_lic.tgz')
self.assertEqual(len(recipe_sig), 1, 'Failed to find .sig file.')
self.assertEqual(len(recipe_tgz), 1, 'Failed to find .tgz file.')
ret = runCmd('gpg --homedir %s --verify %s %s' % (self.gpg_dir, recipe_sig[0], recipe_tgz[0]))
# gpg: Signature made Thu 22 Oct 2015 01:45:09 PM EEST using RSA key ID 61EEFB30
# gpg: Good signature from "testuser (nocomment) <testuser@email.com>"
self.assertIn('gpg: Good signature from', ret.output, 'Package signed incorrectly.')
class LockedSignatures(OESelftestTestCase):

View File

@@ -5,12 +5,13 @@ import os
import time
import glob
import sys
import imp
import importlib
import signal
from shutil import copyfile
from random import choice
import oeqa
import oe
from oeqa.core.context import OETestContext, OETestContextExecutor
from oeqa.core.exception import OEQAPreRun, OEQATestNotFound
@@ -96,11 +97,17 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
return cases_paths
def _process_args(self, logger, args):
args.output_log = '%s-results-%s.log' % (self.name,
time.strftime("%Y%m%d%H%M%S"))
args.test_start_time = time.strftime("%Y%m%d%H%M%S")
args.test_data_file = None
args.CASES_PATHS = None
bbvars = get_bb_vars()
logdir = os.environ.get("BUILDDIR")
if 'LOG_DIR' in bbvars:
logdir = bbvars['LOG_DIR']
args.output_log = logdir + '/%s-results-%s.log' % (self.name, args.test_start_time)
super(OESelftestTestContextExecutor, self)._process_args(logger, args)
if args.list_modules:
@@ -110,7 +117,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
elif args.list_tests:
args.list_tests = 'name'
self.tc_kwargs['init']['td'] = get_bb_vars()
self.tc_kwargs['init']['td'] = bbvars
self.tc_kwargs['init']['machines'] = self._get_available_machines()
builddir = os.environ.get("BUILDDIR")
@@ -174,7 +181,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
self.tc.logger.info("\t%s" % l)
sys.path.extend(layer_libdirs)
imp.reload(oeqa.selftest)
importlib.reload(oeqa.selftest)
_check_required_env_variables(["BUILDDIR"])
_check_presence_meta_selftest()
@@ -196,6 +203,28 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
self.tc.logger.info("Running bitbake -p")
runCmd("bitbake -p")
def get_json_result_dir(self, args):
json_result_dir = os.path.join(self.tc.td["LOG_DIR"], 'oeqa')
if "OEQA_JSON_RESULT_DIR" in self.tc.td:
json_result_dir = self.tc.td["OEQA_JSON_RESULT_DIR"]
return json_result_dir
def get_configuration(self, args):
import platform
from oeqa.utils.metadata import metadata_from_bb
metadata = metadata_from_bb()
configuration = {'TEST_TYPE': 'oeselftest',
'STARTTIME': args.test_start_time,
'MACHINE': self.tc.td["MACHINE"],
'HOST_DISTRO': oe.lsb.distro_identifier().replace(' ', '-'),
'HOST_NAME': metadata['hostname'],
'LAYERS': metadata['layers']}
return configuration
def get_result_id(self, configuration):
return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['HOST_DISTRO'], configuration['MACHINE'], configuration['STARTTIME'])
def _internal_run(self, logger, args):
self.module_paths = self._get_cases_paths(
self.tc_kwargs['init']['td']['BBPATH'].split(':'))
@@ -212,7 +241,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
else:
self._pre_run()
rc = self.tc.runTests(**self.tc_kwargs['run'])
rc.logDetails()
configuration = self.get_configuration(args)
rc.logDetails(self.get_json_result_dir(args),
configuration,
self.get_result_id(configuration))
rc.logSummary(self.name)
return rc
@@ -270,7 +302,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
output_link = os.path.join(os.path.dirname(args.output_log),
"%s-results.log" % self.name)
if os.path.exists(output_link):
if os.path.lexists(output_link):
os.remove(output_link)
os.symlink(args.output_log, output_link)

View File

@@ -107,13 +107,9 @@ class QemuTarget(BaseTarget):
dump_target_cmds = d.getVar("testimage_dump_target")
dump_host_cmds = d.getVar("testimage_dump_host")
dump_dir = d.getVar("TESTIMAGE_DUMP_DIR")
qemu_use_kvm = d.getVar("QEMU_USE_KVM")
if qemu_use_kvm and \
(oe.types.boolean(qemu_use_kvm) and "x86" in d.getVar("MACHINE") or \
d.getVar("MACHINE") in qemu_use_kvm.split()):
use_kvm = True
else:
use_kvm = False
if not dump_dir:
dump_dir = os.path.join(d.getVar('LOG_DIR'), 'runtime-hostdump')
use_kvm = oe.types.qemu_use_kvm(d.getVar('QEMU_USE_KVM'), d.getVar('TARGET_ARCH'))
# Log QemuRunner log output to a file
import oe.path
@@ -196,7 +192,7 @@ class QemuTarget(BaseTarget):
else:
raise bb.build.FuncFailed("%s - FAILED to re-start qemu - check the task log and the boot log" % self.pn)
def run_serial(self, command, timeout=5):
def run_serial(self, command, timeout=60):
return self.runner.run_serial(command, timeout=timeout)

View File

@@ -17,16 +17,20 @@ class BuildProject(metaclass=ABCMeta):
self.uri = uri
self.archive = os.path.basename(uri)
if not tmpdir:
tmpdir = tempfile.mkdtemp(prefix='buildproject')
self.tempdirobj = tempfile.TemporaryDirectory(prefix='buildproject-')
tmpdir = self.tempdirobj.name
self.localarchive = os.path.join(tmpdir, self.archive)
self.dl_dir = dl_dir
if foldername:
self.fname = foldername
else:
self.fname = re.sub(r'\.tar\.bz2$|\.tar\.gz$|\.tar\.xz$', '', self.archive)
self.needclean = False
# Download self.archive to self.localarchive
def _download_archive(self):
self.needclean = True
if self.dl_dir and os.path.exists(os.path.join(self.dl_dir, self.archive)):
shutil.copyfile(os.path.join(self.dl_dir, self.archive), self.localarchive)
return
@@ -51,5 +55,7 @@ class BuildProject(metaclass=ABCMeta):
return self._run('cd %s; make install %s' % (self.targetdir, install_args))
def clean(self):
if not self.needclean:
return
self._run('rm -rf %s' % self.targetdir)
subprocess.check_call('rm -f %s' % self.localarchive, shell=True)

View File

@@ -146,6 +146,9 @@ class Command(object):
# At this point we know that the process has closed stdout/stderr, so
# it is safe and necessary to wait for the actual process completion.
self.status = self.process.wait()
self.process.stdout.close()
if self.process.stderr:
self.process.stderr.close()
self.log.debug("Command '%s' returned %d as exit code." % (self.cmd, self.status))
# logging the complete output is insane
@@ -333,16 +336,20 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None,
try:
qemu.start(params=qemuparams, ssh=ssh, runqemuparams=runqemuparams, launch_cmd=launch_cmd, discard_writes=discard_writes)
except bb.build.FuncFailed:
raise Exception('Failed to start QEMU - see the logs in %s' % logdir)
msg = 'Failed to start QEMU - see the logs in %s' % logdir
if os.path.exists(qemu.qemurunnerlog):
with open(qemu.qemurunnerlog, 'r') as f:
msg = msg + "Qemurunner log output from %s:\n%s" % (qemu.qemurunnerlog, f.read())
raise Exception(msg)
yield qemu
finally:
targetlogger.removeHandler(handler)
try:
qemu.stop()
except:
pass
targetlogger.removeHandler(handler)
def updateEnv(env_file):
"""

Some files were not shown because too many files have changed in this diff Show More