feat: Regression CI based on misc/generate_configs.py

This commit is contained in:
Prabhpreet Dua
2024-06-14 15:25:42 +05:30
committed by Paul Spooren
parent 010c14dadf
commit d0a6e99a1f
4 changed files with 62 additions and 4 deletions

33
.ci/run-regression.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
iterations=$1
sleep_time=$2
PWD=$(pwd)
EXEC=$PWD/target/release/rosenpass
LOGS=$PWD/output/logs
mkdir -p output/logs
run_command() {
local file=$1
local log_file="$2"
($EXEC exchange-config $file 2>&1 | sed "s/^/[$2] /" | tee -a $log_file) &
echo $!
}
pids=()
(cd output/dut && run_command "configs/dut-$iterations.toml" "dut.log") & piddut=$!
for (( x=0; x<$iterations; x++ )); do
(cd output/ate && run_command "configs/ate-$x.toml" "ate-$x.log") & pids+=($!)
done
sleep $sleep_time
lsof -i :9999 | awk 'NR!=1 {print $2}' | xargs kill
for (( x=0; x<$iterations; x++ )); do
port=$((x + 50000))
lsof -i :$port | awk 'NR!=1 {print $2}' | xargs kill
done

23
.github/workflows/regressions.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: QC
on:
pull_request:
push:
branches: [main]
permissions:
checks: write
contents: read
jobs:
multi-peer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run:
cargo build --bin rosenpass --release
- run:
python misc/generate_configs.py
- run:
chmod +x .ci/run-regression.sh
- run:
.ci/run-regression.sh 100 20

2
.gitignore vendored
View File

@@ -20,3 +20,5 @@ _markdown_*
**/result **/result
**/result-* **/result-*
.direnv .direnv
/output

View File

@@ -1,14 +1,14 @@
from pathlib import Path from pathlib import Path
from subprocess import run from subprocess import run
import os
config = dict( config = dict(
peer_counts=[1, 5, 10, 50, 100, 500], peer_counts=[1, 5, 10, 50, 100, 500],
peer_count_max=100, peer_count_max=100,
ate_ip="192.168.2.1", ate_ip="127.0.0.1",
dut_ip="192.168.2.4", dut_ip="127.0.0.1",
dut_port=9999, dut_port=9999,
path_to_rosenpass_bin="/Users/user/src/rosenppass/rosenpass/target/debug/rosenpass", path_to_rosenpass_bin=os.getcwd() + "/target/release/rosenpass",
) )
print(config) print(config)