diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2018-11-14 21:38:51 -0600 |
---|---|---|
committer | Joshua Watt <JPEWhacker@gmail.com> | 2018-11-21 11:11:41 -0600 |
commit | e2316a81b91f839496fa98bf4e6c21e7d9455469 (patch) | |
tree | 123611d18d227f5537e2a3db586e788c1fcd735d /lib/oeqa/sdkmingw/testsdk.py | |
parent | 1e20bc01111f5867f5a3d9c0905e31d3d7554ba5 (diff) | |
download | meta-mingw-e2316a81b91f839496fa98bf4e6c21e7d9455469.tar.gz |
Add SDK test case framework
Adds the framework for testing SDKs that ties into the oeqa test
framework. This allows commands like:
$ bitbake -c testsdk ...
to be run for MinGW SDKs.
The test framework currently executes all tests under Wine in lieu of
having access to actual Windows machines.
[YOCTO #13020]
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'lib/oeqa/sdkmingw/testsdk.py')
-rw-r--r-- | lib/oeqa/sdkmingw/testsdk.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/oeqa/sdkmingw/testsdk.py b/lib/oeqa/sdkmingw/testsdk.py new file mode 100644 index 0000000..85fe3c6 --- /dev/null +++ b/lib/oeqa/sdkmingw/testsdk.py | |||
@@ -0,0 +1,42 @@ | |||
1 | # Copyright 2018 by Garmin Ltd. or its subsidiaries | ||
2 | # Released under the MIT license (see COPYING.MIT) | ||
3 | |||
4 | from oeqa.sdk.testsdk import TestSDK | ||
5 | from oeqa.sdkmingw.context import OESDKMinGWTestContext, OESDKMinGWTestContextExecutor | ||
6 | |||
7 | class TestSDKMinGW(TestSDK): | ||
8 | context_executor_class = OESDKMinGWTestContextExecutor | ||
9 | context_class = OESDKMinGWTestContext | ||
10 | |||
11 | def get_tcname(self, d): | ||
12 | """ | ||
13 | Get the name of the SDK file | ||
14 | """ | ||
15 | return d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.xz") | ||
16 | |||
17 | def extract_sdk(self, tcname, sdk_dir, d): | ||
18 | """ | ||
19 | Extract the SDK to the specified location | ||
20 | """ | ||
21 | import subprocess | ||
22 | |||
23 | try: | ||
24 | # TODO: It would be nice to try and extract the SDK in Wine to make | ||
25 | # sure it is well formed | ||
26 | subprocess.check_output(['tar', '-xf', tcname, '-C', sdk_dir]) | ||
27 | except subprocess.CalledProcessError as e: | ||
28 | bb.fatal("Couldn't install the SDK:\n%s" % e.output.decode("utf-8")) | ||
29 | |||
30 | def setup_context(self, d): | ||
31 | """ | ||
32 | Return a dictionary of additional arguments that should be passed to | ||
33 | the context_class on construction | ||
34 | """ | ||
35 | wine_prefix = d.getVar('TESTSDK_WINEPREFIX') or d.expand('${WORKDIR}/testimage-wine/') | ||
36 | bb.utils.remove(wine_prefix, True) | ||
37 | |||
38 | return { | ||
39 | 'wine_prefix': wine_prefix, | ||
40 | 'wine_arch': d.getVar('TESTSDK_WINEARCH') or 'win64' | ||
41 | } | ||
42 | |||