-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scripts: twister: Fix Twister Unit tests on Windows #74651
base: main
Are you sure you want to change the base?
scripts: twister: Fix Twister Unit tests on Windows #74651
Conversation
dd3865f
to
c4cc343
Compare
f7d1d0a
to
31bce87
Compare
# On Windows, without this prefix, there is 260-character path length limit. | ||
if not normalised.startswith('\\\\?\\'): | ||
normalised = '\\\\?\\' + normalised | ||
return Path(normalised) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem: Paths were deemed the main culprit. Windows has a limit of 260 character file paths by default.
Problem: Windows and Linux have a limit of 260 character filepath element.
So you are basically trying to solve the same problem that --short-build-path
(see #41930) already solves, but in a different way.
Does this actually work? Because Ninja and Zephyr SDK Windows toolchain binaries are not exactly long-path friendly, relying on the "ANSI version" of the I/O functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had to make some fixes before answering you (Zephyr test failures). Currently, this change gives us a PASS on all Zephyr tests and all Unit Tests relevant for Windows (So without i.a. jobserver
and QEMUHandler
). I've tested that on a private CI.
cc8a8d5
to
9d9fa48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested these changes on Win 10. Everything seems fine to me.
0592738
to
9aad4c5
Compare
9aad4c5
to
1715c63
Compare
It's hard for me to evaluate this PR. I don't understand the need for all this changes to paths and in particular the new TPath class. IMO TPath adds another layer which can complicate simple operations that were done with paths. I am aware about the first 2 bullet points (char limit on Windows) but I was sure we managed to resolve it with introduction of --short-build-path. In Nordic we have a CI which is building tests/samples on Windows with twister and it works. I think I also had to add --no-detailed-test-id at some point to remove paths from test ids but cannot recall what was the root cause for this. |
083ed1b
to
d76f691
Compare
ae275a7
to
cb24d66
Compare
03a2e2b
to
fd746d8
Compare
I have gotten back to this PR now and am able to remove the DNM label. While Twister itself can currently be run on Windows with the use of specific Twister flag, how can someone making a change to Twister know that their change is not breaking for Windows? To verify that, we ought to have a working CI which built and runs Twister tests for Windows and does a check on PRs which change Twister in any way. We do not have such a workflow here, but I've conducted a few test workflow run in a private repo. All unit tests pass on both Windows and Linux after those changes. Without them, unit tests fail on Windows. With Unit Tests failing on Windows, we cannot have a Windows-specific CI runs and thus cannot in any way safeguard future Windows correctness. This is not a singular PR, but a step on the way towards better Windows support. |
fd746d8
to
82d8ae4
Compare
82d8ae4
to
7d5261a
Compare
Although we do not run it for every PR, there is multi-platform CI workflow using Twister here: We also run Windows CI using Twister in the SDK repository, which works without this change: So your claim about unit tests failing on Windows without this change is invalid. p.s. I am not saying these changes are bad or unnecessary -- I am just pointing out that the status quo is Twister on Windows works without any of these changes, unlike your claim that Twister on Windows is currently broken and needs to be fixed. |
c51308a
to
f634c10
Compare
Unit tests were failing on Windows, indicating that current Twister code is not truly multiplatform. Linux-specific code parts were changed into multiplatform ones. Paths were deemed the main culprit, so this commit introduces a new TPath, that aims to fix the Windows limitation of supporting only up to 260 char paths by default. Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
f634c10
to
ccf3779
Compare
Unit tests were failing on Windows, indicating that current Twister code is not truly multiplatform.
Problems detected:
TPath
, that aims to fix the Windows limitation of supporting only up to 260 char paths by default via a path prefix disabling this limitation.TestSuite
name
formation was updated, so it wouldn't create extremely long path elements as its name, given thatTestSuite
name
is used in dir creation.os.kill
with a Linux-specific signal is used.Process
is used instead.pathlib
'sWindowPath
s were not serialised correctly in the reports.PosixPath
serialising fix was extended to other path classes.Unit tests were adjusted (and some disabled, as they didn't make sense on a given OS).