mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 18:41:03 +00:00
* Initial commit
Forked at: 8b59544660
Parent branch: origin/master
* Validation: don't detect STDIN closing when running in process (#1695)
This commit is contained in:
@@ -21,21 +21,20 @@ const WORKER_ARGS_TEST: &[&'static str] = &["--nocapture", "validation_worker"];
|
||||
use crate::adder;
|
||||
use parachain::{
|
||||
primitives::{BlockData, ValidationParams},
|
||||
wasm_executor::{ValidationError, InvalidCandidate, EXECUTION_TIMEOUT_SEC, ValidationExecutionMode, ValidationPool},
|
||||
wasm_executor::{ValidationError, InvalidCandidate, EXECUTION_TIMEOUT_SEC, ExecutionMode, ValidationPool},
|
||||
};
|
||||
|
||||
fn validation_pool() -> ValidationPool {
|
||||
let execution_mode = ValidationExecutionMode::ExternalProcessCustomHost {
|
||||
fn execution_mode() -> ExecutionMode {
|
||||
ExecutionMode::ExternalProcessCustomHost {
|
||||
pool: ValidationPool::new(),
|
||||
binary: std::env::current_exe().unwrap(),
|
||||
args: WORKER_ARGS_TEST.iter().map(|x| x.to_string()).collect(),
|
||||
};
|
||||
|
||||
ValidationPool::new(execution_mode)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn terminates_on_timeout() {
|
||||
let pool = validation_pool();
|
||||
let execution_mode = execution_mode();
|
||||
|
||||
let result = parachain::wasm_executor::validate_candidate(
|
||||
halt::wasm_binary_unwrap(),
|
||||
@@ -45,7 +44,7 @@ fn terminates_on_timeout() {
|
||||
relay_chain_height: 1,
|
||||
hrmp_mqc_heads: Vec::new(),
|
||||
},
|
||||
parachain::wasm_executor::ExecutionMode::Remote(&pool),
|
||||
&execution_mode,
|
||||
sp_core::testing::TaskExecutor::new(),
|
||||
);
|
||||
match result {
|
||||
@@ -59,11 +58,11 @@ fn terminates_on_timeout() {
|
||||
|
||||
#[test]
|
||||
fn parallel_execution() {
|
||||
let pool = validation_pool();
|
||||
let execution_mode = execution_mode();
|
||||
|
||||
let start = std::time::Instant::now();
|
||||
|
||||
let pool2 = pool.clone();
|
||||
let execution_mode2 = execution_mode.clone();
|
||||
let thread = std::thread::spawn(move ||
|
||||
parachain::wasm_executor::validate_candidate(
|
||||
halt::wasm_binary_unwrap(),
|
||||
@@ -73,7 +72,7 @@ fn parallel_execution() {
|
||||
relay_chain_height: 1,
|
||||
hrmp_mqc_heads: Vec::new(),
|
||||
},
|
||||
parachain::wasm_executor::ExecutionMode::Remote(&pool2),
|
||||
&execution_mode,
|
||||
sp_core::testing::TaskExecutor::new(),
|
||||
).ok());
|
||||
let _ = parachain::wasm_executor::validate_candidate(
|
||||
@@ -84,7 +83,7 @@ fn parallel_execution() {
|
||||
relay_chain_height: 1,
|
||||
hrmp_mqc_heads: Vec::new(),
|
||||
},
|
||||
parachain::wasm_executor::ExecutionMode::Remote(&pool),
|
||||
&execution_mode2,
|
||||
sp_core::testing::TaskExecutor::new(),
|
||||
);
|
||||
thread.join().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user