From d0a6e99a1f6bd3271bfe40b95728e120fb838572 Mon Sep 17 00:00:00 2001 From: Prabhpreet Dua <615318+prabhpreet@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:25:42 +0530 Subject: [PATCH] feat: Regression CI based on misc/generate_configs.py --- .ci/run-regression.sh | 33 +++++++++++++++++++++++++++++++ .github/workflows/regressions.yml | 23 +++++++++++++++++++++ .gitignore | 2 ++ misc/generate_configs.py | 8 ++++---- 4 files changed, 62 insertions(+), 4 deletions(-) create mode 100755 .ci/run-regression.sh create mode 100644 .github/workflows/regressions.yml diff --git a/.ci/run-regression.sh b/.ci/run-regression.sh new file mode 100755 index 0000000..956b545 --- /dev/null +++ b/.ci/run-regression.sh @@ -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 \ No newline at end of file diff --git a/.github/workflows/regressions.yml b/.github/workflows/regressions.yml new file mode 100644 index 0000000..4f1e6cb --- /dev/null +++ b/.github/workflows/regressions.yml @@ -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 diff --git a/.gitignore b/.gitignore index f8c71e7..d240f9d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ _markdown_* **/result **/result-* .direnv + +/output \ No newline at end of file diff --git a/misc/generate_configs.py b/misc/generate_configs.py index 27f1c53..5a1997a 100644 --- a/misc/generate_configs.py +++ b/misc/generate_configs.py @@ -1,14 +1,14 @@ from pathlib import Path from subprocess import run - +import os config = dict( peer_counts=[1, 5, 10, 50, 100, 500], peer_count_max=100, - ate_ip="192.168.2.1", - dut_ip="192.168.2.4", + ate_ip="127.0.0.1", + dut_ip="127.0.0.1", 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)