Skip to content

Commit

Permalink
fix: use the correct prefix for os_vars in test (#1255)
Browse files Browse the repository at this point in the history
And release 0.32.1
  • Loading branch information
wolfv authored Dec 12, 2024
1 parent 8213c25 commit 687af2d
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 55 deletions.
76 changes: 43 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["rust-tests"]

[package]
name = "rattler-build"
version = "0.32.0"
version = "0.32.1"
authors = ["rattler-build contributors <hi@prefix.dev>"]
repository = "https://github.com/prefix-dev/rattler-build"
edition = "2021"
Expand Down Expand Up @@ -45,7 +45,7 @@ name = "rattler-build"
required-features = ["recipe-generation"]

[dependencies]
serde = { version = "1.0.215", features = ["derive"] }
serde = { version = "1.0.216", features = ["derive"] }
serde_yaml = "0.9.34"
serde-untagged = "0.1.6"
anyhow = "1.0.94"
Expand Down Expand Up @@ -106,7 +106,7 @@ zip = { version = "2.2.1", default-features = false, features = [
"flate2",
"deflate",
] }
bzip2 = "0.4.4"
bzip2 = "0.5.0"
base64 = "0.22.1"
flate2 = "1.0.35"
xz2 = "0.1.7"
Expand All @@ -130,18 +130,18 @@ regex = "1.11.1"
async-recursion = "1.1.1"

# Rattler crates
rattler = { version = "0.28.5", default-features = false, features = ["cli-tools", "indicatif"] }
rattler_cache = { version = "0.2.13", default-features = false }
rattler_conda_types = { version = "0.29.3", default-features = false }
rattler = { version = "0.28.6", default-features = false, features = ["cli-tools", "indicatif"] }
rattler_cache = { version = "0.2.14", default-features = false }
rattler_conda_types = { version = "0.29.4", default-features = false }
rattler_digest = { version = "1.0.3", default-features = false, features = ["serde"] }
rattler_index = { version = "0.20.0", default-features = false }
rattler_index = { version = "0.20.1", default-features = false }
rattler_networking = { version = "0.21.8", default-features = false }
rattler_redaction = { version = "0.1.4" }
rattler_repodata_gateway = { version = "0.21.25", default-features = false, features = ["gateway"] }
rattler_shell = { version = "0.22.8", default-features = false, features = ["sysinfo"] }
rattler_solve = { version = "1.2.4", default-features = false, features = ["resolvo", "serde"] }
rattler_virtual_packages = { version = "1.1.11", default-features = false }
rattler_package_streaming = { version = "0.22.16", default-features = false }
rattler_repodata_gateway = { version = "0.21.26", default-features = false, features = ["gateway"] }
rattler_shell = { version = "0.22.9", default-features = false, features = ["sysinfo"] }
rattler_solve = { version = "1.2.5", default-features = false, features = ["resolvo", "serde"] }
rattler_virtual_packages = { version = "1.1.12", default-features = false }
rattler_package_streaming = { version = "0.22.17", default-features = false }
lazy_static = "1.5.0"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion rust-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
glob = "0.3.1"
rattler_package_streaming = { version = "0.22.16", default-features = false }
rattler_package_streaming = { version = "0.22.17", default-features = false }
serde_json = "1.0.133"
sha1 = "0.10.6"
duct = "0.13.7"
18 changes: 9 additions & 9 deletions src/package_test/run_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ impl CommandsTest {
&self,
pkg: &ArchiveIdentifier,
path: &Path,
prefix: &Path,
test_directory: &Path,
config: &TestConfiguration,
pkg_vars: &HashMap<String, String>,
) -> Result<(), TestError> {
Expand All @@ -674,9 +674,9 @@ impl CommandsTest {
let span = tracing::info_span!("Running script test for", recipe = pkg.to_string());
let _guard = span.enter();

let build_env = if !deps.build.is_empty() {
let build_prefix = if !deps.build.is_empty() {
tracing::info!("Installing build dependencies");
let build_prefix = prefix.join("bld");
let build_prefix = test_directory.join("bld");
let build_dependencies = deps
.build
.iter()
Expand Down Expand Up @@ -717,12 +717,12 @@ impl CommandsTest {
.as_ref()
.unwrap_or(&config.current_platform);

let run_env = prefix.join("run");
let run_prefix = test_directory.join("run");
create_environment(
"test",
&dependencies,
platform,
&run_env,
&run_prefix,
&config.channels,
&config.tool_configuration,
config.channel_priority,
Expand All @@ -732,12 +732,12 @@ impl CommandsTest {
.map_err(TestError::TestEnvironmentSetup)?;

let platform = Platform::current();
let mut env_vars = env_vars::os_vars(prefix, &platform);
let mut env_vars = env_vars::os_vars(&run_prefix, &platform);
env_vars.retain(|key, _| key != ShellEnum::default().path_var(&platform));
env_vars.extend(pkg_vars.iter().map(|(k, v)| (k.clone(), Some(v.clone()))));
env_vars.insert(
"PREFIX".to_string(),
Some(run_env.to_string_lossy().to_string()),
Some(run_prefix.to_string_lossy().to_string()),
);

// copy all test files to a temporary directory and set it as the working
Expand All @@ -756,8 +756,8 @@ impl CommandsTest {
env_vars,
tmp_dir.path(),
path,
&run_env,
build_env.as_ref(),
&run_prefix,
build_prefix.as_ref(),
None,
)
.await
Expand Down
6 changes: 6 additions & 0 deletions test-data/recipes/test-execution/recipe-test-succeed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ build:
- echo "Hello World" > $PREFIX/test-execution.txt
else:
- echo "Hello World" > %PREFIX%\test-execution.txt
- mkdir %LIBRARY_BIN%
- mkdir %LIBRARY_LIB%
- echo "Hello World" > %LIBRARY_BIN%\test.lib
- echo "Hello World" > %LIBRARY_LIB%\test.dll

tests:
- script:
Expand All @@ -26,6 +30,8 @@ tests:
- if not exist %PREFIX%\test-execution.txt (exit 1)
- if not exist .\testfile.txt (exit 1)
- if not exist .\testfolder\data.txt (exit 1)
- if not exist %LIBRARY_BIN%\test.lib (exit 1)
- if not exist %LIBRARY_LIB%\test.dll (exit 1)
files:
recipe:
- testfile.txt
Expand Down

0 comments on commit 687af2d

Please sign in to comment.