From: Joshua Watt <jpewhacker@gmail.com>
To: yocto@lists.yoctoproject.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [yocto][meta-mingw][PATCH] tests: Map WORKDIR to W: to shorten paths
Date: Thu, 8 Dec 2022 10:48:39 -0600 [thread overview]
Message-ID: <20221208164839.1801875-1-JPEWhacker@gmail.com> (raw)
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>
---
lib/oeqa/sdkmingw/case.py | 4 ++--
lib/oeqa/sdkmingw/context.py | 11 ++++++++++-
lib/oeqa/sdkmingw/testsdk.py | 5 ++++-
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):
return s[1:-1]
return s
- command = ['wine', 'cmd', '/c', self.tc.wine_sdk_env, '>', 'NUL', '&&', 'cd', self.wine_test_dir, '&&']
+ command = ['wine', 'cmd', '/c', self.tc.wine_sdk_env, '>', 'NUL', '&&']
# 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
@@ -65,7 +65,7 @@ class OESDKMinGWTestCase(OESDKTestCase):
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)
+ stderr=subprocess.STDOUT, universal_newlines=True, cwd=self.test_dir)
def assertIsTargetElf(self, path):
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):
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):
+ wine_arch=None, wine_devices={}, 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
+ # Create the wine environment
+ subprocess.check_output(["wine", "cmd", "/c", "echo 1"], env=self.get_wine_env())
+
+ device_dir = "%s/dosdevices" % wine_prefix
+ bb.utils.mkdirhier(device_dir)
+ for device, path in wine_devices.items():
+ device_path = "%s/%s" % (device_dir, device)
+ os.symlink(os.path.relpath(path, device_dir), device_path)
+
self.wine_sdk_dir = self.wine_path(sdk_dir)
self.wine_sdk_env = self.wine_path(sdk_env)
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):
return {
'wine_prefix': wine_prefix,
- 'wine_arch': d.getVar('TESTSDK_WINEARCH') or 'win64'
+ 'wine_arch': d.getVar('TESTSDK_WINEARCH') or 'win64',
+ 'wine_devices': {
+ 'w:': d.getVar("WORKDIR"),
}
+ }
--
2.33.0
reply other threads:[~2022-12-08 16:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221208164839.1801875-1-JPEWhacker@gmail.com \
--to=jpewhacker@gmail.com \
--cc=yocto@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox