From 2d43d89e66e24ef5c0c5341878873b532c0745ae Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Mon, 24 Feb 2025 13:59:43 -0700 Subject: [PATCH 1/3] add initial SFTP benchmark collection scripts --- .github/workflows/sftp-benchmark.yml | 123 +++++++++++++++++++ examples/sftpclient/sftpclient.c | 41 +++++++ scripts/get-sftp-benchmark.sh | 173 +++++++++++++++++++++++++++ 3 files changed, 337 insertions(+) create mode 100644 .github/workflows/sftp-benchmark.yml create mode 100755 scripts/get-sftp-benchmark.sh diff --git a/.github/workflows/sftp-benchmark.yml b/.github/workflows/sftp-benchmark.yml new file mode 100644 index 00000000..d8ceffe4 --- /dev/null +++ b/.github/workflows/sftp-benchmark.yml @@ -0,0 +1,123 @@ +name: Benchmark Test + +on: + push: + branches: [ '*' ] + pull_request: + branches: [ '*' ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build_wolfssl: + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + wolfssl: [ master ] + name: Build wolfssl + runs-on: ${{ matrix.os }} + timeout-minutes: 4 + steps: + - name: Checking cache for wolfssl + uses: actions/cache@v4 + id: cache-wolfssl + with: + path: build-dir/ + key: wolfssh-sshd-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} + lookup-only: true + + - name: Checkout, build, and install wolfssl + if: steps.cache-wolfssl.outputs.cache-hit != 'true' + uses: wolfSSL/actions-build-autotools-project@v1 + with: + repository: wolfssl/wolfssl + ref: ${{ matrix.wolfssl }} + path: wolfssl + configure: --enable-all + check: false + install: true + + build_wolfssh: + needs: + - build_wolfssl + - create_matrix + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + wolfssl: ${{ fromJson(needs.create_matrix.outputs['versions']) }} + name: Build and test wolfsshd + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + steps: + - name: Checking cache for wolfssl + uses: actions/cache@v4 + with: + path: build-dir/ + key: wolfssh-sshd-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} + fail-on-cache-miss: true + + - uses: actions/checkout@v4 + with: + path: wolfssh/ + + - name: autogen + working-directory: ./wolfssh/ + run: ./autogen.sh + + - name: configure + working-directory: ./wolfssh/ + run : | + ./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120" + + - name: make + working-directory: ./wolfssh/ + run: make + + - name: Get Saved OpenSSH Upload Results + uses: actions/downlad-artifact@v4 + with: + path: ./wolfssh/ + artifact_id: 'openssh-upload' + + + - name: Put test key in authorized keys file + run: | + touch ~/.ssh/authorized_keys_test + cat ./keys/hansel-*.pub > authorized_keys_test + chmod 600 ./keys/hansel-key-*.pem + sudo systemctl restart sshd + sudo service sshd restart + + - name: Run SFTP client benchmark + working-directory: ./wolfssh/ + run: | + ./scripts/get-sftp-benchmark.sh + + - name: Store Upload Speed PNG + uses: actions/upload-artifact@v4 + with: + name: upload-results.png + path: wolfssh/upload-results.png + + - name: Store Download Speed PNG + uses: actions/upload-artifact@v4 + with: + name: download-results.png + path: wolfssh/download-results.png + + - name: Comment on PR about performance + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") + gh pr comment $PR_NUMBER --body "Attached is the performance results" \ + --attach download-results.png \ + --attach upload-results.png + + artifacts: + 'openssh-upload': { 'path': 'wolfssh/openssh-average-upload.csv' } + 'openssh-download': { 'path': 'wolfssh/openssh-average-download.csv' } diff --git a/examples/sftpclient/sftpclient.c b/examples/sftpclient/sftpclient.c index 744c79b7..106fad65 100644 --- a/examples/sftpclient/sftpclient.c +++ b/examples/sftpclient/sftpclient.c @@ -132,6 +132,8 @@ static void err_msg(const char* s) #else #include + double current_time_ms(int); + /* return number of seconds*/ word32 current_time(int reset) { @@ -142,6 +144,18 @@ static void err_msg(const char* s) gettimeofday(&tv, 0); return (word32)tv.tv_sec; } + + /* return number of micro seconds */ + double current_time_ms(int reset) + { + struct timeval tv; + + (void)reset; + + gettimeofday(&tv, 0); + return (word64)(tv.tv_sec*1000000) + tv.tv_usec; + } + #endif /* USE_WINDOWS_API */ #endif /* !WOLFSSH_NO_TIMESTAMP */ @@ -1106,6 +1120,12 @@ static int doAutopilot(int cmd, char* local, char* remote) char fullpath[128] = "."; WS_SFTPNAME* name = NULL; byte remoteAbsPath = 0; +#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) + double currentTime; + double longBytes = 0; + FILE* f; +#endif + /* check if is absolute path before making it one */ if (remote != NULL && WSTRLEN(remote) > 2 && remote[1] == ':' && @@ -1137,6 +1157,18 @@ static int doAutopilot(int cmd, char* local, char* remote) remote); } +#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) + ret = WFOPEN(NULL, &f, fullpath, "rb"); + if (ret != 0 || f == WBADFILE) return WS_BAD_FILE_E; + if (WFSEEK(NULL, f, 0, WSEEK_END) != 0) { + WFCLOSE(NULL, f); + return WS_BAD_FILE_E; + } + longBytes = (word32)WFTELL(NULL, f); + WREWIND(NULL, f); + currentTime = current_time_ms(0); +#endif + do { if (cmd == AUTOPILOT_PUT) { ret = wolfSSH_SFTP_Put(ssh, local, fullpath, 0, NULL); @@ -1158,6 +1190,15 @@ static int doAutopilot(int cmd, char* local, char* remote) fullpath, local); } } +#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) + else { + currentTime = current_time_ms(0) - currentTime; + double result; + result = (double)longBytes / 1000000; + result = result / ((double)currentTime / 1000000); + printf("Transfered %s at %.2fMB/s\n", fullpath, result); + } +#endif wolfSSH_SFTPNAME_list_free(name); return ret; diff --git a/scripts/get-sftp-benchmark.sh b/scripts/get-sftp-benchmark.sh new file mode 100755 index 00000000..846aca27 --- /dev/null +++ b/scripts/get-sftp-benchmark.sh @@ -0,0 +1,173 @@ +#!/bin/bash + +KEY="keys/hansel-key-ecc.pem" +TEST_FILE="/home/jak/Documents/wolfssh-fork/test" +FILE_SIZES=("5000" "10000" "50000" "100000" "150000" "200000" "250000" "300000" "350000" "400000" "500000" "1000000") +TRANSFER_MBS="" +NUMBER_RUNS=10 +LOG_FILE="$PWD/log.csv" +COMPARE_TO="" +AVERAGE_FILE="" + +if [ -z $1 ]; then + echo "Assuming default server port of 22 (pass port number as first" + echo "argument if wanting to connect to a different port)" + PORT=22 +else + PORT="$1" +fi + +do_openssh_put_test() { + cp $TEST_FILE $TEST_FILE-out + sftp_command="sftp -P$PORT -i $KEY jak@127.0.0.1" + output_file="sftp_log.txt" + + # Start the script command to capture the sftp session +script -qc "$sftp_command << EOF + put $TEST_FILE $TEST_FILE-out + bye +EOF" /dev/null 2>&1 | tee $output_file | while read line; do + if [[ "$line" == *'MB/s'* ]]; then + #TRANSFER_MBS=$(echo "$line" | awk '{print $(NF-2)}' | sed 's/MB\/s//') + TRANSFER_MBS="$(echo "$line" | awk '{print $(NF-2)}' | sed 's/MB\/s//')" + printf " $TRANSFER_MBS" >> $LOG_FILE + fi + done +} + +do_openssh_get_test() { + cp $TEST_FILE $TEST_FILE-out + sftp_command="sftp -P $PORT -i $KEY jak@127.0.0.1" + output_file="sftp_log.txt" + + # Start the script command to capture the sftp session +script -qc "$sftp_command << EOF + get $TEST_FILE $TEST_FILE-out + bye +EOF" /dev/null 2>&1 | tee $output_file | while read line; do + if [[ "$line" == *'MB/s'* ]]; then + #TRANSFER_MBS=$(echo "$line" | awk '{print $(NF-2)}' | sed 's/MB\/s//') + TRANSFER_MBS="$(echo "$line" | awk '{print $(NF-2)}' | sed 's/MB\/s//')" + printf " $TRANSFER_MBS" >> $LOG_FILE + fi + done +} + +do_wolfssh_put_test() { + cp $TEST_FILE $TEST_FILE-out + RESULT=$(./examples/sftpclient/wolfsftp -g -l $TEST_FILE -r $TEST_FILE-out -i $PWD/keys/hansel-key-ecc.der -j $PWD/keys/hansel-key-ecc.pub -u jak -p $PORT) + TRANSFER_MBS="$(echo "$RESULT" | awk '{print $(NF-0)}' | sed 's/MB\/s//')" + printf " $TRANSFER_MBS" >> $LOG_FILE +} + +do_wolfssh_get_test() { + cp $TEST_FILE $TEST_FILE-out + RESULT=$(./examples/sftpclient/wolfsftp -G -l $TEST_FILE-out -r $TEST_FILE -i $PWD/keys/hansel-key-ecc.der -j $PWD/keys/hansel-key-ecc.pub -u jak -p $PORT) + TRANSFER_MBS="$(echo "$RESULT" | awk '{print $(NF-0)}' | sed 's/MB\/s//')" + printf " $TRANSFER_MBS" >> $LOG_FILE +} + +# Create a log with averages +do_create_average() { + awk -F', ' '{sum[$1]+=$2; count[$1]++} END {for (i in sum) print i, sum[i]/count[i]}' "$LOG_FILE" | sort -n > "$AVERAGE_FILE" + sed -i 's/ /, /' $AVERAGE_FILE +} + + +do_create_plot() { + gnuplot -e "set title '$TITLE';set ylabel 'MB/s';set xlabel 'File Size in Bytes';set grid; set format x \"%2.1t{/Symbol \264}10^{%L}\"; set term png;set output '$OUTPUT_FILE';plot '$LOG_FILE' using 1:2, '$AVERAGE_FILE' with lines lc rgb 'red' lw 2, '$COMPARE_TO' with lines lc rgb 'gold' lw 2" +} + +echo "Starting tests" +echo "Getting the average over $NUMBER_RUNS runs" + +# create openssh average if not found +AVERAGE_FILE="$PWD/openssh-average-upload.csv" +if [ ! -f "$AVERAGE_FILE" ]; then + echo "Collecting openssh average upload" + rm -f $LOG_FILE && touch $LOG_FILE + for run in $(seq 1 $NUMBER_RUNS); do + printf "Run $run: " + for i in "${FILE_SIZES[@]}"; do + tail -c "$i" /dev/urandom > "$TEST_FILE" + printf "$i," >> $LOG_FILE + do_openssh_put_test + printf "\n" >> $LOG_FILE + done + printf "done\n" + done + + do_create_average + echo "" +fi + +# create wolfssh average upload +echo "Collecting wolfssh average upload" +rm -f $LOG_FILE && touch $LOG_FILE +for run in $(seq 1 $NUMBER_RUNS); do + printf "Run $run: " + for i in "${FILE_SIZES[@]}"; do + tail -c "$i" /dev/urandom > "$TEST_FILE" + printf "$i," >> $LOG_FILE + do_wolfssh_put_test + printf "\n" >> $LOG_FILE + done + printf "done\n" +done + +# compile and plot the results of average upload +AVERAGE_FILE="$PWD/wolfssh-average-upload.csv" +do_create_average + +TITLE="SFTP Client Upload Speeds [$NUMBER_RUNS runs]" +COMPARE_TO="$PWD/openssh-average-upload.csv" +AVERAGE_FILE="$PWD/wolfssh-average-upload.csv" +OUTPUT_FILE="$PWD/upload-results.png" +do_create_plot + +# create openssh average download if not found +AVERAGE_FILE="$PWD/openssh-average-download.csv" +if [ ! -f "$AVERAGE_FILE" ]; then + echo "Collecting openssh average download" + rm -f $LOG_FILE && touch $LOG_FILE + for run in $(seq 1 $NUMBER_RUNS); do + printf "Run $run: " + for i in "${FILE_SIZES[@]}"; do + tail -c "$i" /dev/urandom > "$TEST_FILE" + printf "$i," >> $LOG_FILE + do_openssh_get_test + printf "\n" >> $LOG_FILE + done + printf "done\n" + done + + do_create_average + echo "" +fi + +# create wolfssh average download +echo "Collecting wolfssh average download" +rm -f $LOG_FILE && touch $LOG_FILE +for run in $(seq 1 $NUMBER_RUNS); do + printf "Run $run: " + for i in "${FILE_SIZES[@]}"; do + tail -c "$i" /dev/urandom > "$TEST_FILE" + printf "$i," >> $LOG_FILE + do_wolfssh_get_test + printf "\n" >> $LOG_FILE + done + printf "done\n" +done + +# compile and plot the results of average download speeds +AVERAGE_FILE="$PWD/wolfssh-average-download.csv" +do_create_average + +TITLE="SFTP Client Download Speeds [$NUMBER_RUNS runs]" +COMPARE_TO="$PWD/openssh-average-download.csv" +AVERAGE_FILE="$PWD/wolfssh-average-download.csv" +OUTPUT_FILE="$PWD/download-results.png" +do_create_plot + +rm -rf $TEST_FILE +rm -rf $TEST_FILE-out From 5873f9f1b84c16a59e3b52539df53d5aa1afc436 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Mon, 24 Feb 2025 14:13:00 -0700 Subject: [PATCH 2/3] sftp benchmark github action --- .github/workflows/sftp-benchmark.yml | 111 +++++++++++++++++++++------ examples/sftpclient/sftpclient.c | 16 ++-- scripts/get-sftp-benchmark.sh | 12 +-- 3 files changed, 102 insertions(+), 37 deletions(-) diff --git a/.github/workflows/sftp-benchmark.yml b/.github/workflows/sftp-benchmark.yml index d8ceffe4..2e762da8 100644 --- a/.github/workflows/sftp-benchmark.yml +++ b/.github/workflows/sftp-benchmark.yml @@ -6,6 +6,12 @@ on: pull_request: branches: [ '*' ] +# give permissions to write a comment on the pull request +permissions: + pull-requests: write + actions: read + contents: read + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -43,13 +49,12 @@ jobs: build_wolfssh: needs: - build_wolfssl - - create_matrix strategy: fail-fast: false matrix: os: [ ubuntu-latest ] - wolfssl: ${{ fromJson(needs.create_matrix.outputs['versions']) }} - name: Build and test wolfsshd + wolfssl: [ master ] + name: Collect SFTP performance runs-on: ${{ matrix.os }} timeout-minutes: 10 steps: @@ -71,53 +76,109 @@ jobs: - name: configure working-directory: ./wolfssh/ run : | - ./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120" + ./configure --enable-all LDFLAGS="-L${{ github.workspace }}/build-dir/lib" CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_FPKI -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=4000000 -DMAX_PATH_SZ=120 -DEXAMPLE_SFTP_BENCHMARK" - name: make working-directory: ./wolfssh/ run: make - name: Get Saved OpenSSH Upload Results - uses: actions/downlad-artifact@v4 + id: cache-upload + uses: actions/cache@v4 with: - path: ./wolfssh/ - artifact_id: 'openssh-upload' + path: wolfssh/openssh-average-download.csv + key: openssh-average-download.csv + fail-on-cache-miss: false + - name: Get Saved OpenSSH Download Results + id: cache-download + uses: actions/cache@v4 + with: + path: wolfssh/openssh-average-upload.csv + key: openssh-averavge-upload.csv + fail-on-cache-miss: false - - name: Put test key in authorized keys file + - name: Install gnuplot + run: sudo apt-get install gnuplot + + - name: Setup OpenSSH Test Server + working-directory: ./wolfssh/ run: | - touch ~/.ssh/authorized_keys_test - cat ./keys/hansel-*.pub > authorized_keys_test + sudo apt-get install openssh-server + mkdir ~/.ssh + chmod 700 ~/.ssh + echo "AuthorizedKeysFile $PWD/keys/hansel-key-ecc.pub" >> sshd-config-test.txt + echo "PubkeyAuthentication yes" >> sshd-config-test.txt + echo "Subsystem sftp internal-sftp" >> sshd-config-test.txt + echo "KbdInteractiveAuthentication no" >> sshd-config-test.txt + sed -i.bak "s/hansel/$USER/" ./keys/hansel-key-ecc.pub chmod 600 ./keys/hansel-key-*.pem - sudo systemctl restart sshd - sudo service sshd restart + chmod 600 ./keys/hansel-key-*.pub + sudo mkdir -p /run/sshd + sudo chmod 755 /run/sshd + sudo /usr/sbin/sshd -p 22222 -f sshd-config-test.txt -E $PWD/sshd-log.txt + cat sshd-config-test.txt + ps -e | grep sshd - name: Run SFTP client benchmark working-directory: ./wolfssh/ + timeout-minutes: 5 run: | - ./scripts/get-sftp-benchmark.sh + ./scripts/get-sftp-benchmark.sh 22222 - name: Store Upload Speed PNG uses: actions/upload-artifact@v4 with: - name: upload-results.png + name: upload-results-pr${{ github.event.pull_request.number }}.png path: wolfssh/upload-results.png + retention-days: 2 - name: Store Download Speed PNG uses: actions/upload-artifact@v4 with: - name: download-results.png + name: download-results-pr${{ github.event.pull_request.number }}.png path: wolfssh/download-results.png + retention-days: 2 - - name: Comment on PR about performance - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload OpenSSH Download Results + if: steps.cache-download.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: wolfssh/openssh-average-download.csv + key: openssh-average-download.csv + + - name: Upload OpenSSH Upload Results + if: steps.cache-upload.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: wolfssh/openssh-average-upload.csv + key: openssh-average-upload.csv + +# Currently the comment in PR does not work correctly +# - name: Comment on PR about performance +# env: +# GITHUB_URL: ${{ github.event.pull_request.comments_url }} +# GH_TOKEN: ${{ github.token }} +# PR_NUMBER: ${{ github.event.pull_request.number }} +# RUN_ID: ${{ github.run_id }} +# run: | +# # Get both artifact IDs +# DOWNLOAD_ARTIFACT=$(gh api repos/${{ github.repository }}/actions/artifacts \ +# --jq '.artifacts[] | select(.name | contains("download-results-pr")) | .id') +# UPLOAD_ARTIFACT=$(gh api repos/${{ github.repository }}/actions/artifacts \ +# --jq '.artifacts[] | select(.name | contains("upload-results-pr")) | .id') +# +# # Create the comment with direct link to download +# curl -X POST \ +# $GITHUB_URL \ +# -H "Content-Type: application/json" \ +# -H "Authorization: token $GH_TOKEN" \ +# -d "{\"body\":\"Performance test results:\n\n- [Download Results](https://github.com/${{ github.repository }}/actions/runs/$RUN_ID/artifacts/$DOWNLOAD_ARTIFACT)\n- [Upload Results](https://github.com/${{ github.repository }}/actions/runs/$RUN_ID/artifacts/$UPLOAD_ARTIFACT)\"}" + + - name: Print logs if failed + working-directory: ./wolfssh/ + if: failure() run: | - PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") - gh pr comment $PR_NUMBER --body "Attached is the performance results" \ - --attach download-results.png \ - --attach upload-results.png + sudo cat sshd-log.txt + cat log.csv - artifacts: - 'openssh-upload': { 'path': 'wolfssh/openssh-average-upload.csv' } - 'openssh-download': { 'path': 'wolfssh/openssh-average-download.csv' } diff --git a/examples/sftpclient/sftpclient.c b/examples/sftpclient/sftpclient.c index 106fad65..f8017082 100644 --- a/examples/sftpclient/sftpclient.c +++ b/examples/sftpclient/sftpclient.c @@ -132,8 +132,6 @@ static void err_msg(const char* s) #else #include - double current_time_ms(int); - /* return number of seconds*/ word32 current_time(int reset) { @@ -145,6 +143,9 @@ static void err_msg(const char* s) return (word32)tv.tv_sec; } +#ifdef EXAMPLE_SFTP_BENCHMARK + double current_time_ms(int); + /* return number of micro seconds */ double current_time_ms(int reset) { @@ -155,7 +156,7 @@ static void err_msg(const char* s) gettimeofday(&tv, 0); return (word64)(tv.tv_sec*1000000) + tv.tv_usec; } - +#endif #endif /* USE_WINDOWS_API */ #endif /* !WOLFSSH_NO_TIMESTAMP */ @@ -1120,7 +1121,8 @@ static int doAutopilot(int cmd, char* local, char* remote) char fullpath[128] = "."; WS_SFTPNAME* name = NULL; byte remoteAbsPath = 0; -#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) +#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) &&\ + defined(EXAMPLE_SFTP_BENCHMARK) double currentTime; double longBytes = 0; FILE* f; @@ -1157,7 +1159,8 @@ static int doAutopilot(int cmd, char* local, char* remote) remote); } -#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) +#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) &&\ + defined(EXAMPLE_SFTP_BENCHMARK) ret = WFOPEN(NULL, &f, fullpath, "rb"); if (ret != 0 || f == WBADFILE) return WS_BAD_FILE_E; if (WFSEEK(NULL, f, 0, WSEEK_END) != 0) { @@ -1190,7 +1193,8 @@ static int doAutopilot(int cmd, char* local, char* remote) fullpath, local); } } -#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) +#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) &&\ + defined(EXAMPLE_SFTP_BENCHMARK) else { currentTime = current_time_ms(0) - currentTime; double result; diff --git a/scripts/get-sftp-benchmark.sh b/scripts/get-sftp-benchmark.sh index 846aca27..5c6036d4 100755 --- a/scripts/get-sftp-benchmark.sh +++ b/scripts/get-sftp-benchmark.sh @@ -1,7 +1,7 @@ #!/bin/bash -KEY="keys/hansel-key-ecc.pem" -TEST_FILE="/home/jak/Documents/wolfssh-fork/test" +KEY="$PWD/keys/hansel-key-ecc.pem" +TEST_FILE="$PWD/test" FILE_SIZES=("5000" "10000" "50000" "100000" "150000" "200000" "250000" "300000" "350000" "400000" "500000" "1000000") TRANSFER_MBS="" NUMBER_RUNS=10 @@ -19,7 +19,7 @@ fi do_openssh_put_test() { cp $TEST_FILE $TEST_FILE-out - sftp_command="sftp -P$PORT -i $KEY jak@127.0.0.1" + sftp_command="sftp -P$PORT -o \"StrictHostKeyChecking no\" -i $KEY $USER@127.0.0.1" output_file="sftp_log.txt" # Start the script command to capture the sftp session @@ -37,7 +37,7 @@ EOF" /dev/null 2>&1 | tee $output_file | while read line; do do_openssh_get_test() { cp $TEST_FILE $TEST_FILE-out - sftp_command="sftp -P $PORT -i $KEY jak@127.0.0.1" + sftp_command="sftp -P $PORT -o \"StrictHostKeyChecking no\" -i $KEY $USER@127.0.0.1" output_file="sftp_log.txt" # Start the script command to capture the sftp session @@ -55,14 +55,14 @@ EOF" /dev/null 2>&1 | tee $output_file | while read line; do do_wolfssh_put_test() { cp $TEST_FILE $TEST_FILE-out - RESULT=$(./examples/sftpclient/wolfsftp -g -l $TEST_FILE -r $TEST_FILE-out -i $PWD/keys/hansel-key-ecc.der -j $PWD/keys/hansel-key-ecc.pub -u jak -p $PORT) + RESULT=$(./examples/sftpclient/wolfsftp -g -l $TEST_FILE -r $TEST_FILE-out -i $PWD/keys/hansel-key-ecc.der -j $PWD/keys/hansel-key-ecc.pub -u $USER -p $PORT) TRANSFER_MBS="$(echo "$RESULT" | awk '{print $(NF-0)}' | sed 's/MB\/s//')" printf " $TRANSFER_MBS" >> $LOG_FILE } do_wolfssh_get_test() { cp $TEST_FILE $TEST_FILE-out - RESULT=$(./examples/sftpclient/wolfsftp -G -l $TEST_FILE-out -r $TEST_FILE -i $PWD/keys/hansel-key-ecc.der -j $PWD/keys/hansel-key-ecc.pub -u jak -p $PORT) + RESULT=$(./examples/sftpclient/wolfsftp -G -l $TEST_FILE-out -r $TEST_FILE -i $PWD/keys/hansel-key-ecc.der -j $PWD/keys/hansel-key-ecc.pub -u $USER -p $PORT) TRANSFER_MBS="$(echo "$RESULT" | awk '{print $(NF-0)}' | sed 's/MB\/s//')" printf " $TRANSFER_MBS" >> $LOG_FILE } From 75ac463693dcb29e2487ea23b6ed3bc0bf950b80 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Mon, 24 Mar 2025 10:37:23 -0600 Subject: [PATCH 3/3] turn on assembly optimizations with github action benchmark --- .github/workflows/sftp-benchmark.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sftp-benchmark.yml b/.github/workflows/sftp-benchmark.yml index 2e762da8..383b804d 100644 --- a/.github/workflows/sftp-benchmark.yml +++ b/.github/workflows/sftp-benchmark.yml @@ -32,7 +32,7 @@ jobs: id: cache-wolfssl with: path: build-dir/ - key: wolfssh-sshd-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} + key: wolfssh-benchmark-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} lookup-only: true - name: Checkout, build, and install wolfssl @@ -42,7 +42,7 @@ jobs: repository: wolfssl/wolfssl ref: ${{ matrix.wolfssl }} path: wolfssl - configure: --enable-all + configure: --enable-all --enable-intelasm --enable-sp --enable-sp-asm check: false install: true @@ -62,7 +62,7 @@ jobs: uses: actions/cache@v4 with: path: build-dir/ - key: wolfssh-sshd-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} + key: wolfssh-benchmark-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }} fail-on-cache-miss: true - uses: actions/checkout@v4