-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
122 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
14 changes: 14 additions & 0 deletions
14
testsuite/tests/index/env-bad-path/my_index/index/cr/crate/crate-1.0.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
description = "Sample crate" | ||
name = "crate" | ||
version = "1.0.0" | ||
licenses = [] | ||
maintainers = ["[email protected]"] | ||
maintainers-logins = ["someone"] | ||
|
||
[environment] | ||
VAR1.set = "${CRATE_ROOT}/crate_test_bin" # OK | ||
VAR2.set = "\\${CRATE_ROOT}/crate_test_bin" # OK, escape the $ to avoid expansion | ||
VAR3.set = "${CRATE_ROOT}\\bin" # BAD, non-portable path | ||
|
||
[origin] | ||
url = "file:../../../crates/crate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version = "1.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
Detect a bad path in an environment variable | ||
""" | ||
|
||
from drivers.alr import run_alr | ||
from drivers.asserts import assert_match | ||
|
||
# Attempting to load the crate to show it should fail but only for the VAR3 bad variable | ||
|
||
assert_match(".*VAR3: forbidden", | ||
run_alr("show", "crate", complain_on_error=False).out) | ||
|
||
print('SUCCESS') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
driver: python-script | ||
build_mode: both | ||
indexes: | ||
my_index: | ||
in_fixtures: false |
Empty file.
12 changes: 12 additions & 0 deletions
12
testsuite/tests/index/env-path/my_index/index/cr/crate/crate-1.0.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
description = "Sample crate" | ||
name = "crate" | ||
version = "1.0.0" | ||
licenses = [] | ||
maintainers = ["[email protected]"] | ||
maintainers-logins = ["someone"] | ||
|
||
[environment] | ||
PATH.append = "${CRATE_ROOT}/crate_test_bin" | ||
|
||
[origin] | ||
url = "file:../../../crates/crate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version = "1.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
Paths in environment values should use native path separators in the index, and | ||
be converted to the native separator for usage. | ||
""" | ||
|
||
import os | ||
|
||
from drivers.alr import crate_dirname, run_alr | ||
from drivers.asserts import assert_match | ||
from drivers.helpers import content_of | ||
|
||
# Check that the output of `alr show` shows the proper slashes | ||
|
||
# Show uses the path with portable separators, as the conversion is done just | ||
# for printenv output. | ||
assert_match(f".*{os.sep}crate_test_bin", | ||
run_alr("show", "crate").out) | ||
|
||
# Similarly, if we retrieve the crate, the output to the manifest must be in | ||
# portable format (always forward slashes). | ||
run_alr("get", "crate") | ||
assert_match(f".*/crate_test_bin", | ||
content_of(f"{crate_dirname('crate')}/alire.toml")) | ||
|
||
# When obtained via printenv, the path must be native | ||
os.chdir(crate_dirname('crate')) | ||
assert_match(f".*PATH=[^\n]*{os.sep}crate_test_bin", | ||
run_alr("printenv").out) | ||
|
||
print('SUCCESS') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
driver: python-script | ||
build_mode: both | ||
indexes: | ||
my_index: | ||
in_fixtures: false |