aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/runner.py
AgeCommit message (Collapse)Author
2018-10-29oeqa/core/runner: Don't add empty log entriesRichard Purdie
There is no point in adding empty log entries to the json result files, only add them if there is log data. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-29oeqa/core/runner: write testresult to json filesYeoh Ee Peng
As part of the solution to replace Testopia to store testresult, OEQA need to output testresult into single json file, where json testresult file will be stored in git repository by the future test-case-management tools. The json testresult file will store more than one set of results, where each set of results was uniquely identified by the result_id. The result_id would be like "runtime-qemux86-core-image-sato", where it was a runtime test with target machine equal to qemux86 and running on core-image-sato image. The json testresult file will only store the latest test content for a given result_id. The json testresult file contains the configuration (eg. COMMIT, BRANCH, MACHINE, IMAGE), result (eg. PASSED, FAILED, ERROR), test log, and result_id. Based on the destination json testresult file directory provided, it could have multiple instances of bitbake trying to write json testresult to a single testresult file, using locking a lockfile alongside the results file directory to prevent races. Also the library class inside this patch will be reused by the future test-case-management tools to write json testresult for manual test case executed. Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18oeqa/core/runner: refactor for OEQA to write json testresultYeoh Ee Peng
Refactor the original _getDetailsNotPassed method to return testresult details (test status and log), which will be reused by future OEQA code to write json testresult. Take the opportunity to consolidate and simplify the logic used to gather test status and log within the TestResult instance. Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23oeqa/runner: Print any errors/failures earlyRichard Purdie
Its a pain to have to wait until oe-selftest finishes to see the failures for example. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23oeqa/runner: Use the proper logger functions instead of print()Richard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-16oeqa: Remove xmlrunnerRichard Purdie
This isn't present on modern distros by default and doesn't work with testtools, needing multiple code paths in the code. Remove it in favour of finding a better replacement for results collection/analysis. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-16oeqa/runner: Simplify codeRichard Purdie
There doesn't appear to be any reason we need this _results indirection any more so remove it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-16oeqa: Add selftest parallelisation supportRichard Purdie
This allows oe-selftest to take a -j option which specifies how much test parallelisation to use. Currently this is "module" based with each module being split and run in a separate build directory. Further splitting could be done but this seems a good compromise between test setup and parallelism. You need python-testtools and python-subunit installed to use this but only when the -j option is specified. See notes posted to the openedmbedded-architecture list for more details about the design choices here. Some of this functionality may make more sense in the oeqa core ultimately. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-15oeqa: Default to buffer mode for testsRichard Purdie
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-13oeqa/runner: Ensure we don't print misleading results outputRichard Purdie
The current code assumes if something isn't a failure of some kind, it was a pass. When test case IDs weren't matching, this lead to very confusing output where things would fail, then be listed as passing. This adds code to track successes, ensuring we don't end up in this position again with unmatched entries being listed as UNKNOWN. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-13oeqa/core/runner: Improve test case comparisionRichard Purdie
We can directly compare the test case IDs rather than representations, then if we're using subunit to split the tests, the comparisions still work as intended. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-10oeqa/runner: Pass the value of buffer, don't force to TrueRichard Purdie
The value could be False in which case we should pass that through. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-09oeqa/runqemu: Only show stdout/stderr upon test failureRichard Purdie
In general we don't need to see the output of runqemu however if it fails we do. Use the buffer option that already exists in TestResult but allow us to trigger it on a per test basis. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30oeqa/core/runner: OEStreamLogger don't buffer test execution writesAníbal Limón
Since OEQA framework uses Python logging functionality to report test results there is a class that wraps PyUnit writes into logging commands (OEStreamLogger), so don't buffer the actual test execution to have insight of what is currently executing. This fix will change a little the test output format adding an '\n' previous the test result, for example: From: test_nonmatching_checksum (lic_checksum.LicenseTests) ... ok To: test_nonmatching_checksum (lic_checksum.LicenseTests) ... ok This is because the new line added by the PyUnit StreamLogger because currently we don't have a manner to identify when a test execution starts at report level (write msg). [YOCTO #11827] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-13oeqa/core/runner: Don't log details twice if test failsAníbal Limón
The details of a test failure is upper on the unittest output so don't log twice the actual failure. [YOCTO #11622] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-12oeqa/core/loader: Allow unittest.TestCase's to be executedAníbal Limón
Currently there was a restriction to only execute tests that's inherits from OETestCase but in some circunstancies the features from the OEQA framework isn't needed so we need to support basic unittests. [YOCTO #10828] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2017-05-30oeqa/core: Add list tests support in context and runnerAníbal Limón
A common operation is to list tests, currently only selftest support it, this changes enables this functionality into the core framework. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/runner: OETestResult add internal _tc_map_resultsAníbal Limón
This method is to assign results into the TestContext, create an internal one to support change implementation in Thread version. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core: Move OETestContext.log{Summary, Details} into OETestResultAníbal Limón
Those methods are used to write in the log the results so it makes sense to have defined at OETestResult because is a format of the result itself. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core/runner: OETestResult remove unneeded override of startTestAníbal Limón
I override this method before for keep track of results and forget to remove it, now isn't need. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-30oeqa/core: Don't expose OEStreamLogger in OETestContextAníbal Limón
The OEStreamLogger class is used for redirect PyUnit output to a certain logger so there is not need to expose at level of OETestContext because only OETestRunner needs to know. [YOCTO #11450] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-12oeqa/core/runner: Append PID in the test result folder nameLeonardo Sandoval
It was found a case (see the bugzilla entry) where two runners were running at the same second, creating identical test result folders, so one of them (the second runner) was not able to create the folder because the other has already created it, raising the following exception (many text was removed from log) NOTE: Executing RunQueue Tasks NOTE: Running task 1 of 2 (/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-mips/build/meta/recipes-core/images/core-image-minimal.bb:do_testsdkext) NOTE: Running task 2 of 2 (/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-mips/build/meta/recipes-sato/images/core-image-sato.bb:do_testsdkext) NOTE: recipe core-image-sato-1.0-r0: task do_testsdkext: Started NOTE: recipe core-image-minimal-1.0-r0: task do_testsdkext: Started . . The stack trace of python calls that resulted in this exception/failure was: File: 'exec_python_func() autogenerated', lineno: 2, function: <module> 0001: *** 0002:do_testsdkext(d) 0003: File: '/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-mips/build/meta/classes/testsdk.bbclass', lineno: 188, function: do_testsdkext 0184: 0185:testsdkext_main[vardepsexclude] =+ "BB_ORIGENV" 0186: 0187:python do_testsdkext() { *** 0188: testsdkext_main(d) 0189:} 0190:addtask testsdkext 0191:do_testsdkext[nostamp] = "1" 0192: File: '/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-mips/build/meta/classes/testsdk.bbclass', lineno: 171, function: testsdkext_main 0167: except Exception as e: 0168: import traceback 0169: bb.fatal("Loading tests failed:\n%s" % traceback.format_exc()) 0170: *** 0171: result = tc.runTests() . . File: '/usr/lib64/python3.5/os.py', lineno: 241, function: makedirs 0237: cdir = bytes(curdir, 'ASCII') 0238: if tail == cdir: # xxx/newdir/. exists if xxx/newdir exists 0239: return 0240: try: *** 0241: mkdir(name, mode) 0242: except OSError: 0243: # Cannot rely on checking for EEXIST, since the operating system 0244: # could give priority to other errors like EACCES or EROFS 0245: if not exist_ok or not path.isdir(name): Exception: FileExistsError: [Errno 17] File exists: '/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-mips/build/build/TestResults_20170409130114' [YOCTO #11318] Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15oeqa/core/runner.py: OEStreamLogger fix loggingAníbal Limón
Change conditional to avoid losing stack traces when log into the logger. The logic only needs to don't log empty lines. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23oeqa/core: Add base OEQA frameworkAníbal Limón
case: Defines OETestCase base class that provides custom methods/attrs defined by the framework. Every OETestCase instance contains a reference to the test data (d), the test context (tc) and the logger. Also implements _oe{SetUp,TearDown}Class for make special handling of OEQA decorators and validations. runner: Defines OETestRunner/OETestResult with support for RAW and XML result logs. exception: Custom exceptions related to the OEQA framework based on class OEQAException. [YOCTO #10230] [YOCTO #10233] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>