All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-mingw][PATCH 0/4] Add oeqa test cases
@ 2018-11-15 19:23 Joshua Watt
  2018-11-16 11:50 ` Burton, Ross
  2018-11-19 21:17 ` [meta-mingw][PATCH v2 0/5] " Joshua Watt
  0 siblings, 2 replies; 9+ messages in thread
From: Joshua Watt @ 2018-11-15 19:23 UTC (permalink / raw)
  To: yocto

Adds the testing framework for tying tests for the MinGW SDK into the
oeqa SDK test framework. 

The SDK tests can be run using the standard SDK test command:

 bitbake -c testsdk <image>

All testing is done using Wine in lieu of having access to an actual
Windows machine. Wine is required to be installed on the host machine.

Joshua Watt (4):
  Add SDK test case framework
  Add .gitignore
  classes/toolchain-scripts-mingw32: Update variables
  oeqa/sdkmingw: Add test cases

 .gitignore                                  |   3 +
 classes/testsdk-mingw.bbclass               | 101 ++++++++++++++++++++
 classes/toolchain-scripts-mingw32.bbclass   |   4 +-
 conf/machine-sdk/i686-mingw32.conf          |   1 +
 conf/machine-sdk/include/mingw32-common.inc |   6 ++
 conf/machine-sdk/x86_64-mingw32.conf        |   1 +
 lib/oeqa/sdkmingw/__init__.py               |   0
 lib/oeqa/sdkmingw/case.py                   |  52 ++++++++++
 lib/oeqa/sdkmingw/cases/__init__.py         |   0
 lib/oeqa/sdkmingw/cases/binutils.py         |  57 +++++++++++
 lib/oeqa/sdkmingw/cases/gcc.py              |  49 ++++++++++
 lib/oeqa/sdkmingw/cases/gdb.py              |  20 ++++
 lib/oeqa/sdkmingw/context.py                |  66 +++++++++++++
 lib/oeqa/sdkmingw/files/testsdkmakefile     |   4 +
 14 files changed, 363 insertions(+), 1 deletion(-)
 create mode 100644 .gitignore
 create mode 100644 classes/testsdk-mingw.bbclass
 create mode 100644 lib/oeqa/sdkmingw/__init__.py
 create mode 100644 lib/oeqa/sdkmingw/case.py
 create mode 100644 lib/oeqa/sdkmingw/cases/__init__.py
 create mode 100644 lib/oeqa/sdkmingw/cases/binutils.py
 create mode 100644 lib/oeqa/sdkmingw/cases/gcc.py
 create mode 100644 lib/oeqa/sdkmingw/cases/gdb.py
 create mode 100644 lib/oeqa/sdkmingw/context.py
 create mode 100644 lib/oeqa/sdkmingw/files/testsdkmakefile

-- 
2.19.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [meta-mingw][PATCH 0/4] Add oeqa test cases
  2018-11-15 19:23 [meta-mingw][PATCH 0/4] Add oeqa test cases Joshua Watt
@ 2018-11-16 11:50 ` Burton, Ross
  2018-11-16 12:12   ` Joshua Watt
  2018-11-19 21:17 ` [meta-mingw][PATCH v2 0/5] " Joshua Watt
  1 sibling, 1 reply; 9+ messages in thread
From: Burton, Ross @ 2018-11-16 11:50 UTC (permalink / raw)
  To: Joshua Watt; +Cc: Yocto-mailing-list

I see the cover letter but no patches or link to a branch...

Ross
On Thu, 15 Nov 2018 at 19:24, Joshua Watt <jpewhacker@gmail.com> wrote:
>
> Adds the testing framework for tying tests for the MinGW SDK into the
> oeqa SDK test framework.
>
> The SDK tests can be run using the standard SDK test command:
>
>  bitbake -c testsdk <image>
>
> All testing is done using Wine in lieu of having access to an actual
> Windows machine. Wine is required to be installed on the host machine.
>
> Joshua Watt (4):
>   Add SDK test case framework
>   Add .gitignore
>   classes/toolchain-scripts-mingw32: Update variables
>   oeqa/sdkmingw: Add test cases
>
>  .gitignore                                  |   3 +
>  classes/testsdk-mingw.bbclass               | 101 ++++++++++++++++++++
>  classes/toolchain-scripts-mingw32.bbclass   |   4 +-
>  conf/machine-sdk/i686-mingw32.conf          |   1 +
>  conf/machine-sdk/include/mingw32-common.inc |   6 ++
>  conf/machine-sdk/x86_64-mingw32.conf        |   1 +
>  lib/oeqa/sdkmingw/__init__.py               |   0
>  lib/oeqa/sdkmingw/case.py                   |  52 ++++++++++
>  lib/oeqa/sdkmingw/cases/__init__.py         |   0
>  lib/oeqa/sdkmingw/cases/binutils.py         |  57 +++++++++++
>  lib/oeqa/sdkmingw/cases/gcc.py              |  49 ++++++++++
>  lib/oeqa/sdkmingw/cases/gdb.py              |  20 ++++
>  lib/oeqa/sdkmingw/context.py                |  66 +++++++++++++
>  lib/oeqa/sdkmingw/files/testsdkmakefile     |   4 +
>  14 files changed, 363 insertions(+), 1 deletion(-)
>  create mode 100644 .gitignore
>  create mode 100644 classes/testsdk-mingw.bbclass
>  create mode 100644 lib/oeqa/sdkmingw/__init__.py
>  create mode 100644 lib/oeqa/sdkmingw/case.py
>  create mode 100644 lib/oeqa/sdkmingw/cases/__init__.py
>  create mode 100644 lib/oeqa/sdkmingw/cases/binutils.py
>  create mode 100644 lib/oeqa/sdkmingw/cases/gcc.py
>  create mode 100644 lib/oeqa/sdkmingw/cases/gdb.py
>  create mode 100644 lib/oeqa/sdkmingw/context.py
>  create mode 100644 lib/oeqa/sdkmingw/files/testsdkmakefile
>
> --
> 2.19.1
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [meta-mingw][PATCH 0/4] Add oeqa test cases
  2018-11-16 11:50 ` Burton, Ross
@ 2018-11-16 12:12   ` Joshua Watt
  0 siblings, 0 replies; 9+ messages in thread
From: Joshua Watt @ 2018-11-16 12:12 UTC (permalink / raw)
  To: Burton, Ross; +Cc: Yocto list discussion

[-- Attachment #1: Type: text/plain, Size: 2460 bytes --]

On Fri, Nov 16, 2018, 5:50 AM Burton, Ross <ross.burton@intel.com wrote:

> I see the cover letter but no patches or link to a branch...
>

Ya, I was a dummy and forgot to say send all in git send-email, then it
timed out. I have to make other changes anyway because of feedback from
Richard.


> Ross
> On Thu, 15 Nov 2018 at 19:24, Joshua Watt <jpewhacker@gmail.com> wrote:
> >
> > Adds the testing framework for tying tests for the MinGW SDK into the
> > oeqa SDK test framework.
> >
> > The SDK tests can be run using the standard SDK test command:
> >
> >  bitbake -c testsdk <image>
> >
> > All testing is done using Wine in lieu of having access to an actual
> > Windows machine. Wine is required to be installed on the host machine.
> >
> > Joshua Watt (4):
> >   Add SDK test case framework
> >   Add .gitignore
> >   classes/toolchain-scripts-mingw32: Update variables
> >   oeqa/sdkmingw: Add test cases
> >
> >  .gitignore                                  |   3 +
> >  classes/testsdk-mingw.bbclass               | 101 ++++++++++++++++++++
> >  classes/toolchain-scripts-mingw32.bbclass   |   4 +-
> >  conf/machine-sdk/i686-mingw32.conf          |   1 +
> >  conf/machine-sdk/include/mingw32-common.inc |   6 ++
> >  conf/machine-sdk/x86_64-mingw32.conf        |   1 +
> >  lib/oeqa/sdkmingw/__init__.py               |   0
> >  lib/oeqa/sdkmingw/case.py                   |  52 ++++++++++
> >  lib/oeqa/sdkmingw/cases/__init__.py         |   0
> >  lib/oeqa/sdkmingw/cases/binutils.py         |  57 +++++++++++
> >  lib/oeqa/sdkmingw/cases/gcc.py              |  49 ++++++++++
> >  lib/oeqa/sdkmingw/cases/gdb.py              |  20 ++++
> >  lib/oeqa/sdkmingw/context.py                |  66 +++++++++++++
> >  lib/oeqa/sdkmingw/files/testsdkmakefile     |   4 +
> >  14 files changed, 363 insertions(+), 1 deletion(-)
> >  create mode 100644 .gitignore
> >  create mode 100644 classes/testsdk-mingw.bbclass
> >  create mode 100644 lib/oeqa/sdkmingw/__init__.py
> >  create mode 100644 lib/oeqa/sdkmingw/case.py
> >  create mode 100644 lib/oeqa/sdkmingw/cases/__init__.py
> >  create mode 100644 lib/oeqa/sdkmingw/cases/binutils.py
> >  create mode 100644 lib/oeqa/sdkmingw/cases/gcc.py
> >  create mode 100644 lib/oeqa/sdkmingw/cases/gdb.py
> >  create mode 100644 lib/oeqa/sdkmingw/context.py
> >  create mode 100644 lib/oeqa/sdkmingw/files/testsdkmakefile
> >
> > --
> > 2.19.1
> >
>

[-- Attachment #2: Type: text/html, Size: 3415 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [meta-mingw][PATCH v2 0/5] Add oeqa test cases
  2018-11-15 19:23 [meta-mingw][PATCH 0/4] Add oeqa test cases Joshua Watt
  2018-11-16 11:50 ` Burton, Ross
@ 2018-11-19 21:17 ` Joshua Watt
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 1/5] Add SDK test case framework Joshua Watt
                     ` (4 more replies)
  1 sibling, 5 replies; 9+ messages in thread
From: Joshua Watt @ 2018-11-19 21:17 UTC (permalink / raw)
  To: yocto

Adds the testing framework for tying tests for the MinGW SDK into the
oeqa SDK test framework. 

The SDK tests can be run using the standard SDK test command:

 bitbake -c testsdk <image>

All testing is done using Wine in lieu of having access to an actual
Windows machine. Wine is required to be installed on the host machine.

Joshua Watt (5):
  Add SDK test case framework
  Add .gitignore
  classes/toolchain-scripts-mingw32: Update variables
  classes/toolchain-scripts-mingw32: Ensure exit code is success
  oeqa/sdkmingw: Add test cases

 .gitignore                                  |  3 +
 classes/toolchain-scripts-mingw32.bbclass   | 15 +++-
 conf/machine-sdk/i686-mingw32.conf          |  1 +
 conf/machine-sdk/include/mingw32-common.inc |  7 ++
 conf/machine-sdk/x86_64-mingw32.conf        |  1 +
 lib/oeqa/sdkmingw/__init__.py               |  0
 lib/oeqa/sdkmingw/case.py                   | 87 +++++++++++++++++++++
 lib/oeqa/sdkmingw/cases/__init__.py         |  0
 lib/oeqa/sdkmingw/cases/binutils.py         | 55 +++++++++++++
 lib/oeqa/sdkmingw/cases/gcc.py              | 47 +++++++++++
 lib/oeqa/sdkmingw/cases/gdb.py              | 20 +++++
 lib/oeqa/sdkmingw/cases/pkgconfig.py        | 18 +++++
 lib/oeqa/sdkmingw/context.py                | 69 ++++++++++++++++
 lib/oeqa/sdkmingw/files/testsdkmakefile     |  4 +
 lib/oeqa/sdkmingw/testsdk.py                | 42 ++++++++++
 15 files changed, 368 insertions(+), 1 deletion(-)
 create mode 100644 .gitignore
 create mode 100644 lib/oeqa/sdkmingw/__init__.py
 create mode 100644 lib/oeqa/sdkmingw/case.py
 create mode 100644 lib/oeqa/sdkmingw/cases/__init__.py
 create mode 100644 lib/oeqa/sdkmingw/cases/binutils.py
 create mode 100644 lib/oeqa/sdkmingw/cases/gcc.py
 create mode 100644 lib/oeqa/sdkmingw/cases/gdb.py
 create mode 100644 lib/oeqa/sdkmingw/cases/pkgconfig.py
 create mode 100644 lib/oeqa/sdkmingw/context.py
 create mode 100644 lib/oeqa/sdkmingw/files/testsdkmakefile
 create mode 100644 lib/oeqa/sdkmingw/testsdk.py

-- 
2.19.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [meta-mingw][PATCH v2 1/5] Add SDK test case framework
  2018-11-19 21:17 ` [meta-mingw][PATCH v2 0/5] " Joshua Watt
@ 2018-11-19 21:17   ` Joshua Watt
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 2/5] Add .gitignore Joshua Watt
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Joshua Watt @ 2018-11-19 21:17 UTC (permalink / raw)
  To: yocto

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>
---
 conf/machine-sdk/i686-mingw32.conf          |  1 +
 conf/machine-sdk/include/mingw32-common.inc |  7 ++
 conf/machine-sdk/x86_64-mingw32.conf        |  1 +
 lib/oeqa/sdkmingw/__init__.py               |  0
 lib/oeqa/sdkmingw/case.py                   | 87 +++++++++++++++++++++
 lib/oeqa/sdkmingw/cases/__init__.py         |  0
 lib/oeqa/sdkmingw/context.py                | 69 ++++++++++++++++
 lib/oeqa/sdkmingw/testsdk.py                | 42 ++++++++++
 8 files changed, 207 insertions(+)
 create mode 100644 lib/oeqa/sdkmingw/__init__.py
 create mode 100644 lib/oeqa/sdkmingw/case.py
 create mode 100644 lib/oeqa/sdkmingw/cases/__init__.py
 create mode 100644 lib/oeqa/sdkmingw/context.py
 create mode 100644 lib/oeqa/sdkmingw/testsdk.py

diff --git a/conf/machine-sdk/i686-mingw32.conf b/conf/machine-sdk/i686-mingw32.conf
index 5090168..fef48b5 100644
--- a/conf/machine-sdk/i686-mingw32.conf
+++ b/conf/machine-sdk/i686-mingw32.conf
@@ -1,3 +1,4 @@
 SDK_ARCH = "i686"
+TESTSDK_WINEARCH = "win32"
 
 require conf/machine-sdk/include/mingw32-common.inc
diff --git a/conf/machine-sdk/include/mingw32-common.inc b/conf/machine-sdk/include/mingw32-common.inc
index 733d092..71e8d45 100644
--- a/conf/machine-sdk/include/mingw32-common.inc
+++ b/conf/machine-sdk/include/mingw32-common.inc
@@ -26,6 +26,9 @@ SDKPKGSUFFIX = "nativesdk-mingw32"
 
 MACHINEOVERRIDES .= ":sdkmingw32"
 
+TESTSDK_CLASS_NAME = "oeqa.sdkmingw.testsdk.TestSDKMinGW"
+TESTSDKEXT_CLASS_NAME = ""
+
 WINDRES_mingw32 = "${HOST_PREFIX}windres --include-dir=${STAGING_INCDIR}"
 RC_mingw32 = "${WINDRES}"
 
@@ -39,3 +42,7 @@ DISABLE_STATIC_mingw32 = ""
 
 # disable security flags
 GCCPIE_mingw32 = ""
+
+# wine and wineserver are required to test MinGW SDKs
+HOSTTOOLS += "${@'wine wineserver' if (bb.utils.contains_any('IMAGE_CLASSES', 'testsdk-mingw', True, False, d) or any(x in (d.getVar("BBINCLUDED") or "") for x in ["testsdk-mingw.bbclass"])) else ''}"
+
diff --git a/conf/machine-sdk/x86_64-mingw32.conf b/conf/machine-sdk/x86_64-mingw32.conf
index fc53822..188debc 100644
--- a/conf/machine-sdk/x86_64-mingw32.conf
+++ b/conf/machine-sdk/x86_64-mingw32.conf
@@ -1,3 +1,4 @@
 SDK_ARCH = "x86_64"
+TESTSDK_WINEARCH = "win64"
 
 require conf/machine-sdk/include/mingw32-common.inc
diff --git a/lib/oeqa/sdkmingw/__init__.py b/lib/oeqa/sdkmingw/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/oeqa/sdkmingw/case.py b/lib/oeqa/sdkmingw/case.py
new file mode 100644
index 0000000..169c143
--- /dev/null
+++ b/lib/oeqa/sdkmingw/case.py
@@ -0,0 +1,87 @@
+# Copyright 2018 by Garmin Ltd. or its subsidiaries
+# Released under the MIT license (see COPYING.MIT)
+
+import subprocess
+import os
+import tempfile
+import shutil
+import bb
+
+from oeqa.core.utils.path import remove_safe
+from oeqa.sdk.case import OESDKTestCase
+
+from oeqa.utils.subprocesstweak import errors_have_output
+errors_have_output()
+
+class OESDKMinGWTestCase(OESDKTestCase):
+    def setUp(self):
+        super().setUp()
+
+        self.test_dir = tempfile.mkdtemp(prefix=self.__class__.__name__ + '-', dir=self.tc.sdk_dir)
+        self.addCleanup(lambda: bb.utils.prunedir(self.test_dir))
+
+        self.wine_test_dir = self.tc.wine_path(self.test_dir)
+
+    def copyTestFile(self, src, dest=None):
+        dest_path = dest or os.path.join(self.test_dir, os.path.basename(src))
+        shutil.copyfile(src, dest_path)
+        self.addCleanup(lambda: remove_safe(dest_path))
+
+    def fetch(self, url, destdir=None, dl_dir=None, archive=None):
+        if not destdir:
+            destdir = self.test_dir
+
+        if not dl_dir:
+            dl_dir = self.td.get('DL_DIR', None)
+
+        if not archive:
+            from urllib.parse import urlparse
+            archive = os.path.basename(urlparse(url).path)
+
+        if dl_dir:
+            tarball = os.path.join(dl_dir, archive)
+            if os.path.exists(tarball):
+                return tarball
+
+        tarball = os.path.join(destdir, archive)
+        subprocess.check_output(["wget", "-O", tarball, url])
+        return tarball
+
+
+    def _run(self, cmd):
+        import shlex
+
+        def strip_quotes(s):
+            if s[0] == '"' and s[-1] == '"':
+                return s[1:-1]
+            return s
+
+        command = ['wine', 'cmd', '/c', self.tc.wine_sdk_env, '>', 'NUL', '&&', 'cd', self.wine_test_dir, '&&']
+
+        # Perform some massaging so that commands can be written naturally in
+        # test cases. shlex.split() in Non-posix mode gets us most of the way
+        # there, but it leaves the quotes around a quoted argument, so we
+        # remove them manually.
+        command.extend(strip_quotes(s) for s in shlex.split(cmd, posix=False))
+
+        return subprocess.check_output(command, env=self.tc.get_wine_env(),
+                stderr=subprocess.STDOUT, universal_newlines=True)
+
+    def assertIsTargetElf(self, path):
+        import oe.qa
+        import oe.elf
+
+        elf = oe.qa.ELFFile(path)
+        elf.open()
+
+        if not getattr(self, 'target_os', None):
+            output = self._run("echo %OECORE_TARGET_OS%:%OECORE_TARGET_ARCH%")
+            self.target_os, self.target_arch = output.strip().split(":")
+
+        machine_data = oe.elf.machine_dict(None)[self.target_os][self.target_arch]
+        (machine, osabi, abiversion, endian, bits) = machine_data
+
+        self.assertEqual(machine, elf.machine())
+        self.assertEqual(bits, elf.abiSize())
+        self.assertEqual(endian, elf.isLittleEndian())
+
diff --git a/lib/oeqa/sdkmingw/cases/__init__.py b/lib/oeqa/sdkmingw/cases/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/lib/oeqa/sdkmingw/context.py b/lib/oeqa/sdkmingw/context.py
new file mode 100644
index 0000000..edabcbd
--- /dev/null
+++ b/lib/oeqa/sdkmingw/context.py
@@ -0,0 +1,69 @@
+# Copyright (C) 2018 by Garmin Ltd. or its subsidiaries
+# Released under the MIT license (see COPYING.MIT)
+import os
+import subprocess
+
+from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor
+
+from oeqa.utils.subprocesstweak import errors_have_output
+errors_have_output()
+
+class OESDKMinGWTestContext(OESDKTestContext):
+    sdk_files_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "files")
+
+    def __init__(self, td=None, logger=None, sdk_dir=None, sdk_env=None, wine_prefix=None,
+            wine_arch=None, target_pkg_manifest=None, host_pkg_manifest=None):
+        super(OESDKMinGWTestContext, self).__init__(td, logger, sdk_dir, sdk_env, target_pkg_manifest, host_pkg_manifest)
+        self.wine_prefix = wine_prefix
+        self.wine_arch = wine_arch
+        self.wine_sdk_dir = self.wine_path(sdk_dir)
+        self.wine_sdk_env = self.wine_path(sdk_env)
+
+    def get_wine_env(self):
+        env = os.environ.copy()
+
+        # Turn off all Wine debug logging so it doesn't interfere with command output
+        env['WINEDEBUG'] = '-all'
+
+        env['WINEPREFIX'] = self.wine_prefix
+        env['WINEARCH'] = self.wine_arch
+
+        # Convenience variables to make test cases easier to write
+        env['SDK_DIR'] = getattr(self, 'wine_sdk_dir', '')
+
+        return env
+
+    def wine_path(self, p):
+        """
+        Converts a host POSIX path to a path in Wine
+        """
+        o = subprocess.check_output(['wine', 'winepath', '-w', p], env=self.get_wine_env())
+        return o.decode('utf-8').rstrip()
+
+
+class OESDKMinGWTestContextExecutor(OESDKTestContextExecutor):
+    _context_class = OESDKMinGWTestContext
+
+    name = 'sdk-mingw'
+    help = 'MinGW sdk test component'
+    description = 'executes MinGW sdk tests'
+
+    default_cases = [os.path.join(os.path.abspath(os.path.dirname(__file__)),
+            'cases')]
+
+    def register_commands(self, logger, subparsers):
+        super(OESDKMinGWTestContextExecutor, self).register_commands(logger, subparsers)
+
+        wine_group  = self.parser.add_argument_group('wine options')
+        wine_group.add_argument('--wine-prefix', action='store',
+            help='Wine prefix (bottle). Default is $SDK_DIR/.wine')
+        wine_group.add_argument('--wine-arch', action='store', choices=('win32', 'win64'),
+            default='win64', help='Wine architecture. Defaults to %(default)s')
+
+    def _process_args(self, logger, args):
+        super(OESDKMinGWTestContextExecutor, self)._process_args(logger, args)
+        self.tc_kwargs['init']['wine_prefix'] = args.wine_prefix or os.path.join(args.sdk_dir, '.wine')
+        self.tc_kwargs['init']['wine_arch'] = args.wine_arch
+
+_executor_class = OESDKMinGWTestContextExecutor
+
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'
+            }
+
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [meta-mingw][PATCH v2 2/5] Add .gitignore
  2018-11-19 21:17 ` [meta-mingw][PATCH v2 0/5] " Joshua Watt
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 1/5] Add SDK test case framework Joshua Watt
@ 2018-11-19 21:17   ` Joshua Watt
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 3/5] classes/toolchain-scripts-mingw32: Update variables Joshua Watt
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Joshua Watt @ 2018-11-19 21:17 UTC (permalink / raw)
  To: yocto

Adds a .gitignore which ignores python artifact files, as these are now
generated by the SDK tests

[YOCTO #13020]

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 .gitignore | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5da7ef5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.pyc
+*.pyo
+
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [meta-mingw][PATCH v2 3/5] classes/toolchain-scripts-mingw32: Update variables
  2018-11-19 21:17 ` [meta-mingw][PATCH v2 0/5] " Joshua Watt
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 1/5] Add SDK test case framework Joshua Watt
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 2/5] Add .gitignore Joshua Watt
@ 2018-11-19 21:17   ` Joshua Watt
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 4/5] classes/toolchain-scripts-mingw32: Ensure exit code is success Joshua Watt
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 5/5] oeqa/sdkmingw: Add test cases Joshua Watt
  4 siblings, 0 replies; 9+ messages in thread
From: Joshua Watt @ 2018-11-19 21:17 UTC (permalink / raw)
  To: yocto

Updates the variables configured by the toolchain script to match the
oe-core class. This combines the changes from:

0b5f1b0430 ("toolchain-scripts: put TARGET_ARCH and TARGET_OS into environment")
47160a8c51 ("cmake: fix linking in multilib SDKs")
668f56bb24 ("toolchain-scripts: drop PYTHONHOME")
81f126f4a8 ("toolchain-scripts.bbclass: Use PYTHONPATH instead of PYTHONHOME")

[YOCTO #13020]

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 classes/toolchain-scripts-mingw32.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/classes/toolchain-scripts-mingw32.bbclass b/classes/toolchain-scripts-mingw32.bbclass
index b996a3e..a64f5f5 100644
--- a/classes/toolchain-scripts-mingw32.bbclass
+++ b/classes/toolchain-scripts-mingw32.bbclass
@@ -29,7 +29,9 @@ toolchain_create_sdk_env_script_sdkmingw32 () {
 	echo "set OECORE_NATIVE_SYSROOT=$sdkpathnative" >> $script
 	echo 'set OECORE_TARGET_SYSROOT=%SDKTARGETSYSROOT%' >> $script
 	echo "set OECORE_ACLOCAL_OPTS=-I $sdkpathnative/usr/share/aclocal" >> $script
-	echo "set PYTHONHOME=$sdkpathnative$prefix" >> $script
+	echo 'set OECORE_BASELIB=${baselib}' >> $script
+	echo 'set OECORE_TARGET_ARCH=${TARGET_ARCH}' >> $script
+	echo 'set OECORE_TARGET_OS=${TARGET_OS}' >> $script
 
 	toolchain_shared_env_script
 
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [meta-mingw][PATCH v2 4/5] classes/toolchain-scripts-mingw32: Ensure exit code is success
  2018-11-19 21:17 ` [meta-mingw][PATCH v2 0/5] " Joshua Watt
                     ` (2 preceding siblings ...)
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 3/5] classes/toolchain-scripts-mingw32: Update variables Joshua Watt
@ 2018-11-19 21:17   ` Joshua Watt
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 5/5] oeqa/sdkmingw: Add test cases Joshua Watt
  4 siblings, 0 replies; 9+ messages in thread
From: Joshua Watt @ 2018-11-19 21:17 UTC (permalink / raw)
  To: yocto

The "set" command in Windows has some unfortunate behaviors that can
frequently make it look like the toolchain script had an error. This
makes automated testing of the SDK more difficult, so add a line to the
environment setup script that ensures the script exits with success.

[YOCTO #13020]

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 classes/toolchain-scripts-mingw32.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/classes/toolchain-scripts-mingw32.bbclass b/classes/toolchain-scripts-mingw32.bbclass
index a64f5f5..32493d7 100644
--- a/classes/toolchain-scripts-mingw32.bbclass
+++ b/classes/toolchain-scripts-mingw32.bbclass
@@ -81,6 +81,17 @@ toolchain_shared_env_script_sdkmingw32 () {
    FOR %%x IN (%OECORE_NATIVE_SYSROOT%\\environment-setup.d\\*.bat) DO call "%%x"
 )
 EOF
+
+	# set has some annoying properties:
+	# 1) If it is successful %ERRORLEVEL% is unchanged (as opposed to being set
+	#	 to 0 to indicate success)
+	# 2) Making an assignment like "set A=" is considered an error and sets
+	#	 %ERRORLEVEL% to 1.
+	#
+	# Practically, this means that if any of the set calls make an empty
+	# assignment that error will be propagated. To prevent this, a command is
+	# run to ensure that the "exit code" of this script is 0
+	echo "@%COMSPEC% /C exit 0 > NUL" >> $script
 }
 
 toolchain_create_sdk_siteconfig_append_sdkmingw32 () {
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [meta-mingw][PATCH v2 5/5] oeqa/sdkmingw: Add test cases
  2018-11-19 21:17 ` [meta-mingw][PATCH v2 0/5] " Joshua Watt
                     ` (3 preceding siblings ...)
  2018-11-19 21:17   ` [meta-mingw][PATCH v2 4/5] classes/toolchain-scripts-mingw32: Ensure exit code is success Joshua Watt
@ 2018-11-19 21:17   ` Joshua Watt
  4 siblings, 0 replies; 9+ messages in thread
From: Joshua Watt @ 2018-11-19 21:17 UTC (permalink / raw)
  To: yocto

Adds test cases to verify that gcc, binutils, gdb, and pkg-config are
functioning in the MinGW SDK

[YOCTO #13020]

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 lib/oeqa/sdkmingw/cases/binutils.py     | 55 +++++++++++++++++++++++++
 lib/oeqa/sdkmingw/cases/gcc.py          | 47 +++++++++++++++++++++
 lib/oeqa/sdkmingw/cases/gdb.py          | 20 +++++++++
 lib/oeqa/sdkmingw/cases/pkgconfig.py    | 18 ++++++++
 lib/oeqa/sdkmingw/files/testsdkmakefile |  4 ++
 5 files changed, 144 insertions(+)
 create mode 100644 lib/oeqa/sdkmingw/cases/binutils.py
 create mode 100644 lib/oeqa/sdkmingw/cases/gcc.py
 create mode 100644 lib/oeqa/sdkmingw/cases/gdb.py
 create mode 100644 lib/oeqa/sdkmingw/cases/pkgconfig.py
 create mode 100644 lib/oeqa/sdkmingw/files/testsdkmakefile

diff --git a/lib/oeqa/sdkmingw/cases/binutils.py b/lib/oeqa/sdkmingw/cases/binutils.py
new file mode 100644
index 0000000..fdd5a47
--- /dev/null
+++ b/lib/oeqa/sdkmingw/cases/binutils.py
@@ -0,0 +1,55 @@
+# Copyright 2018 by Garmin Ltd. or its subsidiaries
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import unittest
+
+from oeqa.sdkmingw.case import OESDKMinGWTestCase
+
+class BinutilsTest(OESDKMinGWTestCase):
+    td_vars = ['MACHINE']
+
+    def setUp(self):
+        super().setUp()
+
+        self.copyTestFile(os.path.join(self.tc.files_dir, 'test.c'))
+
+        machine = self.td.get("MACHINE")
+        if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or
+                self.tc.hasHostPackage("^gcc-", regex=True)):
+            raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain a cross-canadian toolchain")
+        if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or
+                self.tc.hasHostPackage('binutils-cross-canadian-%s' % machine)):
+            raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain a binutils")
+
+        self._run('%CC% -c -g test.c -o test.o')
+        self._run('%CC% -o test test.o -lm')
+
+    def test_strip(self):
+        self._run('%STRIP% -s test')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test'))
+
+    def test_ar(self):
+        self._run('%AR% -rcs lib.a test.o')
+        self._run('%CC% -o test lib.a -lm')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test'))
+
+    def test_ranlib(self):
+        self._run('%AR% -rc lib.a test.o')
+        self._run('%RANLIB% lib.a')
+        self._run('%CC% -o test lib.a -lm')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test'))
+
+    def test_objcopy(self):
+        self._run('%OBJCOPY% -g test.o test_no_debug.o')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test_no_debug.o'))
+        self._run('%CC% -o test test_no_debug.o -lm')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test'))
+
+    def test_objdump(self):
+        self._run('%OBJDUMP% -S test.o')
+
+    def test_nm(self):
+        self._run('%NM% test.o')
+
+
diff --git a/lib/oeqa/sdkmingw/cases/gcc.py b/lib/oeqa/sdkmingw/cases/gcc.py
new file mode 100644
index 0000000..7294bf5
--- /dev/null
+++ b/lib/oeqa/sdkmingw/cases/gcc.py
@@ -0,0 +1,47 @@
+# Copyright 2018 by Garmin Ltd. or its subsidiaries
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import unittest
+
+from oeqa.sdkmingw.case import OESDKMinGWTestCase
+
+class GccCompileTest(OESDKMinGWTestCase):
+    td_vars = ['MACHINE']
+
+    def setUp(self):
+        super().setUp()
+
+        self.copyTestFile(os.path.join(self.tc.files_dir, 'test.c'))
+        self.copyTestFile(os.path.join(self.tc.files_dir, 'test.cpp'))
+        self.copyTestFile(os.path.join(self.tc.sdk_files_dir, 'testsdkmakefile'))
+
+        machine = self.td.get("MACHINE")
+        if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or
+                self.tc.hasHostPackage("^gcc-", regex=True)):
+            raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain a cross-canadian toolchain")
+
+    def test_gcc_compile(self):
+        self._run('%CC% %CFLAGS% %LDFLAGS% test.c -o test -lm')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test'))
+
+    def test_gcc_compile_and_link(self):
+        self._run('%CC% %CFLAGS% -c test.c -o test.o')
+        self._run('%CC% %LDFLAGS% -o test test.o -lm')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test.o'))
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test'))
+
+    def test_gpp_compile(self):
+        self._run('%CXX% %CXXFLAGS% %LDFLAGS% test.c -o test -lm')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test'))
+
+    def test_gpp2_compile(self):
+        self._run('%CXX% %CXXFLAGS% %LDFLAGS% test.cpp -o test -lm')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test'))
+
+    def test_make(self):
+        if not self.tc.hasHostPackage('nativesdk-make'):
+            raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain make")
+        self._run('make -f testsdkmakefile')
+        self.assertIsTargetElf(os.path.join(self.test_dir, 'test'))
+
diff --git a/lib/oeqa/sdkmingw/cases/gdb.py b/lib/oeqa/sdkmingw/cases/gdb.py
new file mode 100644
index 0000000..f1bde7a
--- /dev/null
+++ b/lib/oeqa/sdkmingw/cases/gdb.py
@@ -0,0 +1,20 @@
+# Copyright 2018 by Garmin Ltd. or its subsidiaries
+# Released under the MIT license (see COPYING.MIT)
+
+import unittest
+
+from oeqa.sdkmingw.case import OESDKMinGWTestCase
+
+class GdbTest(OESDKMinGWTestCase):
+    td_vars = ['MACHINE']
+
+    def setUp(self):
+        super().setUp()
+
+        machine = self.td.get("MACHINE")
+        if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or
+                self.tc.hasHostPackage("^gdb-", regex=True)):
+            raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain a cross-canadian toolchain")
+
+    def test_gdb(self):
+        self._run('%GDB% -ex quit')
diff --git a/lib/oeqa/sdkmingw/cases/pkgconfig.py b/lib/oeqa/sdkmingw/cases/pkgconfig.py
new file mode 100644
index 0000000..24185a0
--- /dev/null
+++ b/lib/oeqa/sdkmingw/cases/pkgconfig.py
@@ -0,0 +1,18 @@
+# Copyright 2018 by Garmin Ltd. or its subsidiaries
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import unittest
+
+from oeqa.sdkmingw.case import OESDKMinGWTestCase
+
+class PkgConfigTest(OESDKMinGWTestCase):
+    def setUp(self):
+        super().setUp()
+
+        if not self.tc.hasHostPackage("nativesdk-pkgconfig"):
+            raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain nativesdk-pkgconfig")
+
+    def test_pkg_config(self):
+        self._run('pkg-config --list-all')
+
diff --git a/lib/oeqa/sdkmingw/files/testsdkmakefile b/lib/oeqa/sdkmingw/files/testsdkmakefile
new file mode 100644
index 0000000..b5cac86
--- /dev/null
+++ b/lib/oeqa/sdkmingw/files/testsdkmakefile
@@ -0,0 +1,4 @@
+test: test.o
+	$(CC) -o test test.o -lm
+test.o: test.c
+	$(CC) -c test.c
-- 
2.19.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-11-19 21:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-15 19:23 [meta-mingw][PATCH 0/4] Add oeqa test cases Joshua Watt
2018-11-16 11:50 ` Burton, Ross
2018-11-16 12:12   ` Joshua Watt
2018-11-19 21:17 ` [meta-mingw][PATCH v2 0/5] " Joshua Watt
2018-11-19 21:17   ` [meta-mingw][PATCH v2 1/5] Add SDK test case framework Joshua Watt
2018-11-19 21:17   ` [meta-mingw][PATCH v2 2/5] Add .gitignore Joshua Watt
2018-11-19 21:17   ` [meta-mingw][PATCH v2 3/5] classes/toolchain-scripts-mingw32: Update variables Joshua Watt
2018-11-19 21:17   ` [meta-mingw][PATCH v2 4/5] classes/toolchain-scripts-mingw32: Ensure exit code is success Joshua Watt
2018-11-19 21:17   ` [meta-mingw][PATCH v2 5/5] oeqa/sdkmingw: Add test cases Joshua Watt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.