summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2022-12-08 10:48:19 -0600
committerJoshua Watt <JPEWhacker@gmail.com>2022-12-08 12:18:39 -0600
commit31150eb10a96116d09c49524f0b78d01667c28cf (patch)
tree2c56f0ce57c1dddecd8f7e3a8eeaee07d5286c15
parenta90614a6498c3345704e9611f2842eb933dc51c1 (diff)
downloadmeta-mingw-kirkstone-next.tar.gz
tests: Map WORKDIR to W: to shorten pathskirkstone-next
In some cases Wine (and Windows proper) struggle with very long paths; in particular the way that gcc invokes the 'cc1' subprogram is limited in how deep the path to the subprogram can be. This can cause issues when testing the SDK under wine, as the paths can easily get quite long and exceed this limit. In order to work around this, setup the Wine test context so that the W: drive maps to the SDK image ${WORKDIR}, which allows wine to effectively use paths relative to this directory making them significantly shorter. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> (cherry picked from commit f40731611e9682928db78c83db72d384c2edee10)
-rw-r--r--lib/oeqa/sdkmingw/case.py4
-rw-r--r--lib/oeqa/sdkmingw/context.py11
-rw-r--r--lib/oeqa/sdkmingw/testsdk.py5
3 files changed, 16 insertions, 4 deletions
diff --git a/lib/oeqa/sdkmingw/case.py b/lib/oeqa/sdkmingw/case.py
index 169c143..dee7d3d 100644
--- a/lib/oeqa/sdkmingw/case.py
+++ b/lib/oeqa/sdkmingw/case.py
@@ -56,7 +56,7 @@ class OESDKMinGWTestCase(OESDKTestCase):
56 return s[1:-1] 56 return s[1:-1]
57 return s 57 return s
58 58
59 command = ['wine', 'cmd', '/c', self.tc.wine_sdk_env, '>', 'NUL', '&&', 'cd', self.wine_test_dir, '&&'] 59 command = ['wine', 'cmd', '/c', self.tc.wine_sdk_env, '>', 'NUL', '&&']
60 60
61 # Perform some massaging so that commands can be written naturally in 61 # Perform some massaging so that commands can be written naturally in
62 # test cases. shlex.split() in Non-posix mode gets us most of the way 62 # test cases. shlex.split() in Non-posix mode gets us most of the way
@@ -65,7 +65,7 @@ class OESDKMinGWTestCase(OESDKTestCase):
65 command.extend(strip_quotes(s) for s in shlex.split(cmd, posix=False)) 65 command.extend(strip_quotes(s) for s in shlex.split(cmd, posix=False))
66 66
67 return subprocess.check_output(command, env=self.tc.get_wine_env(), 67 return subprocess.check_output(command, env=self.tc.get_wine_env(),
68 stderr=subprocess.STDOUT, universal_newlines=True) 68 stderr=subprocess.STDOUT, universal_newlines=True, cwd=self.test_dir)
69 69
70 def assertIsTargetElf(self, path): 70 def assertIsTargetElf(self, path):
71 import oe.qa 71 import oe.qa
diff --git a/lib/oeqa/sdkmingw/context.py b/lib/oeqa/sdkmingw/context.py
index edabcbd..5319223 100644
--- a/lib/oeqa/sdkmingw/context.py
+++ b/lib/oeqa/sdkmingw/context.py
@@ -12,10 +12,19 @@ class OESDKMinGWTestContext(OESDKTestContext):
12 sdk_files_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "files") 12 sdk_files_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "files")
13 13
14 def __init__(self, td=None, logger=None, sdk_dir=None, sdk_env=None, wine_prefix=None, 14 def __init__(self, td=None, logger=None, sdk_dir=None, sdk_env=None, wine_prefix=None,
15 wine_arch=None, target_pkg_manifest=None, host_pkg_manifest=None): 15 wine_arch=None, wine_devices={}, target_pkg_manifest=None, host_pkg_manifest=None):
16 super(OESDKMinGWTestContext, self).__init__(td, logger, sdk_dir, sdk_env, target_pkg_manifest, host_pkg_manifest) 16 super(OESDKMinGWTestContext, self).__init__(td, logger, sdk_dir, sdk_env, target_pkg_manifest, host_pkg_manifest)
17 self.wine_prefix = wine_prefix 17 self.wine_prefix = wine_prefix
18 self.wine_arch = wine_arch 18 self.wine_arch = wine_arch
19 # Create the wine environment
20 subprocess.check_output(["wine", "cmd", "/c", "echo 1"], env=self.get_wine_env())
21
22 device_dir = "%s/dosdevices" % wine_prefix
23 bb.utils.mkdirhier(device_dir)
24 for device, path in wine_devices.items():
25 device_path = "%s/%s" % (device_dir, device)
26 os.symlink(os.path.relpath(path, device_dir), device_path)
27
19 self.wine_sdk_dir = self.wine_path(sdk_dir) 28 self.wine_sdk_dir = self.wine_path(sdk_dir)
20 self.wine_sdk_env = self.wine_path(sdk_env) 29 self.wine_sdk_env = self.wine_path(sdk_env)
21 30
diff --git a/lib/oeqa/sdkmingw/testsdk.py b/lib/oeqa/sdkmingw/testsdk.py
index 173cfd9..5c80bb4 100644
--- a/lib/oeqa/sdkmingw/testsdk.py
+++ b/lib/oeqa/sdkmingw/testsdk.py
@@ -44,6 +44,9 @@ class TestSDKMinGW(TestSDK):
44 44
45 return { 45 return {
46 'wine_prefix': wine_prefix, 46 'wine_prefix': wine_prefix,
47 'wine_arch': d.getVar('TESTSDK_WINEARCH') or 'win64' 47 'wine_arch': d.getVar('TESTSDK_WINEARCH') or 'win64',
48 'wine_devices': {
49 'w:': d.getVar("WORKDIR"),
48 } 50 }
51 }
49 52