summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrevor Gamblin <tgamblin@baylibre.com>2023-09-13 13:00:47 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-14 15:20:08 +0100
commit0cf17394f8c8d01237643c99e0b48329826b376e (patch)
treecbc8e0bea7d02a75549f2002f7c80b979f1b90eb
parent4a6f38c5327b40a45c340af49fee9a0d5cc890bd (diff)
downloadpoky-0cf17394f8c8d01237643c99e0b48329826b376e.tar.gz
patchtest/selftest: remove configurable target
The ability to pass the target (i.e. oe-core) as an argument was a testing mechanism and isn't needed when the tests are part of the repo, so remove it and use os.path.dirname to get it instead. (From OE-Core rev: 87c54eae350e358f32b12ae807719fa845fd54af) Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xmeta/lib/patchtest/selftest/selftest14
1 files changed, 6 insertions, 8 deletions
diff --git a/meta/lib/patchtest/selftest/selftest b/meta/lib/patchtest/selftest/selftest
index c2e6b4863d..ba8e1623ee 100755
--- a/meta/lib/patchtest/selftest/selftest
+++ b/meta/lib/patchtest/selftest/selftest
@@ -15,6 +15,9 @@ patchesdir = os.path.join(currentdir, 'files')
15topdir = os.path.dirname(currentdir) 15topdir = os.path.dirname(currentdir)
16parentdir = os.path.dirname(topdir) 16parentdir = os.path.dirname(topdir)
17 17
18# path to the repo root
19repodir = os.path.dirname(os.path.dirname(parentdir))
20
18def print_results(passcount, skipcount, failcount, xpasscount, xfailcount, errorcount): 21def print_results(passcount, skipcount, failcount, xpasscount, xfailcount, errorcount):
19 total = passcount + skipcount + failcount + xpasscount + xfailcount + errorcount 22 total = passcount + skipcount + failcount + xpasscount + xfailcount + errorcount
20 print("============================================================================") 23 print("============================================================================")
@@ -30,21 +33,16 @@ def print_results(passcount, skipcount, failcount, xpasscount, xfailcount, error
30 print("============================================================================") 33 print("============================================================================")
31 34
32# Once the tests are in oe-core, we can remove the testdir param and use os.path.dirname to get relative paths 35# Once the tests are in oe-core, we can remove the testdir param and use os.path.dirname to get relative paths
33def test(root, patch, testdir): 36def test(root, patch):
34 res = True 37 res = True
35 patchpath = os.path.abspath(os.path.join(root, patch)) 38 patchpath = os.path.abspath(os.path.join(root, patch))
36
37 39
38 cmd = 'patchtest %s %s/tests --patch %s' % (testdir, topdir, patchpath) 40 cmd = 'patchtest %s %s/tests --patch %s' % (repodir, topdir, patchpath)
39 results = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True, shell=True) 41 results = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True, shell=True)
40 42
41 return results 43 return results
42 44
43if __name__ == '__main__': 45if __name__ == '__main__':
44 # sys.argv[1] should be the repo to target for selftest, i.e. oe-core
45 if len(sys.argv) == 1:
46 sys.exit("Error: Must provide the path to openembedded-core, e.g. \"selftest /workspace/yocto/openembedded-core\"")
47
48 passcount = 0 46 passcount = 0
49 failcount = 0 47 failcount = 0
50 skipcount = 0 48 skipcount = 0
@@ -56,7 +54,7 @@ if __name__ == '__main__':
56 54
57 for root, dirs, patches in os.walk(patchesdir): 55 for root, dirs, patches in os.walk(patchesdir):
58 for patch in patches: 56 for patch in patches:
59 results = test(root, patch, sys.argv[1]) 57 results = test(root, patch)
60 58
61 a = patch.split('.') 59 a = patch.split('.')
62 klass, testname = a[0], a[1] 60 klass, testname = a[0], a[1]