aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2023-10-13patchtest/lib: remove supporting modulesTrevor Gamblin
patchtest is being moved to oe-core, so remove these to avoid maintaining two copies. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
2023-09-21patchtest: Add option to log resultsTrevor Gamblin
Add a --log-results option that will generate a logfile matching the tested patch's name but with ".testresults" appended, containing all of the same result lines seen in a manual run (except for bitbake-specific information). Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
2023-09-21patchtest: remove --json optionTrevor Gamblin
There are currently two output formats, one of which is similar to how ptest results are formatted and one optional JSON-style output that is selected with the --json flag. To simplify the patchtest codebase, one should be removed - in this case, the JSON format so that other tools expecting the ptest-style results (e.g. patchtest selftests in oe-core) continue to work. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
2023-09-13patchtest: allow directory instead of single patchTrevor Gamblin
The patchtest script requires a patch argument, but cannot handle a directory or list of files. Add a mutual exclusion group in the argument parser that allows a directory or a single patch, then make patchtest iterate over the list of resulting files (which will consist of a single element if only one patch is provided). Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
2023-09-07patchtest: Remove stdin patch handlerTrevor Gamblin
The legacy PatchTestStdIn class and associated functions were intended to allow patches to be sent from stdin, but the logic causes issues with automation of selftests and other non-interactive workflows. Remove the code in the patchtest script, and strip out the PatchTestStdIn class since it is then no longer needed. Also rename the PatchTestArgs class to PatchTestInput, since the original PatchTestInput class isn't needed to wrap PatchTestArgs alone and provides the same functionality anyway. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
2023-08-25patchtest: refactor and simplify modulesTrevor Gamblin
The current layout of patchtest is inconsistent in module and class naming, as well as inter-dependencies. Start making the code more maintainable by: - Simplifying module names to remove namespacing - Add namespacing to the classes themselves - Make imports of classes explicit, instead of using aliases like "pti" Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
2023-08-17patchtestdata.py: move to lib directoryTrevor Gamblin
There's no real reason to keep the patchtestdata module in the root directory given its similarity to the modules already present in lib. Move it there to keep the repo more organized. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
2019-08-13patchtest: Fix handling of line endingsRicardo Neri
Patchtest wasn't applying some patches because of the line endings EDK2 uses. If patchest used git am --keep-cr the patches would apply cleanly. Also the Patch class in lib/patchestpatch.py in the patch test repo reads the patch using f.read() with the newline parameter implicitly set to None and this causes newlines to be translated from \r\n into \n. Hence, when applying the patch with git am it fails; even when using --keep-cr. I was able to pass the patchtest tests with this change. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-05patchtest: adds universal_newlines argument to subprocessDaniela Plascencia
The input argument that's passed to the subprocess stdin must be a byte sequence, but in this case it is passed as a string, thus universal_newlines must be set as True. The she-bang is also changed to refelect the Python version to be used, or removed from the head if the file is not executed.. Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com>
2017-06-05patchtest: removes she-bang from head of filesDaniela Plascencia
These files are not executed at all, no need for a she-bang to be written on them. Signed-off-by: Daniela Plascencia <daniela.plascencia@linux.intel.com>
2017-01-23lib/patchtestrepo: use git-am instead of git-apply to check if a series can ↵Leonardo Sandoval
be applied At least there is one series detected [1] that fails to be applied with git-apply but works with git-am (no explanation so far), so use the latter. [1] https://patchwork.openembedded.org/series/4272/ Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2017-01-16lib/patchtestrepo: validate patch's branch before setting it as targetLeonardo Sandoval
In a few cases, patch subjects include prefixes that correspond to the target [1], so patchtest assumes this is the target branch. To avoid the latter, check patch branch against remote branches. [1] https://patchwork.openembedded.org/series/4802/ Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2017-01-06patchtest: cleans import statementsDaniela Plascencia
Cleans import statements to improve readability. [YOCTO #10795] Signed-off-by: Daniela Plascencia <daniela.plascencia@intel.com>
2017-01-05lib/utils: use mailbox module instead of regex for subject parsingLeonardo Sandoval
Using a module for parsing mboxes is much safer than custom parsing. In this case the mailbox module is used to get the subject and from it a regex is used to get the prefix. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-11-30lib: better log names for target commit/branchLeonardo Sandoval
Target commit and branch are set depending the context, so base names may not match target ones. Use target instead of base at least for the logging part. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-11-30lib: include command line branch before patch branchLeonardo Sandoval
Specify command line arguments have greater preference that the rest. In this case, if commit is not given through the command line, look for the branch (also from the cmd line) before going into the rest (patch data, then current repo) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-11-30lib: use specify branch instead of branch hashLeonardo Sandoval
If user either specify the branch through the command line or through the patch, use that data instead of the branch hash, allowing a more useful target branch on reports. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-11-30lib: move to master in case patchtest starts from a detached branchLeonardo Sandoval
patchtest creates a temporal branch to do its work and at the end it moves back to the branch where it started. Default to master in case initial repo state is detached. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-11-30lib: improve cmd debug logging when an exception occursLeonardo Sandoval
If a particular command fails, the system needs to show at least what the command was. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-11-15Tidy up importsPaul Eggleton
Importing the functions directly from Python modules such as re and os is unusual, not to mention that Python has a built-in compile() function already. Improve readability by importing the modules as normal and calling functions within them. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-11lib: Drop unused importsPaul Eggleton
These trigger dependencies on GitPython and requests and aren't actually being used right now, so remove them. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-11-11Use correct shebangPaul Eggleton
If we point to /usr/bin/python we break the ability to use the scripts within virtualenv, so use /usr/bin/env python instead. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-10-31lib: include specify branch tag if present on patch on target commitLeonardo Sandoval
With this change, merge works correctly on non-master branches. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-08-30patchtest: include two repo properties (ismerged and canbemerged)Leonardo Sandoval
This two properties can help the suite to decide to execute or not a test method. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-08-26repo: include patchmerge as propertyLeonardo Sandoval
Post-merge test methods can check this boolean variable and decide to skip or continue its execution. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-08-23lib/patchtestrepo: do not print error messages on merge failureLeonardo Sandoval
If patch cannot be merged, system should not log warn/error the user because patchtest keeps testing even if merge fails. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-08-22patchtest: remove all brach logicLeonardo Sandoval
brach logic is not really useful for patches that do not merge into the repository but still we need to report results. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-08-18patchtest: run post-merge test methods even if merge failsLeonardo Sandoval
This is a big change, in the sense that a failure in the merging phase will not stop the post-merge test methods to be run. This means that test suite should check if patch is merge or not based on the repository's HEAD ID. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-07-28patchtest: remove all related summary codeLeonardo Sandoval
patchtest is not longer resposible of posting data into the patchwork, so removing all related code. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-07-26patchtest: include Intel Copyright and GPLv2 license to all relevant filesLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-07-08patchtest: remove posting logicLeonardo Sandoval
All posting logic will be done outside patchtest. Patchtest should just test local patchtest, nothing more. Fetching and Posting to patchwork should be done in another project, and for the OE-Core this project will be patchtest-oe Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-07-01lib/utils.py: logging goes out through stderrLeonardo Sandoval
patchtest results should go through stdout so other commands can take it as input and patchtest logging should go through another channel: stderr Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-07-01lib/patchtestrepo.py: clean output on exceptionLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-06-23lib/patchtestrepo: look branch name in remotesLeonardo Sandoval
if target branch is located on patch, branch also in all remotes. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-06-22patchtest: Output just failed test casesLeonardo Sandoval
Also remove the '--quiet' because we need to at least print those failed test cases with the info level. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-06-22lib/utils.py: remove unnecessary codeLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-06-22patchtest: interpret stdin as patch dataLeonardo Sandoval
This patch contains another change regarding the patchtest libraries: include the a'patchtest' prefix on each one. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-06-22patch: rename packageLeonardo Sandoval
In the past, patchtest has the concept of item, which was an abstraction for mboxes and series. Currently, only mboxes are supported so the abstraction is a 'patch'. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-06-22patchtest: accept just one patch through the command lineLeonardo Sandoval
patchtest was too confusing having multiple type of inputs, so lets use just a single input coming from the command line indicating the patch filename. This implies many changes: all code related to patchwork series is removed. From now on, all fetching should be done using the git-pw tool, so we do not duplicate code. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-06-06patchtest, lib/summary: Set the default summary class to tabulateLeonardo Sandoval
At this stage of the problem, we need a simple table with test results and ids, so the tabulate class is more suited for this need. In the near future, we need a way to indicate the summary format from the command line
2016-06-03lib/utils.py: specify stdout to the stream handlerLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-05-24mboxitem.py: move mboxitem classes into a single file and remove parsing ↵Leonardo Sandoval
item code All parsing logic is removed from the patchtest (patchtest should not do any item parsing, it is not designed for that). In case parsing is neeeded, this task should be done in the test suite code. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-04-27Filter POST requests by submitterLeonardo Sandoval
Instead of a simple boolean parameter to turn on or off POSTing, change the 'post' argument to 'include-post-users' which is string indicating a regex; if any of the items's submitter match the regex, then the POST request is done. By default the regex is empty, so no posting is done. This patch just supports patchwork series, not local mboxes. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-04-27repo: Check if patchwork instance is aliveLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-04-26repo: move statement after git check thus self._url is set correctlyLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-04-22repo: Use mbox subject's branch if presentLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-04-22repo: better name for function that obtains current branchLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-04-11repo: include revision into URLLeonardo Sandoval
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-03-17hooks: two git hooks that allows appending the item's url into the commit msgLeonardo Sandoval
When patchtest applies each item (series or mbox), it is useful to keep track where the item came from (PW or local file), so appending the item URL into the commit message. Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
2016-03-17lib/utils: append enviroment variables to the subprocessLeonardo Sandoval
Useful when including new environment variables to a subprocess (besides the ones already present on current process environment)