From e2316a81b91f839496fa98bf4e6c21e7d9455469 Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Wed, 14 Nov 2018 21:38:51 -0600 Subject: 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 --- lib/oeqa/sdkmingw/testsdk.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lib/oeqa/sdkmingw/testsdk.py (limited to 'lib/oeqa/sdkmingw/testsdk.py') 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 @@ +# Copyright 2018 by Garmin Ltd. or its subsidiaries +# Released under the MIT license (see COPYING.MIT) + +from oeqa.sdk.testsdk import TestSDK +from oeqa.sdkmingw.context import OESDKMinGWTestContext, OESDKMinGWTestContextExecutor + +class TestSDKMinGW(TestSDK): + context_executor_class = OESDKMinGWTestContextExecutor + context_class = OESDKMinGWTestContext + + def get_tcname(self, d): + """ + Get the name of the SDK file + """ + return d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.xz") + + def extract_sdk(self, tcname, sdk_dir, d): + """ + Extract the SDK to the specified location + """ + import subprocess + + try: + # TODO: It would be nice to try and extract the SDK in Wine to make + # sure it is well formed + subprocess.check_output(['tar', '-xf', tcname, '-C', sdk_dir]) + except subprocess.CalledProcessError as e: + bb.fatal("Couldn't install the SDK:\n%s" % e.output.decode("utf-8")) + + def setup_context(self, d): + """ + Return a dictionary of additional arguments that should be passed to + the context_class on construction + """ + wine_prefix = d.getVar('TESTSDK_WINEPREFIX') or d.expand('${WORKDIR}/testimage-wine/') + bb.utils.remove(wine_prefix, True) + + return { + 'wine_prefix': wine_prefix, + 'wine_arch': d.getVar('TESTSDK_WINEARCH') or 'win64' + } + -- cgit v1.2.3-54-g00ecf