Skip to content
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

Fix all tests on windows #56

Merged
merged 8 commits into from
Jun 25, 2014
Merged

Conversation

alexcrichton
Copy link
Member

This brings cargo up to date in all aspects with respect to windows.

The commits have all the nitty-gritty details. There were two assumptions which ended up having far reaching impact:

  1. file:// urls could be used for local git repos. This was too difficult with \ characters in filenames.
  2. Spawning processes with relative paths ended up in a world of pain. See Process spawning via PATH is different on unix than it is on windows rust#15149 for details.

Closes #32

On windows a path cannot be represented as a file:// URL because of the
backslashes and colons in the file name. This causes all of the tests which rely
on git to fail on windows. This commit changes the representation of the
location of a package to be an enum, Location, with two variants: Remote and
Local.

When parsing Cargo.toml, all locations which begin with the string "file:" have
that prefix stripped and are then interpreted as Local packages. Everything else
is parsed as a URL and used as a Remote package.
The windows terminal does not use terminfo and is much different, so these tests
will fail on windows or actually write to the console.
Apparently git checkouts have objects in the database with permissions 444 which
need to be changed to something with a write permission before removal.
This is the same as the libstd Command builder, and will soon be used in the
tests for spawning processes on windows.
* Add a convenience method bin() for generating the name of a binary. On windows
  this remembers to append `.exe`.

* Stop executing relative paths to binaries and relying on PATH. This is
  suffering from rust-lang/rust#15149 and failing to spawn processes on windows.
  Additionally, this allows the tests to work with a pre-installed cargo becuase
  the freshly built executables are precisely specified.

* A new function, escape_path(), was added for tests. When generated source
  files with paths, this function needs to be called to properly escape the
  \-character that appears in windows path names. Without this function we would
  be generating invalid TOML and rust.
Windows occasionally has \r\n while everywhere else has \n. Instead of worrying
about the difference, just replace all instances of \r with nothing and rely on
matching against \n.
wycats added a commit that referenced this pull request Jun 25, 2014
@wycats wycats merged commit c2ab4f7 into rust-lang:master Jun 25, 2014
@alexcrichton alexcrichton deleted the fix-windows-tests branch June 25, 2014 18:57
alexcrichton pushed a commit to alexcrichton/cargo that referenced this pull request Sep 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows paths need improved handling
2 participants