Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make mg GitHub actions more stable moving compilation before running tests #867

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions message-generator-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

@plebhash plebhash May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment explaining this sleep?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to give time to every process to close successfully

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my suggestion was to add a comment to the shell script


echo $entry
RUST_LOG=$RUST_LOG cargo run -- $search_dir$entry || { echo 'mg test failed' ; exit 1; }
done
Expand Down
6 changes: 3 additions & 3 deletions test/config/tproxy-config-no-jd-sv1-cpu-md.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
channel_nominal_hashrate = 500.0
2 changes: 2 additions & 0 deletions test/message-generator/test/interop-jd-translator.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
{
"command": "cargo",
"args": [
"llvm-cov",
"--no-report",
"run",
"-p",
"sv1-mining-device"
Expand Down
48 changes: 0 additions & 48 deletions test/message-generator/test/pool-sri-test-1-standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 2 additions & 0 deletions test/message-generator/test/pool-sri-test-close-channel.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
{
"command": "cargo",
"args": [
"llvm-cov",
"--no-report",
"run",
"-p",
"translator_sv2",
Expand Down
21 changes: 0 additions & 21 deletions test/message-generator/test/standard-coverage-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions test/message-generator/test/sv1-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
{
"command": "cargo",
"args": [
"llvm-cov",
"--no-report",
"run",
"-p",
"pool_sv2",
Expand All @@ -112,6 +114,8 @@
{
"command": "cargo",
"args": [
"llvm-cov",
"--no-report",
"run",
"-p",
"translator_sv2",
Expand Down
2 changes: 2 additions & 0 deletions test/message-generator/test/translation-proxy-broke-pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
{
"command": "cargo",
"args": [
"llvm-cov",
"--no-report",
"run",
"-p",
"translator_sv2",
Expand Down
2 changes: 2 additions & 0 deletions test/message-generator/test/translation-proxy.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
{
"command": "cargo",
"args": [
"llvm-cov",
"--no-report",
"run",
"-p",
"translator_sv2",
Expand Down
6 changes: 4 additions & 2 deletions utils/message-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}));
}
Expand All @@ -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();
Expand Down
Loading