diff options
author | Yureka <tvl@yuka.dev> | 2024-07-21T14·41+0200 |
---|---|---|
committer | yuka <tvl@yuka.dev> | 2024-07-22T13·36+0000 |
commit | 67335c41b7828e11d28dead8193152da94116e6d (patch) | |
tree | 045647f6b1dfc5df077286333aef26ee31f1e33f /tvix/glue | |
parent | 6774d9c59ce201864b2af05365b8a7ea2fa1066e (diff) |
refactor(tvix): move service addrs into shared clap struct r/8399
Change-Id: I7cab29ecfa1823c2103b4c47b7d784bc31459d55 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12008 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de> Autosubmit: yuka <yuka@yuka.dev>
Diffstat (limited to 'tvix/glue')
-rw-r--r-- | tvix/glue/Cargo.toml | 1 | ||||
-rw-r--r-- | tvix/glue/benches/eval.rs | 7 | ||||
-rw-r--r-- | tvix/glue/src/builtins/mod.rs | 7 | ||||
-rw-r--r-- | tvix/glue/src/tests/mod.rs | 7 | ||||
-rw-r--r-- | tvix/glue/src/tvix_store_io.rs | 8 |
5 files changed, 22 insertions, 8 deletions
diff --git a/tvix/glue/Cargo.toml b/tvix/glue/Cargo.toml index 6fe35c7a5a89..4c72ed676bc6 100644 --- a/tvix/glue/Cargo.toml +++ b/tvix/glue/Cargo.toml @@ -31,6 +31,7 @@ sha1 = "0.10.6" md-5 = "0.10.6" url = "2.4.0" walkdir = "2.4.0" +clap = { version = "4.4.0", default-features = false } [dependencies.wu-manber] git = "https://github.com/tvlfyi/wu-manber.git" diff --git a/tvix/glue/benches/eval.rs b/tvix/glue/benches/eval.rs index ee3d554dcbab..3468fa4e431e 100644 --- a/tvix/glue/benches/eval.rs +++ b/tvix/glue/benches/eval.rs @@ -1,3 +1,4 @@ +use clap::Parser; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use lazy_static::lazy_static; use std::{env, rc::Rc, sync::Arc, time::Duration}; @@ -11,7 +12,7 @@ use tvix_glue::{ tvix_io::TvixIO, tvix_store_io::TvixStoreIO, }; -use tvix_store::utils::construct_services; +use tvix_store::utils::{construct_services, ServiceUrlsMemory}; #[cfg(not(target_env = "msvc"))] #[global_allocator] @@ -27,7 +28,9 @@ fn interpret(code: &str) { // piece of code. b/262 let (blob_service, directory_service, path_info_service, nar_calculation_service) = TOKIO_RUNTIME - .block_on(async { construct_services("memory://", "memory://", "memory://").await }) + .block_on(async { + construct_services(ServiceUrlsMemory::parse_from(std::iter::empty::<&str>())).await + }) .unwrap(); // We assemble a complete store in memory. diff --git a/tvix/glue/src/builtins/mod.rs b/tvix/glue/src/builtins/mod.rs index e1d1c9c84f25..21685484867a 100644 --- a/tvix/glue/src/builtins/mod.rs +++ b/tvix/glue/src/builtins/mod.rs @@ -60,12 +60,13 @@ mod tests { use crate::tvix_store_io::TvixStoreIO; use super::{add_derivation_builtins, add_fetcher_builtins, add_import_builtins}; + use clap::Parser; use nix_compat::store_path::hash_placeholder; use rstest::rstest; use tempfile::TempDir; use tvix_build::buildservice::DummyBuildService; use tvix_eval::{EvalIO, EvaluationResult}; - use tvix_store::utils::construct_services; + use tvix_store::utils::{construct_services, ServiceUrlsMemory}; /// evaluates a given nix expression and returns the result. /// Takes care of setting up the evaluator so it knows about the @@ -74,7 +75,9 @@ mod tests { // We assemble a complete store in memory. let runtime = tokio::runtime::Runtime::new().expect("Failed to build a Tokio runtime"); let (blob_service, directory_service, path_info_service, nar_calculation_service) = runtime - .block_on(async { construct_services("memory://", "memory://", "memory://").await }) + .block_on(async { + construct_services(ServiceUrlsMemory::parse_from(std::iter::empty::<&str>())).await + }) .expect("Failed to construct store services in memory"); let io = Rc::new(TvixStoreIO::new( diff --git a/tvix/glue/src/tests/mod.rs b/tvix/glue/src/tests/mod.rs index e9f21c32912e..f68ea5425899 100644 --- a/tvix/glue/src/tests/mod.rs +++ b/tvix/glue/src/tests/mod.rs @@ -1,10 +1,11 @@ use std::{rc::Rc, sync::Arc}; +use clap::Parser; use pretty_assertions::assert_eq; use std::path::PathBuf; use tvix_build::buildservice::DummyBuildService; use tvix_eval::{EvalIO, Value}; -use tvix_store::utils::construct_services; +use tvix_store::utils::{construct_services, ServiceUrlsMemory}; use rstest::rstest; @@ -35,7 +36,9 @@ fn eval_test(code_path: PathBuf, expect_success: bool) { let tokio_runtime = tokio::runtime::Runtime::new().unwrap(); let (blob_service, directory_service, path_info_service, nar_calculation_service) = tokio_runtime - .block_on(async { construct_services("memory://", "memory://", "memory://").await }) + .block_on(async { + construct_services(ServiceUrlsMemory::parse_from(std::iter::empty::<&str>())).await + }) .unwrap(); let tvix_store_io = Rc::new(TvixStoreIO::new( diff --git a/tvix/glue/src/tvix_store_io.rs b/tvix/glue/src/tvix_store_io.rs index cfc037e8dada..c25194d50fda 100644 --- a/tvix/glue/src/tvix_store_io.rs +++ b/tvix/glue/src/tvix_store_io.rs @@ -627,10 +627,11 @@ mod tests { use std::{path::Path, rc::Rc, sync::Arc}; use bstr::ByteSlice; + use clap::Parser; use tempfile::TempDir; use tvix_build::buildservice::DummyBuildService; use tvix_eval::{EvalIO, EvaluationResult}; - use tvix_store::utils::construct_services; + use tvix_store::utils::{construct_services, ServiceUrlsMemory}; use super::TvixStoreIO; use crate::builtins::{add_derivation_builtins, add_fetcher_builtins, add_import_builtins}; @@ -642,7 +643,10 @@ mod tests { let tokio_runtime = tokio::runtime::Runtime::new().unwrap(); let (blob_service, directory_service, path_info_service, nar_calculation_service) = tokio_runtime - .block_on(async { construct_services("memory://", "memory://", "memory://").await }) + .block_on(async { + construct_services(ServiceUrlsMemory::parse_from(std::iter::empty::<&str>())) + .await + }) .unwrap(); let io = Rc::new(TvixStoreIO::new( |