diff --git a/message-generator-tests.sh b/message-generator-tests.sh index 89accf677..3eec44328 100755 --- a/message-generator-tests.sh +++ b/message-generator-tests.sh @@ -6,18 +6,34 @@ else RUST_LOG="debug" fi -search_dir="../../test/message-generator/test/" message_generator_dir="./utils/message-generator/" - cd $message_generator_dir cargo llvm-cov clean +cd ../../roles +cargo build -p mining-device +cargo llvm-cov -p pool_sv2 +cargo llvm-cov -p jd_server +cargo llvm-cov -p jd_client +cargo llvm-cov -p translator_sv2 +cargo llvm-cov -p mining_proxy_sv2 +cd ./roles-utils +cargo llvm-cov +cd ../../ + +search_dir="../../test/message-generator/test/" + +cd $message_generator_dir +cargo build + for entry in `ls $search_dir`; do if [ "$entry" = "interop-jdc-change-upstream.json" ]; then echo "Skipping $entry" continue fi + sleep 10 + echo $entry RUST_LOG=$RUST_LOG cargo run -- $search_dir$entry || { echo 'mg test failed' ; exit 1; } done diff --git a/test/config/tproxy-config-no-jd-sv1-cpu-md.toml b/test/config/tproxy-config-no-jd-sv1-cpu-md.toml index fdca70399..d79cf92f2 100644 --- a/test/config/tproxy-config-no-jd-sv1-cpu-md.toml +++ b/test/config/tproxy-config-no-jd-sv1-cpu-md.toml @@ -37,12 +37,12 @@ coinbase_reward_sat = 5_000_000_000 # hashes/s of the weakest miner that will be connecting min_individual_miner_hashrate=100_000.0 # minimum number of shares needed before a mining.set_difficulty is sent for updating targets -miner_num_submits_before_update=5 +miner_num_submits_before_update=200 # target number of shares per minute the miner should be sending shares_per_minute = 100.0 [upstream_difficulty_config] # interval in seconds to elapse before updating channel hashrate with the pool -channel_diff_update_interval = 60 +channel_diff_update_interval = 6000 # estimated accumulated hashrate of all downstream miners -channel_nominal_hashrate = 500.0 \ No newline at end of file +channel_nominal_hashrate = 500.0 diff --git a/test/message-generator/test/interop-jd-translator.json b/test/message-generator/test/interop-jd-translator.json index 1b06c385c..ee9a52c0a 100644 --- a/test/message-generator/test/interop-jd-translator.json +++ b/test/message-generator/test/interop-jd-translator.json @@ -125,6 +125,8 @@ { "command": "cargo", "args": [ + "llvm-cov", + "--no-report", "run", "-p", "sv1-mining-device" diff --git a/test/message-generator/test/pool-sri-test-1-standard.json b/test/message-generator/test/pool-sri-test-1-standard.json index 4f338cda2..1d3cbc4cd 100644 --- a/test/message-generator/test/pool-sri-test-1-standard.json +++ b/test/message-generator/test/pool-sri-test-1-standard.json @@ -144,54 +144,6 @@ } } }, - { - "command": "cargo", - "args": [ - "run", - "../../../test/message-generator/mock/template-provider-mock0.json" - ], - "conditions": { - "WithConditions": { - "conditions": [ - { - "output_string": "Running `target/debug/message_generator_sv2 ../../../test/message-generator/mock/template-provider-mock0.json`", - "output_location": "StdErr", - "late_condition": false, - "condition": true - } - ], - "timer_secs": 320, - "warn_no_panic": false - } - } - }, - { - "command": "cargo", - "args": [ - "llvm-cov", - "--no-report", - "run", - "-p", - "pool_sv2", - "--", - "-c", - "../test/config/pool-mock-tp.toml" - ], - "conditions": { - "WithConditions": { - "conditions": [ - { - "output_string": "Listening for encrypted connection on: 127.0.0.1:34254", - "output_location": "StdOut", - "late_condition": false, - "condition": true - } - ], - "timer_secs": 320, - "warn_no_panic": false - } - } - }, { "command": "cargo", "args": [ diff --git a/test/message-generator/test/pool-sri-test-close-channel.json b/test/message-generator/test/pool-sri-test-close-channel.json index a30f1b3c6..00a7236eb 100644 --- a/test/message-generator/test/pool-sri-test-close-channel.json +++ b/test/message-generator/test/pool-sri-test-close-channel.json @@ -81,6 +81,8 @@ { "command": "cargo", "args": [ + "llvm-cov", + "--no-report", "run", "-p", "translator_sv2", diff --git a/test/message-generator/test/standard-coverage-test.json b/test/message-generator/test/standard-coverage-test.json index 0e237b508..a9a8daa93 100644 --- a/test/message-generator/test/standard-coverage-test.json +++ b/test/message-generator/test/standard-coverage-test.json @@ -181,27 +181,6 @@ } } }, - { - "command": "cargo", - "args": [ - "run", - "../../../test/message-generator/mock/template-provider-mock1.json" - ], - "conditions": { - "WithConditions": { - "conditions": [ - { - "output_string": "Running `target/debug/message_generator_sv2 ../../../test/message-generator/mock/template-provider-mock1.json`", - "output_location": "StdErr", - "late_condition": false, - "condition": true - } - ], - "timer_secs": 320, - "warn_no_panic": false - } - } - }, { "command": "cargo", "args": [ "llvm-cov", diff --git a/test/message-generator/test/sv1-test.json b/test/message-generator/test/sv1-test.json index 90a1e3659..3ae6298b0 100644 --- a/test/message-generator/test/sv1-test.json +++ b/test/message-generator/test/sv1-test.json @@ -87,6 +87,8 @@ { "command": "cargo", "args": [ + "llvm-cov", + "--no-report", "run", "-p", "pool_sv2", @@ -112,6 +114,8 @@ { "command": "cargo", "args": [ + "llvm-cov", + "--no-report", "run", "-p", "translator_sv2", diff --git a/test/message-generator/test/translation-proxy-broke-pool.json b/test/message-generator/test/translation-proxy-broke-pool.json index 2fb9026b0..7d03ed372 100644 --- a/test/message-generator/test/translation-proxy-broke-pool.json +++ b/test/message-generator/test/translation-proxy-broke-pool.json @@ -64,6 +64,8 @@ { "command": "cargo", "args": [ + "llvm-cov", + "--no-report", "run", "-p", "translator_sv2", diff --git a/test/message-generator/test/translation-proxy.json b/test/message-generator/test/translation-proxy.json index abdc7e6c5..9ded5a191 100644 --- a/test/message-generator/test/translation-proxy.json +++ b/test/message-generator/test/translation-proxy.json @@ -159,6 +159,8 @@ { "command": "cargo", "args": [ + "llvm-cov", + "--no-report", "run", "-p", "translator_sv2", diff --git a/utils/message-generator/src/main.rs b/utils/message-generator/src/main.rs index b996c002e..3df2c1dad 100644 --- a/utils/message-generator/src/main.rs +++ b/utils/message-generator/src/main.rs @@ -26,7 +26,7 @@ use std::{ }, vec::Vec, }; -use tracing::info; +use tracing::{error, info}; use tracing_core::{Event, Subscriber}; use tracing_subscriber::{ filter::EnvFilter, @@ -401,7 +401,8 @@ async fn main() { let pass = Arc::new(AtomicBool::new(false)); { let fail = fail.clone(); - std::panic::set_hook(Box::new(move |_| { + std::panic::set_hook(Box::new(move |info| { + error!("{:#?}", info); fail.store(true, Ordering::Relaxed); })); } @@ -423,6 +424,7 @@ async fn main() { }); } loop { + tokio::task::yield_now().await; if fail.load(Ordering::Relaxed) { clean_up(cleanup).await; let _ = std::panic::take_hook();