-
-
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
26 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
testsuite/tests/workflows/air-gapping/my_index/crates/hello/HEAD
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 @@ | ||
ref: refs/heads/master |
4 changes: 4 additions & 0 deletions
4
testsuite/tests/workflows/air-gapping/my_index/crates/hello/config
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 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = true |
1 change: 1 addition & 0 deletions
1
testsuite/tests/workflows/air-gapping/my_index/crates/hello/description
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 @@ | ||
Unnamed repository; edit this file 'description' to name the repository. |
Binary file added
BIN
+124 Bytes
...flows/air-gapping/my_index/crates/hello/objects/15/cb23051f1ff3a6684a57531e46df799d5824f2
Binary file not shown.
Binary file added
BIN
+54 Bytes
...flows/air-gapping/my_index/crates/hello/objects/2b/5f082653488d19f6108867e493b657e75320ce
Binary file not shown.
Binary file added
BIN
+77 Bytes
...flows/air-gapping/my_index/crates/hello/objects/62/36aa7e1dbdd096427ed632c7d4755983c12d33
Binary file not shown.
Binary file added
BIN
+83 Bytes
...flows/air-gapping/my_index/crates/hello/objects/69/e7a181416f665433500caf06d9d4b9b897b133
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
...flows/air-gapping/my_index/crates/hello/objects/cd/89b04bec4c8580f565b34a3aef11716e3ce963
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
2 changes: 2 additions & 0 deletions
2
testsuite/tests/workflows/air-gapping/my_index/crates/hello/packed-refs
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,2 @@ | ||
# pack-refs with: peeled fully-peeled sorted | ||
cd89b04bec4c8580f565b34a3aef11716e3ce963 refs/heads/master |
Empty file.
1 change: 1 addition & 0 deletions
1
testsuite/tests/workflows/air-gapping/my_index/crates/libhello/HEAD
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 @@ | ||
ref: refs/heads/master |
4 changes: 4 additions & 0 deletions
4
testsuite/tests/workflows/air-gapping/my_index/crates/libhello/config
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 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = true |
1 change: 1 addition & 0 deletions
1
testsuite/tests/workflows/air-gapping/my_index/crates/libhello/description
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 @@ | ||
Unnamed repository; edit this file 'description' to name the repository. |
Binary file added
BIN
+82 Bytes
...ws/air-gapping/my_index/crates/libhello/objects/10/dbaf3d2d4ceaad2d7f4785b4aa0d1f912b38e5
Binary file not shown.
Binary file added
BIN
+69 Bytes
...ws/air-gapping/my_index/crates/libhello/objects/23/1e491e1a187b52dd5e94238e5170cb4de37ce1
Binary file not shown.
Binary file added
BIN
+87 Bytes
...ws/air-gapping/my_index/crates/libhello/objects/33/053304cbc00068c0963822cd51a309ae42ff00
Binary file not shown.
Binary file added
BIN
+154 Bytes
...ws/air-gapping/my_index/crates/libhello/objects/60/cb127eb6ba5c883490c4c8ada38e4a15347092
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
...ws/air-gapping/my_index/crates/libhello/objects/82/65f7ebea39d73db9675fc91495b448ed5960ec
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,2 @@ | ||
x��A | ||
�0P�9��\2�4�)�+�<�t:�@c ���<�����ߗ�R�`/�P�*�o�dD���wNfo�p`�ܲ ��;x���w�&���3K.z��Ʀ�`�yOpj�ֶ������k�~����4� |
Binary file added
BIN
+122 Bytes
...ws/air-gapping/my_index/crates/libhello/objects/c6/a9c4c3965544f12ce8cc39e8c14a55f43dde91
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
testsuite/tests/workflows/air-gapping/my_index/crates/libhello/packed-refs
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,2 @@ | ||
# pack-refs with: peeled fully-peeled sorted | ||
8265f7ebea39d73db9675fc91495b448ed5960ec refs/heads/master |
Empty file.
12 changes: 12 additions & 0 deletions
12
testsuite/tests/workflows/air-gapping/my_index/index/he/hello/hello-1.0.1.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 = "\"Hello, world!\" demonstration project" | ||
name = "hello" | ||
version = "1.0.1" | ||
maintainers = ["[email protected]", "[email protected]"] | ||
maintainers-logins = ["mylogin"] | ||
|
||
[[depends-on]] | ||
libhello = "^1.0" | ||
|
||
[origin] | ||
url = "git+file:../../../crates/hello" | ||
commit = "cd89b04bec4c8580f565b34a3aef11716e3ce963" |
1 change: 1 addition & 0 deletions
1
testsuite/tests/workflows/air-gapping/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 = "1.1" |
9 changes: 9 additions & 0 deletions
9
testsuite/tests/workflows/air-gapping/my_index/index/li/libhello/libhello-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,9 @@ | ||
description = "\"Hello, world!\" demonstration project support library" | ||
name = "libhello" | ||
version = "1.0.0" | ||
maintainers = ["[email protected]"] | ||
maintainers-logins = ["mylogin"] | ||
|
||
[origin] | ||
url = "git+file:../../../crates/libhello" | ||
commit = "8265f7ebea39d73db9675fc91495b448ed5960ec" |
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,90 @@ | ||
""" | ||
Test fetching a crate online, and subsequently building offline. | ||
""" | ||
|
||
|
||
import os | ||
import shutil | ||
import subprocess | ||
import sys | ||
|
||
from drivers.alr import run_alr | ||
from drivers.helpers import init_git_repo, on_windows | ||
from drivers.asserts import assert_eq, assert_match | ||
|
||
|
||
# Mock git, curl, gprbuild etc. with dummy scripts | ||
if on_windows(): | ||
print('SKIP: command mocking unavailable on Windows') | ||
sys.exit(0) | ||
os.mkdir("path-dir") | ||
os.chdir("path-dir") | ||
for executable in ("git", "hg", "svn", "curl", "gprbuild"): | ||
with open(executable, "w") as f: | ||
f.write("\n".join([ | ||
"#!/usr/bin/env python", | ||
"import sys", | ||
"print('Mocked command called')", | ||
"sys.exit(1)" | ||
])) | ||
os.chmod(executable, 0o764) | ||
os.environ["PATH"] = f'{os.getcwd()}{os.pathsep}{os.environ["PATH"]}' | ||
os.chdir("..") | ||
|
||
|
||
# 'dependencies.shared=false' is required to ensure dependencies are packaged | ||
# inside the workspace (at ./alire/cache/dependencies) | ||
run_alr("settings", "--global", "--set", "dependencies.shared", "false") | ||
|
||
# Run `alr get hello`. This will fail because git is unavailable. | ||
p = run_alr("get", "hello", quiet=False, complain_on_error=False) | ||
assert_match(".*Mocked command called", p.out) | ||
assert_match(".*Deployment of commit .* from .* to .* failed", p.out) | ||
|
||
# Disable git mocking and run `alr get hello` to 'download' the crate and its | ||
# dependencies. | ||
os.remove(os.path.join("path-dir", "git")) | ||
p = run_alr("get", "hello", quiet=False) | ||
assert_match(r".*hello=1\.0\.1 successfully retrieved", p.out) | ||
assert_match(r".*\+ libhello 1\.0\.0 \(new\)", p.out) | ||
|
||
# Re-enable git mocking and make the index unavailable to simulate disconnection | ||
# from the network | ||
shutil.copy(os.path.join("path-dir", "curl"), os.path.join("path-dir", "git")) | ||
shutil.move("my_index", "somewhere_else") | ||
|
||
# Simulate transferring to a different system by clearing the alr-config | ||
# directory (we keep settings.toml, since it just does various things to isolate | ||
# the test environment) and changing the absolute path of the crate directory. | ||
for f in os.listdir("alr-config"): | ||
if f != "settings.toml": | ||
shutil.rmtree(os.path.join("alr-config", f)) | ||
shutil.move(f"hello_1.0.1_cd89b04b", "hello") | ||
|
||
# Run `alr build`. This will fail because gprbuild is unavailable. | ||
os.chdir(f"hello") | ||
p = run_alr("build", quiet=False, complain_on_error=False) | ||
assert_match(".*Mocked command called", p.out) | ||
assert_match(r'.*Command \["gprbuild", .*\] exited with code 1', p.out) | ||
|
||
# Disable gprbuild mocking and run `alr build` to build the crate (with git | ||
# mocking still enabled to check it doesn't try to fetch anything else) | ||
os.remove(os.path.join("..", "path-dir", "gprbuild")) | ||
p = run_alr("build", quiet=False) | ||
assert_match(".*Build finished successfully in .* seconds", p.out) | ||
|
||
# Check the built binary works as expected | ||
assert_eq( | ||
b"Hello, world!\n", | ||
subprocess.run([os.path.join("obj", "hello")], capture_output=True).stdout | ||
) | ||
|
||
# Clear out the downloaded dependencies, and verify that `alr build` then | ||
# attempts (and fails) to re-fetch them | ||
shutil.rmtree(os.path.join("alire", "cache", "dependencies")) | ||
p = run_alr("build", quiet=False, complain_on_error=False) | ||
assert_match(".*Mocked command called", p.out) | ||
assert_match(".*Deployment of commit .* from .* to .* failed", 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 |