Age | Commit message (Collapse) | Author | Files |
|
Setting SANITY_TESTED_DISTROS or PRSERV_HOST are known to break oe-selftest.
Rather than have the user experience this, refuse to execute unless the
environment is correct.
Ideally we'd try and unset these but that is a more invasive change and this
at least makes people aware of the problem.
[YOCTO #11292]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
adding the meta-selftest layer is a small bump you always encounter
when you want to run selftest. Adding an automatic procedure to include
the layer if it is not yet present.
Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
buildhistory interfers with various tests so error if the user has it enabled,
hence avoiding time spent running the tests only for them to fail.
For example, if there is an sstate cache and something comes from that cache,
you can get a "version went backwards" warning from buildhistory which would
then change the outcome of a test. Its safer/easier to disable it.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Make it possible to store any bitbake config variables in the metadata.
Config values will be stored under a new config element in the xml report:
<config>
<variable name="MACHINE">qemux86</variable>
</config>
The value of MACHINE is moved there instead of having a dedicated
<machine> element.
[YOCTO #10590]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Revision is a bit vague and could point to a tag, for example. Git
commit objects are unambiguous and persistent so be explicit that the
element should contain git commit hash.
[YOCTO #10590]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
It's better just to not have the xml elements than to have elements with
faux data. One could have git branch named 'unknown', for example.
[YOCTO #10590]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Use the same format, based on /etc/os-release, as for host distro
information.
[YOCTO #10590]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Change 'agains' to 'against'.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
If you delete the log file that the oe-selftest.log symlink points to
but not the symlink itself, because we were using os.path.exists() here
the code assumed that the symlink didn't exist when in fact it still
did. Use os.path.lexists() instead.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Its possible something (like bitbake/tinfoil2) may mess around with the
environment and using the enviroment as a global variable store isn't
particularly nice anyway.
This patch changes the BUILDDIR usages so that the environment isn't used
as a global store and a global variable is used instead. Whilst that
is still not perfect, it does avoid the current double and triple backtraces
we're seeing where tinfoil2/bitbake has trampled the enviroment leading
to failures of failures making debugging even harder.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
git module is not included into standard Python
library and therefore causes import errors on the systems
where PythonGit is not installed.
As git module only used in the code implementing --repository
functionality it's better to import git only in the scope
that requires it.
[YOCTO #10821]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
This new option allows to commit the result to a git repository,
along with the results it will add a metadata file for information
of the current selftest run, such as: hostname, machine, distro,
distro version, host version, and layers.
This implementation will have a branch per different hostname,
testing branch, and machine.
To use this feature use:
oe-selftest <options> --repository <repository_link>
[YOCTO #9954]
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Replicate bitbake and eforce en_US.UTF-8 locale so that ouptut of locale-aware
tools remains stable.
Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Running `oe-selftest --list-tests-by module wic` will produce the
following backtrace:
Traceback (most recent call last):
File "<snip>/poky/scripts/oe-selftest", line 668, in <module>
ret = main()
File "<snip>/poky/scripts/oe-selftest", line 486, in main
list_testsuite_by(criteria, keyword)
File "<snip>/poky/scripts/oe-selftest", line 340, in list_testsuite_by
ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ])
TypeError: unorderable types: int() < NoneType()
The root cause is that a test case does not necessarily have an ID
assigned, hence its value is None. Since Python 3 does not allow
comparison of heterogeneous types, TypeError is raised.
Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
python coverage versions lower than 4.x have problems with some distros. Adding the 4.x version as requirement to continue with coverage tracking.
[YOCTO #10207]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
avoiding characters like ':' and making a clearer separation of the
fields that compose the filename. Changing from:
oe-selftest-2016-07-20_16:05:27.log
to:
oe-selftest-20160720-160527.log
Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
if available, use the xmlrunner for exporting the test results to a
dir named the same than the log where the text results are stored.
this means creating a dir with the name of the log (without the .log)
and dumping there the xml files that indicate the results of each of
the tests.
if xmlrunner is not available then it will behave the same as before,
no xml exports.
[YOCTO#9682]
Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
For example:
$ oe-selftest --run-tests-by name hello world
2016-07-12 00:33:28,678 - selftest - ERROR - Failed to find test: hello
2016-07-12 00:33:28,679 - selftest - ERROR - Failed to find test: world
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
stdeout and stderr content returned by subprocess API has different
types in Python 3(bytes) and Python 2(string). Decoding it to
'utf-8' makes it unicode on both pythons.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
This patch contains all the other misc pieces of the transition to
python3 which didn't make sense to be broken into individual patches.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Iterators now return views, not lists in python3. Where we need
lists, handle this explicitly.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Used print function instead of print statement to make
the code work in python 3.
[Changes from both Ed and Richard]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
The --list-tests option assumes a terminal of 150 characters wide,
which is clearly wrong. The output for this command is messy and
hard to understand for lower widths. Every command should look
good in a 80 characters terminal.
Unfortunately, this can't be done at the moment. The bad naming of
testcases have made the test names incredibly long.
This patch reduces spacing between columns and shows the tests
names in a concise and understandable way. The format is even the
same one required for running a testcase. Once the testcase naming
improves, this output will look even better.
[Yocto #9534]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
installed
Coverage subprocessing file is being created even when coverage
is not installed, which causes errors of "module not found" to
be send to the oe-selftest output.
This patch adds indent to the block of code creating this coverage
file, so it can only be executed when coverage is actually
installed.
[Yocto #9334]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Coverage temporal file for sub-processing is being removed only
when the --coverage option was found. This is wrong since the
file is created when any coverage option (source, include or omit)
is given, even if --coverage is not one of them.
This patch makes sure to remove the file if any coverage option was
given.
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
There is a message that warns the user about enabling subprocessing
for coverage to work. After the fix for Yocto #8930,
this task is done automatically, so the warning is not needed
anymore.
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
There appears to have been a lot of copy and pasting of the code
which prints tracebacks upon failure and limits the stack trace to
5 entries. This obscures the real error and is very confusing to the user
it look me an age to work out why some tracebacks weren't useful.
This patch removes the limit, making tracebacks much more useful for
debugging.
[YOCTO #9230]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
This fixes the problem by changing the name to the coverage data file,
using the timestamp as an identifier.
The name for the coverage data file is constructed based on the tests
ran; this has created a couple of issues so far, affecting coverage report.
If --run-tests-by option is given, the data file name won't have any
identifier, causing following runs to overwrite themselves. On the
other hand, if too many tests are given, the file name exceeds linux
limits and fails to store the coverage data all together.
[Yocto #9253]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Commit 35be67951305950ba797dc2efddbc7d88fc0556a broke the
--list-tests-by tag option.
This patch fixes that.
Having a module in lib/oeqa/selftest named testmodule:
class TestClass(oeSelfTest):
@tag(feature='tag1')
def test_func1(self):
pass
@tag(feature=('tag1', 'tag2'))
def test_func2(self):
pass
@tag(feature=('tag2', 'tag3'))
def test_func3(self):
pass
@tag(feature=('tag1', 'tag2', 'tag3'))
def test_func4(self):
pass
$ oe-selftest --list-tests-by tag tag1
ID TAG(s) NAME CLASS MODULE
---- ---------------- ---------- --------- --------
tag1 test_func1 TestClass testmodule
tag1, tag2 test_func2 TestClass testmodule
tag1, tag2, tag3 test_func4 TestClass testmodule
______________________________
Filtering by: tag
Looking for: tag1
Total found: 3
$ oe-selftest --list-tests-by tag tag1 tag2
ID TAG(s) NAME CLASS MODULE
---- ---------------- ---------- --------- --------
tag1 test_func1 TestClass testmodule
tag1, tag2 test_func2 TestClass testmodule
tag1, tag2, tag3 test_func4 TestClass testmodule
tag2, tag3 test_func3 TestClass testmodule
______________________________
Filtering by: tag
Looking for: tag1, tag2
Total found: 4
$ oe-selftest --list-tests-by tag tag*
ID TAG(s) NAME CLASS MODULE
---- ---------------- ---------- --------- --------
tag1 test_func1 TestClass testmodule
tag1, tag2 test_func2 TestClass testmodule
tag1, tag2, tag3 test_func4 TestClass testmodule
tag2, tag3 test_func3 TestClass testmodule
______________________________
Filtering by: tag
Looking for: tag*
Total found: 4
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Add short names to most common options in oe-selftest. The options
changed were --run-tests, --run-all-tests, --list-tests and
--list-modules.
[Yocto #9079]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
The oe-selftest script required an exact matching for the parameters
passed to its run-tests-by and list-tests-by options. Many tests
can be retrieved here and filtering is a must.
This patch add this filtering functionality by enabling the use
of wildcards such as "*".
[Yocto #8916]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
This patch adds functionality to allow creating subdirectories inside
lib/oeqa/selftest for all layers present in BBLAYERS. Like this, test
cases can be grouped into organized directories.
Addresses [YOCTO #7865]
Signed-off-by: Costin Constantin <costin.c.constantin@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
for sub-process
Coverage in oe-selftest currently requires to create or modify
a sitecustomize.py file according the coverage tool setup instructions
(http://coverage.readthedocs.org/). This file has to be located in
the system's python folder, which is not a good solution since this
folder is not accesible to non-privileged users.
The best solution so far is to create this file in the home directory.
This is implemented by creating the temporal file in the user site
default folder.
[Yocto #8930]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
When --coverage is used, oe-selftest gathers coverage data from the testcases
executed. The command lacks a way of filtering which files to gather coverage
data from.
This patch adds three options to specify which files should be considered.
The --coverage-source option specifies folders, while --coverage-include and
--coverage-omit specify patterns to have an extra level of filtering.
Some examples:
1. oe-selftest --run-all-tests --coverage
Gathers coverage data from the default poky folders
2. oe-selftest --run-all-tests --coverage --coverage-include /home/me/poky/scripts/*
Gathers coverage data only for the files located under '/home/me/poky/scripts'
3. oe-selftest --run-all-tests -coverage --coverage-omit /home/me/poky/meta*
Gathers coverage data. Files inside all the folders starting with 'meta' under
'/home/me/poky' are omited
4. oe-selftest --run-all-tests --coverage --coverage-source /home/me/poky/bitbake
Gathers coverage data only from files inside the folder: '/home/me/poky/bitbake'
[Yocto #8920]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Add an option for random MACHINE into oe-selftest:
--machine [random/all]
1. random: will set a random MACHINE for each test
2. all: will run tests for all machines
Custom machine sets only weak default values (??=) for MACHINE in machine.inc.
This let test cases that require a specific MACHINE to be able to
override it, using (?= or =).
e.g.:
oe-selftest --run-tests signing --machine random -->
will run all tests switching MACHINE randomly for each test
oe-selftest --run-tests signing --machine all -->
for each machine will run all tests
oe-selftest --run-all-tests --machine random
Also update oeqa/selftest/base.py to accomodate this feature.
Fix for [YOCTO #5880].
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
This option will list all available tests in a comprehensive manner.
Fix for [YOCTO #8868]
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
--list-classes does a weak validation when determining test names:
(if method.startswith("test_") which could report any class attribute
that starts with 'test_' as a valid test case.
This fix checks that the class attribute that starts with 'test_'
is also callable (is a method).
Fix for [YOCTO #8862]
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Coverage data tracking initiates too early, causing coverage data from the
oe-selftest environment setting to be added to each run. Even when no tests are run
oe-selftest reports around 24% of coverage due to this extra data.
Change the custom resultclass used by the TextTestRunner to one generated from the
command arguments. The generated class processes coverage when needed, running
coverage setup just before the first testcase is run and reporting after the last
one finished.
[Yocto #8846]
Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Each time oe-selftest runs, the oe-selftest.log file is overwritten.
This patch solves it by adding time stamp to each selftest log file
and doing a symlink named as oe-selftest.log to the last one created.
Signed-off-by: Costin Constantin <costin.c.constantin@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
For scripts that use Python's standard argparse module to parse
command-line arguments, create a subclass which will show the usage
the usage information when a command-line parsing error occurs. The most
common case would be when the script is run with no arguments; at least
then the user immediately gets to see what arguments they might need to
pass instead of just an error message.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
[YOCTO #8750] Allow oe-selftest to run custom test suites based on different criteria
1. Can run custom lists of tests based on different criteria:
--run-tests-by <name|class|module|id|tag> <list of tests|classes|modules|ids|tags>
eg: --run-tests-by module imagefeatures signing recipetool
--run-tests-by id 1377 1273 935
--run-tests-by tag wic sstate bitbake
2. Can list tests based on different criteria:
--list-tests-by <name|class|module|id|tag> <list of tests|classes|modules|ids|tags>
eg: --list-tests-by module imagefeatures signing recipetool
--list-tests-by id 1377 1273 935
--list-tests-by tag wic sstate bitbake
3. Can list all tags that have been set to test cases:
--list-tags
The list of tags should be kept as minimal as possible.
This helps preview the tags used so far.
To take advantage of the 'tag' feature:
- add @tag(feature=<>) to testcases
eg: @tag(feature='signing') for a single tag
@tag(feature=(('signing', 'sstate')) or
@tag(feature=['signing', 'sstate']) for multiple tags
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
Enable code coverage through the library 'python coverage'. In case the environment
variable COVERAGE_PROCESS_START is present (one of the requisites for measuring
sub-processes; the second one is including some coverage statements into the
python sitecustomize.py file) it will be taken into account, otherwise it is
exported with value '.coveragerc'. The latter value is a configuration file
(also automatically created) with some default settings. Once tests are
executed, a coverage report is shown on the log and the coverage output data is stored
with name '.coverage.<args>' where '<args>' is the name of the unit tests executed
or 'all_tests' when running with --run-all-tests. This output data can be latter used
for better reporting using the same tool (coverage).
As briefly indicate before, measuring sub-process implies setting the env variable
COVERAGE_PROCESS_START (done automatically by the oe-selftest code with this patch if
not already set) and creating a sitecustomize.py as explained on [1].
If either one of these is missing, complete coverage will be incomplete.
Current measurements for 'oe-selftest --run-all-tests' indicate that current coverage
is around 42 % taking into account BBLAYERS, bitbake and scripts folders. More details
on [2], indicating the coverage per file/module.
This tasks has been done together with Humberto Ibarra <humberto.ibarra.lopez@linux.intel.com>
[YOCTO #8679]
[1] http://coverage.readthedocs.org/en/latest/subprocess.html
[2] https://bugzilla.yoctoproject.org/attachment.cgi?id=2854
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
In particular, this allows us to use code from bitbake's bb module
(such as tinfoil).
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
This ensures that oeqa.selftest.* from layers are found.
[YOCTO #7625]
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
This ensures that all paths that hold selftest tests will be checked
(oeqa.selftest is a namespace package).
[YOCTO #7625]
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
When oe-selftest starts it includes bblayers.inc into bblayers.conf
When oe-selftest ends it deletes bblayers.inc and the included line
from bblayers.conf
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
The selftest can take a couple of hours to run, so add a custom result class to
timestamp the output to make it easy to spot any slow tests.
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
|
While trying to discover what tests are available, I felt the
need to be able to list all individual tests so I can run specific
tests.
This patch adds the "--list-classes" command line option that
lists the unit test classes and methods available.
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
|