Commit Graph

24 Commits

Author SHA1 Message Date
Chen Qi
5fc7930064 devtool.py: track to clean devtool.conf in test_create_workspace
`devtool create-workspace' would create devtool.conf, so track to
clean it up. Otherwise, this devtool.conf file would mess things up.

e.g.
oe-selftest -r devtool && oe-selftest -r devtool -j 2
AssertionError: '/PROJ_DIR/build-selftest-st-15753/workspace/conf/layer.conf' does not exist : Workspace directory not created

This is because the devtool.conf is also copied to build-selftest-st-xxxx
directory, resulting in devtool to create and use workspace specified
in this file.

(From OE-Core rev: a0a96db23686a38235fb0373e75e8b2951216c18)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-07-03 17:00:57 +01:00
Oleksandr Kravchuk
ca9c738053 selftest/devtool: fix URI to MarkupSafe package
PyPi packages are now hosted at files.pythonhosted.org.

[YOCTO #13243]

(From OE-Core rev: 384e2c3765c77c29527a43f2e0bffbc41170eeb6)

Signed-off-by: Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-06-14 22:48:22 +01:00
Richard Purdie
ffae400179 meta/lib+scripts: Convert to SPDX license headers
This adds SPDX license headers in place of the wide assortment of things
currently in our script headers. We default to GPL-2.0-only except for the
oeqa code where it was clearly submitted and marked as MIT on the most part
or some scripts which had the "or later" GPL versioning.

The patch also drops other obsolete bits of file headers where they were
encoountered such as editor modelines, obsolete maintainer information or
the phrase "All rights reserved" which is now obsolete and not required in
copyright headers (in this case its actually confusing for licensing as all
rights were not reserved).

More work is needed for OE-Core but this takes care of the bulk of the scripts
and meta/lib directories.

The top level LICENSE files are tweaked to match the new structure and the
SPDX naming.

(From OE-Core rev: f8c9c511b5f1b7dbd45b77f345cb6c048ae6763e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-09 16:31:55 +01:00
Richard Purdie
c7592b0147 oeqa: Drop OETestID
These IDs refer to testopia which we're no longer using. We would now use the test
names to definitively reference tests and the IDs can be dropped, along with their
supporting code.

(From OE-Core rev: 8e2d0575e4e7036b5f60e632f377a8ab2b96ead8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-09 16:31:55 +01:00
Richard Purdie
e1e38c9bd1 lib/oe,oeqa/selftest: Fix DeprecationWarning: invalid escape sequence
Fix another load of regex escape sequence warnings for newer
python versions.

(From OE-Core rev: bd2c125bb9c362b6122e99dfdf4e1cfe12c26a90)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-02-16 08:19:34 +00:00
Peter Kjellerstedt
8e4c03744c 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)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-21 21:30:35 +01:00
Paul Eggleton
d9a9a2d80e 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)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-31 22:47:36 +01:00
Richard Purdie
a85015b109 devtool: Split tests into multiple classes
This allows better parallelism between the different tests as currently
this block takes the longest time to execute. devtool tests are still
all grouped into the "devtool" module for ease of exection.

This also makes it easier to execute some subset of devtool tests for
testing devtool changes.

(From OE-Core rev: 75148c190dd4823947557e9a07f1722e817c1fea)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-16 13:21:35 +01:00
Richard Purdie
6b219f64c4 oeqa: Default to buffer mode for tests
Currently some tests run in buffer mode and some don't. Those that don't can
corrupt stdout/stderr. Switch to using buffer mode everywhere so we're consistent.

If there is useful output on stdout/stderr, it will be displayed if the test
fails.

(From OE-Core rev: 978548c0abde2cb94c2782538552f39bdf2bf630)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-16 13:21:35 +01:00
Richard Purdie
5456a9261d oeqa/selftest/devtool: Ensure dbus is built befoe running test
If dbus isn't build first the dbus dependency of dbus-wait can't be detected
through pkgconfig and the test fails:

AssertionError: {'DEPENDS': {'dbus'}} != {}
- {'DEPENDS': {'dbus'}}
+ {} : Some expected variables not found in recipe: {'DEPENDS': {'dbus'}}

Ensure dbus is built and present in the sysroot.

(From OE-Core rev: 28699b4257436fb6079eafe50ca8cab09a2fdd90)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-16 13:21:34 +01:00
Richard Purdie
ff282528be devtool: Ensure added layer sets LAYERSERIES_COMPAT
Now that we see warnings if LAYERSERIES_COMPAT is unset, the auto generated
code from devtool needs to set this to avoid warnings which break
various tests.

(From OE-Core rev: f65ebfeda0bfbac78e4a2a6609ba654ca38a8b0e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-07 22:33:19 +01:00
Robert Yang
598a4e9e85 selftest/cases/devtool.py: fix workspace layer checking
Fixed:
$ oe-selftest -r devtool.DevtoolTests.test_create_workspace
[snip]
2017-12-20 18:28:59,404 - oe-selftest - INFO - Traceback (most recent call last):
  File "/workspace2/lyang1/poky/meta/lib/oeqa/core/decorator/__init__.py", line 32, in wrapped_f
    return func(*args, **kwargs)
  File "/workspace2/lyang1/poky/meta/lib/oeqa/selftest/cases/devtool.py", line 177, in test_create_workspace
    self.assertTrue('/workspace' not in result.output, 'This test cannot be run with a workspace layer in bblayers.conf')
AssertionError: False is not true : This test cannot be run with a workspace layer in bblayers.conf
[snip]

$ bitbake-layers show-layers
NOTE: Starting bitbake server...
layer                 path                                      priority
==========================================================================
meta                  /workspace2/lyang1/poky/meta              5
meta-poky             /workspace2/lyang1/poky/meta-poky         5
meta-yocto-bsp        /workspace2/lyang1/poky/meta-yocto-bsp    5
meta-selftest         /workspace2/lyang1/poky/meta-selftest     5

There is no workspace layer, but I'm in /workspace2, this patch can fix the problem.

[YOCTO #12442]

(From OE-Core rev: 695b234ea4f034d428f8cffacceabc2b8f00bc74)

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>
2018-01-14 09:11:57 +00:00
Paul Eggleton
a77b6ee767 oe-selftest: devtool: switch away from mkelfimage
mkelfimage is about to be removed, so test_devtool_modify_git needs to
use a different recipe. psplash is a reasonable choice given it uses a
git repository (and probably will forever), and doesn't have too many
dependencies, so change the test to use that recipe instead.

(From OE-Core rev: daf583efc87faa058684dfe34df596d088caa8ef)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-02 17:24:37 +00:00
Paul Eggleton
6ef6326b37 oe-selftest: devtool: fix test for changes in lzo recipe
acinclude.m4 is about to be removed from the lzo recipe which breaks
test_devtool_update_recipe_local_files_2. Create a synthetic recipe in
meta-selftest with some local files and use that instead.

(From OE-Core rev: ed27470fa6a9f3cc1a0eb884474fe7985babde7a)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-10 22:45:20 +00:00
Richard Purdie
27eaabb35c oeqa: Markup further tests for stdout/stderr buffering
This further cleans up the output of oe-selftest so that runqemu output
is hidden unless tests fail.

(From OE-Core rev: efa064d5026538ab513edc11869364ce2f14b977)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:26 +00:00
Paul Eggleton
10af6d86b3 devtool: rework source extraction so that dependencies are handled
Since it was first implemented, devtool's source extraction (as used by
the devtool modify, extract and upgrade subcommands) ignored other recipe
dependencies - so for example if you ran devtool modify on a recipe that
fetches from svn or is compressed using xz then it would fail if those
dependencies hadn't been built first. Now that we can execute tasks in
the normal way (i.e. tinfoil.build_targets()) then we can rework it to
use that. This is slightly tricky in that the source extraction needs to
insert some logic in between tasks; luckily we can use a helper class
that conditionally adds prefuncs to make that possible.

Some side-effects / aspects of this change worth noting:
* Operations are a little slower because we have to go through the task
  dependency graph generation and other startup processing. There's not
  really any way to avoid this though.
* devtool extract didn't used to require a workspace, now it does
  because it needs to create a temporary bbappend for the recipe. (As
  with other commands the workspace be created on the fly if it doesn't
  already exist.)
* I want any existing sysroot files and stamps to be left alone during
  extraction since we are running the tasks off to the side, and
  especially devtool extract should be able to be used without touching
  these. However, this was hampered by the automatic removal process in
  sstate.bbclass triggered by bb.event.ReachableStamps when the task
  signatures change, thus I had to introduce a way to disable this
  removal on a per-recipe basis (we still want it to function for any
  dependencies that we aren't working on). To implement this I elected
  to use a file written to tmp/sstate-control which gets deleted
  automatically after reading so that there's less chance of stale files
  affecting future sessions. I could have used a variable but this would
  have needed to be whitelisted and I'd have to have poked its value in
  using the setVariable command.

Fixes [YOCTO #11198].

(From OE-Core rev: 830dbd66992cbb9e731b48d56fddf8f220349666)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:29 +01:00
Paul Eggleton
92a08ae838 oe-selftest: devtool: fix test_devtool_add hanging on some machines
The code in scriptutils which implements the logic for running the
editor used by devtool edit-recipe looks at the VISUAL environment
variable before EDITOR, and thus if VISUAL is set in the environment it
will override the EDITOR value we are setting here, the editor (usually
vim) launches and there's nothing to stop it running forever short of
manually killing it. Set VISUAL instead to fix this.

Apparently VISUAL is in fact the variable we should really be preferring
here - I don't think I knew that but somehow I got it right in the code,
just not in the test. Here are the details for the curious:

  https://unix.stackexchange.com/questions/4859/visual-vs-editor-whats-the-difference

Fixes [YOCTO #12074].

(From OE-Core rev: 6a7c50def569b5e86aa17bd9b287e8c63781dcb0)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-13 21:59:55 +01:00
Jose Perez Carranza
fae168d288 selftest/devtool: Avoid writing on TOPDIR on kernel test case
Use a tempdir to copy the .config file from the kernel instead of being
copied to build directory.

(From OE-Core rev: ccccf975c75055639c0ed5052ac0ad53ebbf53ca)

Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-12 23:55:29 +01:00
Paul Eggleton
3be475019f oe-selftest: devtool: test find-recipe and edit-recipe
We weren't testing the devtool find-recipe and edit-recipe subcommands,
with the result that when they regressed recently we didn't notice. Add
some code into the test_devtool_add to test this (since we need a
recipe in the workspace, and adding a new test with all that preamble
would seem a bit excessive for these simple checks). Also take the
opportunity to refactor the test a little bit so that the recipe name
and version are variables rather than hardcoding them everywhere.

(From OE-Core rev: 355d8f42679e37610c2947dece597ed7db774bee)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Jussi Kukkonen
ad0d9ce3c6 selftest/devtool: Don't use removed remake as test case
remake was removed from oe-core: use another recipe in the devtool
extract test.

(From OE-Core rev: dbf680ce09ce54f97c781fc7a8e5e05ed4706073)

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-28 15:52:17 +01:00
Jose Perez Carranza
ab0780dfea selftest: Add Testopia ID to test cases
Add decorator @OETestID() with proper Tesopia TC ID to the test cases
that did not have it set.

(From OE-Core rev: d7bc697534db911a3ce98537d772d87482a0f702)

Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-23 11:44:12 +01:00
Yeoh Ee Peng
f822525c58 selftest/devtool: replace file assertTrue/False with assertExists/NotExists
Current osselftest print confusing assertion message when using
self.assertTrue(os.path.exists(filepath)) to test file path,
example of confusing assertion message:
	AssertionError: False is not true

Replce assertTrue/assertFalse with assertExists/assertNotExists to test
file path, this will improve assertion message and simplify coding,
self.assertExists(filepath) will print below
	AssertionError: <filepath> does not exist

[YOCTO #11356]

(From OE-Core rev: 08b0702492536d41d3cf2c9c05d1fab36d32a566)

Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-23 11:44:12 +01:00
Jose Perez Carranza
38c06ab450 selftest/devtool: Modify test to use default config
Modify “test_devtool_virtual_kernel_modify” to be executed with default
configuration defined on oe-selftest test suite. A shorter string was
added to the the header file to avoid overlapped sections when building
kernel for qemux86-64.

[Yocto #11300]

(From OE-Core rev: a8bda790fded43eac72b2ad76d47c27363f02070)

Signed-off-by: Jose Perez Carranza <jose.perez.carranza@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-09 17:12:14 +01:00
Leonardo Sandoval
157c3be2ca oeqa/selftest/cases: Migrate test cases into the new oe-qa framework
New framework has different classes/decorators so adapt current test cases to
support these. Changes include changes on base classes and decorators.

Also include paths in selftest/__init__.py isn't needed because the
loader is the standard unittest one.

(From OE-Core rev: ddbbefdd124604d10bd47dd0266b55a764fcc0ab)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-06 19:02:43 +01:00