summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/sdkmingw/testsdk.py
blob: 85fe3c6a0f011543363b8723b1238a5d2a17307e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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'
            }