-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for softlink nested path and env export
- Loading branch information
Showing
13 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
testsuite/tests/setenv/env-during-fetch/my_index/crates/checkenv/checkenv.gpr
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,22 @@ | ||
project Checkenv is | ||
|
||
for Source_Dirs use ("src"); | ||
for Object_Dir use "obj"; | ||
for Exec_Dir use "."; | ||
for Main use ("checkenv.adb"); | ||
|
||
package Builder is | ||
for Switches ("ada") use ("-j0", "-g"); | ||
end Builder; | ||
|
||
package Compiler is | ||
for Switches ("ada") use | ||
("-gnatVa", "-gnatwa", "-g", "-O2", | ||
"-gnata", "-gnato", "-fstack-check"); | ||
end Compiler; | ||
|
||
package Binder is | ||
for Switches ("ada") use ("-Es"); | ||
end Binder; | ||
|
||
end Checkenv; |
13 changes: 13 additions & 0 deletions
13
testsuite/tests/setenv/env-during-fetch/my_index/crates/checkenv/src/checkenv.adb
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 @@ | ||
with GNAT.IO; use GNAT.IO; | ||
with GNAT.OS_Lib; use GNAT.OS_Lib; | ||
|
||
procedure Checkenv is | ||
begin | ||
-- Check that "CHECKENV_TEST_VAR" is defined and print message accordingly | ||
-- to stderr | ||
if Getenv ("CHECKENV_TEST_VAR").all /= "" then | ||
Put_Line (Standard_Error, "CHECKENV_TEST_VAR exists"); | ||
else | ||
Put_Line (Standard_Error, "CHECKENV_TEST_VAR does NOT exist"); | ||
end if; | ||
end Checkenv; |
18 changes: 18 additions & 0 deletions
18
testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkenv.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,18 @@ | ||
[general] | ||
description = "Sample crate" | ||
licenses = [] | ||
maintainers = ["any@bo.dy"] | ||
maintainers-logins = ["someone"] | ||
|
||
environment.CHECKENV_TEST_VAR.set = "defined" | ||
|
||
[[general.actions]] | ||
type = "post-fetch" | ||
command = ["gprbuild", "-p"] | ||
|
||
[[general.actions]] | ||
type = "post-fetch" | ||
command = ["./checkenv"] # self-run to verify the env var exists | ||
|
||
['1.0'] | ||
origin = "file://../../crates/checkenv" |
9 changes: 9 additions & 0 deletions
9
testsuite/tests/setenv/env-during-fetch/my_index/index/ch/checkparent.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,9 @@ | ||
[general] | ||
description = "Sample crate" | ||
licenses = [] | ||
maintainers = ["any@bo.dy"] | ||
maintainers-logins = ["someone"] | ||
|
||
['1.0'] | ||
origin = "file://." | ||
depends-on.checkenv = "*" |
1 change: 1 addition & 0 deletions
1
testsuite/tests/setenv/env-during-fetch/my_index/index/index.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 @@ | ||
version = "0.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,33 @@ | ||
""" | ||
Check that an env var is defined during dependency retrieval (get and with) | ||
""" | ||
|
||
import os | ||
import re | ||
|
||
from drivers.alr import run_alr | ||
from drivers.asserts import assert_match | ||
from drivers.helpers import path_separator | ||
|
||
|
||
def verify_output(text): | ||
assert_match('.*CHECKENV_TEST_VAR exists\n.*', | ||
text, flags=re.S) | ||
|
||
# The "checkenv" crate defines CHECKENV_TEST_VAR. Also, its executable prints | ||
# "CHECKENV_TEST_VAR exists" or "CHECKENV_TEST_VAR does NOT exist" when run. | ||
# The crate defines post-fetch actions to self-build and self-run, so the | ||
# output is generated at the moment we want to check. | ||
|
||
# Retrieve a crate that depends on checkenv: checkparent --> checkenv | ||
p = run_alr("get", "checkparent") | ||
verify_output(p.out) | ||
|
||
# Create a crate from scratch and add the same dependency to perform the check | ||
# during retrieval by `with` | ||
run_alr("init", "--bin", "xxx") | ||
os.chdir("xxx") | ||
p = run_alr("with", "checkenv") | ||
verify_output(p.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,4 @@ | ||
driver: python-script | ||
indexes: | ||
my_index: | ||
in_fixtures: false |
Empty file.
4 changes: 4 additions & 0 deletions
4
testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.lock
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,4 @@ | ||
[context] | ||
advisory = "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT MANUALLY" | ||
solved = true | ||
|
12 changes: 12 additions & 0 deletions
12
testsuite/tests/setenv/linked-paths/my_index/crates/crate_1234/alire/crate_1234.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 @@ | ||
["0.0.0"] | ||
origin = "file://.." | ||
[general] | ||
description = "Shiny new project" | ||
maintainers = [ | ||
"your@email.here", | ||
] | ||
maintainers-logins = [ | ||
"github-username", | ||
] | ||
|
||
project-files = ["nested/project.gpr"] |
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 = "0.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,29 @@ | ||
""" | ||
Check that both base path, and a extra project path for a softlinked crate is | ||
properly added to the environment | ||
""" | ||
|
||
import os | ||
import re | ||
|
||
from drivers.alr import run_alr | ||
from drivers.asserts import assert_match | ||
from drivers.helpers import path_separator | ||
|
||
# Initialize test crate | ||
run_alr("init", "--bin", "xxx") | ||
os.chdir("xxx") | ||
|
||
# Link a folder with also contains crate definitions | ||
run_alr("with", "--use=../my_index/crates/crate_1234") | ||
|
||
# Check paths are proper (base and one extra nested) | ||
s = path_separator() | ||
p = run_alr("setenv") | ||
assert_match('export GPR_PROJECT_PATH=".*/my_index/crates/crate_1234' | ||
':.*/my_index/crates/crate_1234/nested/"\n' | ||
'export ALIRE="True"\n'.replace('/', re.escape(path_separator())), | ||
p.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,4 @@ | ||
driver: python-script | ||
indexes: | ||
my_index: | ||
in_fixtures: false |