Skip to content

Commit

Permalink
Every MG test in a separate action (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorbax authored and Fi3 committed May 28, 2024
1 parent bbcbd1c commit 5920b17
Show file tree
Hide file tree
Showing 40 changed files with 317 additions and 107 deletions.
63 changes: 53 additions & 10 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,59 @@ jobs:
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Pre build everything
run: |
cargo build --manifest-path=benches/Cargo.toml
cargo build --manifest-path=common/Cargo.toml
cargo build --manifest-path=protocols/Cargo.toml
cargo build --manifest-path=roles/Cargo.toml
cargo build --manifest-path=utils/Cargo.toml
- name: Run message generator tests
run: sh ./message-generator-tests.sh
- name: Run bad-pool-config-test
run: sh ./test/message-generator/test/bad-pool-config-test/bad-pool-config-test.sh

- name: Run interop-jd-translator
run: sh ./test/message-generator/test/interop-jd-translator/interop-jd-translator.sh

#- name: Run interop-jdc-change-upstream
# run: sh ./test/message-generator/test/interop-jdc-change-upstream/interop-jdc-change-upstream.sh

- name: Run interop-proxy-with-multi-ups
run: sh ./test/message-generator/test/interop-proxy-with-multi-ups/interop-proxy-with-multi-ups.sh

- name: Run interop-proxy-with-multi-ups-extended
run: sh ./test/message-generator/test/interop-proxy-with-multi-ups-extended/interop-proxy-with-multi-ups-extended.sh

- name: Run jds-do-not-fail-on-wrong-tsdatasucc
run: sh ./test/message-generator/test/jds-do-not-fail-on-wrong-tsdatasucc/jds-do-not-fail-on-wrong-tsdatasucc.sh

- name: Run jds-do-not-panic-if-jdc-close-connection
run: sh ./test/message-generator/test/jds-do-not-panic-if-jdc-close-connection/jds-do-not-panic-if-jdc-close-connection.sh

- name: Run jds-do-not-stackoverflow-when-no-token
run: sh ./test/message-generator/test/jds-do-not-stackoverflow-when-no-token/jds-do-not-stackoverflow-when-no-token.sh

- name: Run pool-sri-test-1-standard
run: sh ./test/message-generator/test/pool-sri-test-1-standard/pool-sri-test-1-standard.sh

- name: Run pool-sri-test-close-channel
run: sh ./test/message-generator/test/pool-sri-test-close-channel/pool-sri-test-close-channel.sh

- name: Run pool-sri-test-extended_0
run: sh ./test/message-generator/test/pool-sri-test-extended_0/pool-sri-test-extended_0.sh

- name: Run pool-sri-test-extended_1
run: sh ./test/message-generator/test/pool-sri-test-extended_1/pool-sri-test-extended_1.sh

- name: Run pool-sri-test-reject-auth
run: sh ./test/message-generator/test/pool-sri-test-reject-auth/pool-sri-test-reject-auth.sh

- name: Run standard-coverage
run: sh ./test/message-generator/test/standard-coverage-test/standard-coverage-test.sh

- name: Run sv1-test
run: sh ./test/message-generator/test/sv1-test/sv1-test.sh

- name: Run translation-proxy-broke-pool
run: sh ./test/message-generator/test/translation-proxy-broke-pool/translation-proxy-broke-pool.sh

- name: Run translation-proxy
run: sh ./test/message-generator/test/translation-proxy/translation-proxy.sh

- name: Coverage report
run: sh ./code-coverage-report.sh

- name: Archive MG code coverage results
uses: actions/upload-artifact@v4
Expand Down
4 changes: 4 additions & 0 deletions code-coverage-report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/sh

cd roles
RUST_LOG=debug cargo llvm-cov --ignore-filename-regex "utils/message-generator/|experimental/|protocols/" --cobertura --output-path "target/mg_coverage.xml" report
21 changes: 6 additions & 15 deletions message-generator-tests.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
#! /bin/sh

if [ "$1" = "--short" ]; then
RUST_LOG="info"
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
search_dir="test/message-generator/test/"

for entry in `ls $search_dir`; do
if [ "$entry" = "interop-jdc-change-upstream.json" ]; then
if [ "$entry" = "interop-jdc-change-upstream" ]; then
echo "Skipping $entry"
continue
fi

echo $entry
RUST_LOG=$RUST_LOG cargo run -- $search_dir$entry || { echo 'mg test failed' ; exit 1; }
$search_dir$entry/$entry.sh
done

cd ../../roles
RUST_LOG=$RUST_LOG cargo llvm-cov --ignore-filename-regex "utils/message-generator/|experimental/|protocols/" --cobertura --output-path "target/mg_coverage.xml" report
cd roles
RUST_LOG=debug cargo llvm-cov --ignore-filename-regex "utils/message-generator/|experimental/|protocols/" --cobertura --output-path "target/mg_coverage.xml" report

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"actions": [
],
"setup_commands": [
{
"command": "cargo",
{ "command": "cargo",
"args": [
"run",
"../../test/message-generator/mock/template-provider-mock0.json"
Expand Down Expand Up @@ -175,7 +174,7 @@
"cleanup_commands": [
{
"command": "pkill",
"args": ["pool", "-SIGINT"],
"args": ["-f", "pool_sv2", "-SIGINT"],
"conditions": "None"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/bad-pool-config-test/bad-pool-config-test.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2
cargo llvm-cov --no-report -p jd_server
cargo llvm-cov --no-report -p jd_client
cargo llvm-cov --no-report -p translator_sv2
cargo build -p sv1-mining-device

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/interop-jd-translator/interop-jd-translator.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
{
"output_string": "SUCCESS SubmitSharesSuccess",
"output_location": "StdOut",
"late_condition": false,
"condition": true
}
],
Expand All @@ -181,6 +182,11 @@
"execution_commands": [
],
"cleanup_commands": [
{
"command": "pkill",
"args": ["-f", "mining_device", "-SIGINT"],
"conditions": "None"
},
{
"command": "pkill",
"args": ["-f", "jd_server", "-SIGINT"],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cd roles
cargo llvm-cov --no-report -p jd_server
cargo llvm-cov --no-report -p jd_client
cargo llvm-cov --no-report -p mining_proxy_sv2
cargo build -p --no-report mining-device

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/interop-jdc-change-upstream/interop-jdc-change-upstream.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2
cargo llvm-cov --no-report -p mining_proxy_sv2
cargo build --no-report -p mining-device

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/interop-proxy-with-multi-ups-extended/interop-proxy-with-multi-ups-extended.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2
cargo llvm-cov --no-report -p mining_proxy_sv2
cargo build -p mining-device

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/interop-proxy-with-multi-ups/interop-proxy-with-multi-ups.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd roles
cargo llvm-cov --no-report -p jd_server

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/jds-do-not-fail-on-wrong-tsdatasucc/jds-do-not-fail-on-wrong-tsdatasucc.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd roles
cargo llvm-cov --no-report -p jd_server

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/jds-do-not-panic-if-jdc-close-connection/jds-do-not-panic-if-jdc-close-connection.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2
cargo llvm-cov --no-report -p jd_client
cargo llvm-cov --no-report -p mining_proxy_sv2

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/jds-do-not-stackoverflow-when-no-token/jds-do-not-stackoverflow-when-no-token.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
Expand Up @@ -145,53 +145,32 @@
}
},
{
"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": [
"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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/pool-sri-test-1-standard/pool-sri-test-1-standard.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@
}
],
"cleanup_commands": [
{
"command": "pkill",
"args": ["-f", "translator_sv2", "-SIGINT"],
"conditions": "None"
}
],
"role": "server",
"upstream": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd roles
cargo build -p translator_sv2

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/pool-sri-test-close-channel/pool-sri-test-close-channel.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/pool-sri-test-extended_0/pool-sri-test-extended_0.json || { echo 'mg test failed' ; exit 1; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/pool-sri-test-extended_1/pool-sri-test-extended_1.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"utils/|experimental/|protocols/",
"--cobertura",
"--output-path",
"target/pool-sri-test-1-standard.xml",
"target/pool-sri-test-reject-auth.xml",
"report"
],
"conditions": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cd roles
cargo llvm-cov --no-report -p pool_sv2

cd ../utils/message-generator/
cargo build

RUST_LOG=debug cargo run ../../test/message-generator/test/pool-sri-test-reject-auth/pool-sri-test-reject-auth.json || { echo 'mg test failed' ; exit 1; }

sleep 10
Loading

0 comments on commit 5920b17

Please sign in to comment.