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 1/3] 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 00000000..956b5454 --- /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 00000000..4f1e6cb2 --- /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 f8c71e78..d240f9d6 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 27f1c53f..5a1997af 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) From 87144233da14837b701d1973d70cff9521d0370d Mon Sep 17 00:00:00 2001 From: Prabhpreet Dua <615318+prabhpreet@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:53:46 +0530 Subject: [PATCH 2/3] Prettier --- .github/workflows/regressions.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/regressions.yml b/.github/workflows/regressions.yml index 4f1e6cb2..f356b9fd 100644 --- a/.github/workflows/regressions.yml +++ b/.github/workflows/regressions.yml @@ -9,15 +9,11 @@ permissions: 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 + 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 From f6320c3c355212f423d47ef90375226081709ef1 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 8 Jul 2024 14:10:42 +0200 Subject: [PATCH 3/3] ci: fixup regression test Signed-off-by: Paul Spooren --- .ci/run-regression.sh | 28 ++++++++++++++-------------- .github/workflows/regressions.yml | 2 ++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.ci/run-regression.sh b/.ci/run-regression.sh index 956b5454..cf3df56b 100755 --- a/.ci/run-regression.sh +++ b/.ci/run-regression.sh @@ -1,33 +1,33 @@ -#!/bin/bash +#!/usr/bin/env bash -iterations=$1 -sleep_time=$2 +iterations="$1" +sleep_time="$2" -PWD=$(pwd) -EXEC=$PWD/target/release/rosenpass -LOGS=$PWD/output/logs +PWD="$(pwd)" +EXEC="$PWD/target/release/rosenpass" +LOGS="$PWD/output/logs" -mkdir -p output/logs +mkdir -p "$LOGS" run_command() { local file=$1 local log_file="$2" - ($EXEC exchange-config $file 2>&1 | sed "s/^/[$2] /" | tee -a $log_file) & + ("$EXEC" exchange-config "$file" 2>&1 | 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+=($!) +(cd output/dut && run_command "configs/dut-$iterations.toml" "$LOGS/dut.log") +for (( x=0; x