Skip to content

make test_temp_path_resolve_existing_cwd() work with symlink in TMPDIR#403

Open
martinvonz wants to merge 1 commit intoStebalien:masterfrom
martinvonz:mz/usxvsoqvnywv
Open

make test_temp_path_resolve_existing_cwd() work with symlink in TMPDIR#403
martinvonz wants to merge 1 commit intoStebalien:masterfrom
martinvonz:mz/usxvsoqvnywv

Conversation

@martinvonz
Copy link
Copy Markdown

Here's a simple way to reproduce a test failure before this commit:

ln -s /tmp /tmp/here
TMPDIR=/tmp/here cargo test

That fails something like this:

test test_temp_path_resolve_existing_cwd ... FAILED

failures:

---- test_temp_path_resolve_existing_cwd stdout ----

thread 'test_temp_path_resolve_existing_cwd' (137617) panicked at tests/namedtempfile.rs:376:5:
assertion `left == right` failed
  left: "/tmp/.tmpDu1A7l/foo"
 right: "/tmp/here/.tmpDu1A7l/foo"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This commit fixes it by canonicalizing the CWD path in the test.

Here's a simple way to reproduce a test failure before this commit:

```
ln -s /tmp /tmp/here
TMPDIR=/tmp/here cargo test
```

That fails something like this:

```
test test_temp_path_resolve_existing_cwd ... FAILED

failures:

---- test_temp_path_resolve_existing_cwd stdout ----

thread 'test_temp_path_resolve_existing_cwd' (137617) panicked at tests/namedtempfile.rs:376:5:
assertion `left == right` failed
  left: "/tmp/.tmpDu1A7l/foo"
 right: "/tmp/here/.tmpDu1A7l/foo"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

This commit fixes it by canonicalizing the CWD path in the test.
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.

1 participant