summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/postactions.py
Commit message (Collapse)AuthorAgeFilesLines
* oeqa/postactions: Fix archive retrieval from targetMathieu Dubois-Briand2024-09-201-0/+1
| | | | | | | | | | | | | A previous patch broke archive retrieval because of an undeclared variable. Declare the archive_name variable as expected. (From OE-Core rev: 0d0f3541552b073f3536176e2caf847bec24548d) Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org> CC: Alexis Lothoré <alexis.lothore@bootlin.com> CC: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/postactions: do not uncompress retrieved archive on hostAlexis Lothoré2024-08-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Current postaction module executes a remote tar command, pipe it in a SSH connection, and uncompress the raw stream with another tar command. With this command, the whole artifacts tree is directly available on the host executing the test, but it is not very convenient if we want to download the whole retrieved ptests directory. Stop uncompressing the retrieved ptests archive onto host, just save the archive as it is. The new output then looks like the following: tmp/log/oeqa-artefacts └── oeqa-target-artefacts-20240812-juzqdb80 ├── host_disk_usage.txt ├── target_disk_usage.txt └── tests_artifacts.tar.gz Suggested-By: Alexandre Belloni <alexandre.belloni@bootlin.com> (From OE-Core rev: f90894d996c8a8f980e46c87b7968b176793b3fe) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/postactions: fix exception handlingAlexis Lothoré2024-08-131-1/+1
| | | | | | | | | | | | | | | The current exception handler in list_and_fetch_failed_tests_artifacts expects a non-exisiting variable and then fail to display the original exception message since it raises a new one. The issue has been introduced with commit 6e80b2ab660e ("oeqa/utils/postactions: transfer whole archive over ssh instead of doing individual copies"). Now that tests artifacts are now handled individually, there's no point of trying to print individual names in the exception. (From OE-Core rev: a50e72bb64fb8b0d14c23164eaeeabd9c271ac19) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/postactions: Separate artefact collection from test result collectionRichard Purdie2024-07-181-28/+25
| | | | | | | | | | | | | | | Combining the test result collection and artefact collection hasn't worked out well as the data has different life cycles, the artefacts can be large and we need to be able to clean them up on a different timescale. Separate them out to be controlled by a separate variable, OEQA_ARTEFACT_DIR. Also rework the code to inject a directory with a date/time and random component to allow builds to run in parallel. Pass function arguments to avoid re-reading variables. (From OE-Core rev: e1cf7e94c3fcbe7dbc29e4286f0e1014b95964a9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* testimage/postactions: Allow artifact collection to be skippedRichard Purdie2024-07-101-0/+5
| | | | | | | | | | | | | It does not always make sense to collect artifacts and data from the target on failure, e.g. if testing firmware or if the target is not running an SSH server. Allow this by setting TESTIMAGE_FAILED_QA_ARTIFACTS to an empty value. (From OE-Core rev: 7036f814baa6550e0b1ac2db37fcd51960ee9e48) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/postactions: transfer whole archive over ssh instead of doing ↵Alexis Lothoré2024-07-081-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | individual copies Fixes [YOCTO 15536] The postactions retrieval actions currently rely on scp executed individually on any file or directory expanded from TESTIMAGE_FAILED_QA_ARTIFACTS. Unfortunately, symlinks are not preserved with this mechanism, which lead to big storage space consumption. Things may go even worse if those symlinks create some circular chains. This mechanism then needs to be updated to preserve symlinks instead of following them during copy. There are multiple ways to do it: - create a local archive on the target and execute scp on this file - use rsync instead of scp for all files - create an archive and pipe it to ssh instead of storing it onto the target The first solution may create pressure on targets storage space, while the second assumes that rsync is installed on the target, which may not be true. So the third one is a compromise: tar is very likely present, at least through busybox, and no disk space is used on the target. Replace the current per-file scp call by a single call to tar run on the target. Retrieve the generated compressed archive directly from SSH output, and feed it to another tar process but on host, to uncompress and extract it at the same place as before. (From OE-Core rev: 4aeb10aa38efc6768928fbb74985e36e972b8e46) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/postactions: Do not use -l option with dfKhem Raj2024-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | -l option is specific to df provided by coreutils, if df applet from busybox is used then it does not work and fails like below Fixes df: invalid option -- 'l' BusyBox v1.36.1 () multi-call binary. Usage: df [-PkmhT] [-t TYPE] [FILESYSTEM]... DEBUG: [Command returned '1' after 0.71 seconds] DEBUG: Command: df -hl Status: 1 Output: df: invalid option -- 'l' it seems worth a compromise to show remote mounted filesystems if any during ptests and it works with both df implementations (From OE-Core rev: 75cc1ea4348a2294fdc5ab20530fcff27056ff06) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/lib/utils/postactions: fix host disk usage stats retrievalAlexis Lothoré2024-02-291-1/+1
| | | | | | | | | | | | | | | | | | The recently introduced postactions module can raise, on failing ptests, the following warning: WARNING: core-image-ptest-glib-2.0-1.0-r0 do_testimage: Can not get host disk usage: [Errno 2] No such file or directory: '/usr/bin/df' The issue is likely not happening because of df absence (to be confirmed amongst the variety of workers) but because of the wrong path. Fix it by letting subprocess search for df, passing only the binary name. To make it work, we also have to reset the environment, otherwise the environment configured before running bitbake will be used, and search will fail. (From OE-Core rev: da7cc5def2839a0e15d07244f858847479c12caa) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/postactions: testimage: add host disk usage stat as post actionAlexis Lothoré2024-02-271-1/+12
| | | | | | | | | | | | | | Since the target under test can be a virtualized guest, when some tests fail because of disk usage (see [1]), also fetch disk usage statistics from host to allow checking whether a host disk space saturation could affect running tests. [1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=15220 (From OE-Core rev: 2ab3a0935b1e7a016402f149da1fc01b38d7af55) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/postactions: add target disk usage stat as post actionAlexis Lothoré2024-02-271-1/+16
| | | | | | | | | | | | | In order to debug issues related to disk space (see [1]), add a failed tests post action to retrieve disk usage on the target. Rely on the test context object to run the corresponding command onto the target [1] https://bugzilla.yoctoproject.org/show_bug.cgi?id=15220 (From OE-Core rev: 637e216b0e5191571270aa07e1f50a6e41a8c08f) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/postactions: isolate directory creation in dedicated actionAlexis Lothoré2024-02-271-6/+10
| | | | | | | | | | | | | | | In order to be able to create actions that could store new files during failed test post actions, we need to split artifacts directory creation from artifacts retrieval. Create a new dedicated action to create artifacts main directory so we can add actions creating files in this new directory, without worrying about actions order if at least this action is set first. (From OE-Core rev: 5d796586a9342f4f984494a5b493dbaf77af7026) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* testimage: create a list of failed test post actionsAlexis Lothoré2024-02-271-0/+68
testimage is able to detect whenever a test run leads to some tests failing, and execute some actions in this case. The only action currently defined in such case is to retrieve artifacts from the target under test, as listed in TESTIMAGE_FAILED_QA_ARTIFACTS In order to be able to add multiple actions, define a central function to gather all "post actions" to run whenever a test has failed (run_failed_tests_post_actions). This function contains a table listing all functions to be called whenever a test fails. Any function in this table will be provided with bitbake internal data dictionary ("d") and the current runtime testing context ("tc"). Isolate all this feature in a dedicated postactions.py file inherited by testimage. This patch does not bring any functional change. (From OE-Core rev: c01aa8df0613a103859b4431d3cc5056b2fef1b8) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>