summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTrevor Gamblin <tgamblin@baylibre.com>2023-10-16 15:44:58 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-17 11:06:15 +0100
commitbae7421ece4806f5148f164293810b9fe75e0756 (patch)
treeb526a9262ad15b7c89cb27668655c32a2b46e320 /scripts
parentcf318c3c05fc050b8c838c04f28797325c569c5c (diff)
downloadopenembedded-core-bae7421ece4806f5148f164293810b9fe75e0756.tar.gz
patchtest: set default repo and testdir targets
Since patchtest is in oe-core, the Python os module's methods can be used to retrieve the repository path and tests directory by default. This reduces the number of mandatory arguments for invocation of patchtest unless the user wants to use a custom test suite or test patches against a different repo. The REPO and TESTDIR arguments are likewise adjusted so that they are optional. Also, make it more obvious what the --startdir flag is meant for on the command line by renaming it to --testdir, and update the scripts/patchtest.README file to be consistent with the new usage. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/patchtest6
-rw-r--r--scripts/patchtest.README10
2 files changed, 10 insertions, 6 deletions
diff --git a/scripts/patchtest b/scripts/patchtest
index 9525a2be17..b25ef18321 100755
--- a/scripts/patchtest
+++ b/scripts/patchtest
@@ -142,7 +142,7 @@ def _runner(resultklass, prefix=None):
loader.testMethodPrefix = prefix
# create the suite with discovered tests and the corresponding runner
- suite = loader.discover(start_dir=PatchTestInput.startdir, pattern=PatchTestInput.pattern, top_level_dir=PatchTestInput.topdir)
+ suite = loader.discover(start_dir=PatchTestInput.testdir, pattern=PatchTestInput.pattern, top_level_dir=PatchTestInput.topdir)
ntc = suite.countTestCases()
# if there are no test cases, just quit
@@ -220,9 +220,9 @@ if __name__ == '__main__':
if PatchTestInput.debug:
logger.setLevel(logging.DEBUG)
- # if topdir not define, default it to startdir
+ # if topdir not define, default it to testdir
if not PatchTestInput.topdir:
- PatchTestInput.topdir = PatchTestInput.startdir
+ PatchTestInput.topdir = PatchTestInput.testdir
try:
ret = main()
diff --git a/scripts/patchtest.README b/scripts/patchtest.README
index 689d513df5..ad46b02ad6 100644
--- a/scripts/patchtest.README
+++ b/scripts/patchtest.README
@@ -79,15 +79,19 @@ To run patchtest on the host, do the following:
or patchtest-get-series
3. Run patchtest on a patch file by doing the following:
- patchtest --patch /path/to/patch/file /path/to/target/repo /path/to/tests/directory
+ patchtest --patch /path/to/patch/file
or, if you have stored the patch files in a directory, do:
- patchtest --directory /path/to/patch/directory /path/to/target/repo /path/to/tests/directory
+ patchtest --directory /path/to/patch/directory
For example, to test `master-gcc-Fix--fstack-protector-issue-on-aarch64.patch` against the oe-core test suite:
- patchtest --patch master-gcc-Fix--fstack-protector-issue-on-aarch64.patch /path/to/openembedded-core /path/to/openembedded-core/meta/lib/patchtest/tests
+ patchtest --patch master-gcc-Fix--fstack-protector-issue-on-aarch64.patch
+
+ If you want to use a different test suite or target repository, you can use the --testdir and --repodir flags:
+
+ patchtest --patch /path/to/patch/file --repodir /path/to/repo --testdir /path/to/test/dir
### Guest Mode