From 18deaeac073fa280a5e55f9fbaf9f602a1e9d9e4 Mon Sep 17 00:00:00 2001 From: Makoto Mizukami Date: Tue, 10 May 2022 22:53:19 +0900 Subject: [PATCH 1/5] Builds for Linux on AArch64 --- .circleci/config.yml | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f9a508..ce8e878 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,6 +39,10 @@ executors: docker: - image: archlinux resource_class: medium + ubuntu-machine-aarch64: + machine: + image: ubuntu-2004:current + resource_class: arm.medium windows: machine: image: windows-server-2019-vs2019:stable @@ -165,6 +169,61 @@ jobs: - store_artifacts: path: << parameters.artefact-identifier >>.tar.gz + build-linux-aarch64: + executor: ubuntu-machine-aarch64 + parameters: + artefact-identifier: + type: string + default: iperf3-<< pipeline.parameters.build-name >>-linux-aarch64 + environment: + ARTEFACT_IDENTIFIER: << parameters.artefact-identifier >> + steps: + - run: + name: Run everything inside a latest clean Docker container + command: | + docker run --rm -it -e CIRCLE_WORKING_DIRECTORY -e SRC_REPO -e TARGET_COMMIT_HASH -e ARTEFACT_IDENTIFIER -v "$(pwd)":/root -w /root ubuntu:rolling bash -c ''' + + set -euo pipefail + + # Install dependencies + apt update + apt install -y git gcc make + + # Clone iperf3 + mkdir -p iperf + pushd iperf + + git init + git remote add origin "${SRC_REPO}" + git fetch --depth 1 origin "${TARGET_COMMIT_HASH}" + git checkout "${TARGET_COMMIT_HASH}" + + # Build iperf3 + IPERF3_MAKE_PREFIX="/root/${ARTEFACT_IDENTIFIER}" + mkdir -p "${IPERF3_MAKE_PREFIX}" + + ./configure --prefix="${IPERF3_MAKE_PREFIX}" --disable-shared --disable-static --enable-static-bin + make + make install + + mkdir -p "${IPERF3_MAKE_PREFIX}/share/doc/iperf3" + cp LICENSE "${IPERF3_MAKE_PREFIX}/share/doc/iperf3" + + # Create a tarball + popd + tar -czf "${ARTEFACT_IDENTIFIER}.tar.gz" "${ARTEFACT_IDENTIFIER}" + + ''' + environment: + SRC_REPO: << pipeline.parameters.src-repo >> + TARGET_COMMIT_HASH: << pipeline.parameters.target-commit-hash >> + - persist_to_workspace: + root: . + paths: + - << parameters.artefact-identifier >>.tar.gz + - store_artifacts: + path: << parameters.artefact-identifier >>.tar.gz + build-windows-amd64: executor: windows parameters: @@ -365,6 +424,7 @@ workflows: not: << pipeline.parameters.is-setup >> jobs: - build-linux-amd64 + - build-linux-aarch64 - build-windows-amd64 - build-macos-amd64 @@ -375,6 +435,13 @@ workflows: executor: ubuntu-docker extract-cmd: tar -xf "iperf3-${BUILD_NAME}-linux-amd64.tar.gz" artefact-identifier: iperf3-<< pipeline.parameters.build-name >>-linux-amd64 + - test-unified: + name: test-linux-aarch64 + requires: + - build-linux-aarch64 + executor: ubuntu-machine-aarch64 + extract-cmd: tar -xf "iperf3-${BUILD_NAME}-linux-aarch64.tar.gz" + artefact-identifier: iperf3-<< pipeline.parameters.build-name >>-linux-aarch64 - test-unified: name: test-windows-amd64 requires: From 52ed5d24a810f1e92779808e574ecef570f93873 Mon Sep 17 00:00:00 2001 From: Makoto Mizukami Date: Tue, 10 May 2022 22:49:17 +0900 Subject: [PATCH 2/5] Builds for Linux x86-64 on Ubuntu --- .circleci/config.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ce8e878..25c329b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -122,7 +122,7 @@ jobs: CONTINUE_CONFIG: << parameters.continue-config >> build-linux-amd64: - executor: archlinux-docker + executor: ubuntu-docker parameters: artefact-identifier: type: string @@ -132,7 +132,9 @@ jobs: steps: - run: name: Install dependencies - command: pacman -Syu --noconfirm git gcc make + command: | + apt update + apt install -y git gcc make - run: name: Clone iperf3 command: | @@ -400,7 +402,7 @@ jobs: name: Install dependencies command: | apt update - apt -y install curl git + apt install -y curl git tmpPath=$(mktemp) curl -sSJL https://api.github.com/repos/cli/cli/releases/latest | grep -o 'https://github.com/cli/cli/releases/download/[^/]\{1,\}/gh_[^/]\{1,\}_linux_amd64.deb' | xargs curl -o $tmpPath -JL @@ -432,7 +434,7 @@ workflows: name: test-linux-amd64 requires: - build-linux-amd64 - executor: ubuntu-docker + executor: archlinux-docker extract-cmd: tar -xf "iperf3-${BUILD_NAME}-linux-amd64.tar.gz" artefact-identifier: iperf3-<< pipeline.parameters.build-name >>-linux-amd64 - test-unified: From c06176937d264d9bf8180e29f5d4d136b642809a Mon Sep 17 00:00:00 2001 From: Makoto Mizukami Date: Tue, 10 May 2022 23:31:39 +0900 Subject: [PATCH 3/5] Align linking strategy --- .circleci/config.yml | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 25c329b..fe1f2e9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -155,7 +155,7 @@ jobs: IPERF3_MAKE_PREFIX="$(eval echo "${CIRCLE_WORKING_DIRECTORY}")/${ARTEFACT_IDENTIFIER}" mkdir -p "${IPERF3_MAKE_PREFIX}" - ./configure --prefix="${IPERF3_MAKE_PREFIX}" --disable-shared --disable-static + ./configure --prefix="${IPERF3_MAKE_PREFIX}" --disable-shared --disable-static --enable-static-bin make make install @@ -322,6 +322,9 @@ jobs: name: Build iperf3 working_directory: iperf command: | + find /usr/local -name libssl.3.dylib -exec rm -f {} \; + find /usr/local -name libcrypto.3.dylib -exec rm -f {} \; + IPERF3_MAKE_PREFIX="$(eval echo "${CIRCLE_WORKING_DIRECTORY}")/${ARTEFACT_IDENTIFIER}" mkdir -p "${IPERF3_MAKE_PREFIX}" @@ -332,26 +335,6 @@ jobs: # Copy licence terms for iperf mkdir -p "${IPERF3_MAKE_PREFIX}/share/doc/iperf3" cp LICENSE "${IPERF3_MAKE_PREFIX}/share/doc/iperf3" - - # Postruns - cd "${IPERF3_MAKE_PREFIX}/bin" - # Copy linked OpenSSL libraris to the current directory - # and tell the linker to refer to them - otool -L iperf3 | grep openssl | awk '{ print $1 }' | while read -r dylib; do - name=$(basename "${dylib}") - cp "${dylib}" ./ - chmod u+w "${name}" - install_name_tool -change "${dylib}" "@executable_path/${name}" iperf3 - done - # Modify libssl as well - find . -name "libssl.*.dylib" | while read -r libssl; do - otool -L "${libssl}" | grep openssl | awk '{ print $1 }' | while read -r dylib; do - install_name_tool -change "${dylib}" "@executable_path/$(basename "${dylib}")" "${libssl}" - done - done - # Copy licence terms for OpenSSL - mkdir -p "${IPERF3_MAKE_PREFIX}/share/doc/openssl" - cp "$(brew --prefix openssl)/LICENSE.txt" "${IPERF3_MAKE_PREFIX}/share/doc/openssl" - run: name: Create a Zip file command: zip -r "${ARTEFACT_IDENTIFIER}.zip" "${ARTEFACT_IDENTIFIER}" From cfb2488d6fdea1de47e0483a8e99c3448d882250 Mon Sep 17 00:00:00 2001 From: Makoto Mizukami Date: Tue, 10 May 2022 23:36:19 +0900 Subject: [PATCH 4/5] Refactor --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fe1f2e9..12ea247 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -361,7 +361,7 @@ jobs: name: Extracting executable command: << parameters.extract-cmd >> environment: - BUILD_NAME: << pipeline.parameters.build-name >> + ARTEFACT_IDENTIFIER: << parameters.artefact-identifier >> - run: name: Test executable command: bin/iperf3 -v @@ -418,14 +418,14 @@ workflows: requires: - build-linux-amd64 executor: archlinux-docker - extract-cmd: tar -xf "iperf3-${BUILD_NAME}-linux-amd64.tar.gz" + extract-cmd: tar -xf "${ARTEFACT_IDENTIFIER}.tar.gz" artefact-identifier: iperf3-<< pipeline.parameters.build-name >>-linux-amd64 - test-unified: name: test-linux-aarch64 requires: - build-linux-aarch64 executor: ubuntu-machine-aarch64 - extract-cmd: tar -xf "iperf3-${BUILD_NAME}-linux-aarch64.tar.gz" + extract-cmd: tar -xf "${ARTEFACT_IDENTIFIER}.tar.gz" artefact-identifier: iperf3-<< pipeline.parameters.build-name >>-linux-aarch64 - test-unified: name: test-windows-amd64 @@ -434,7 +434,7 @@ workflows: executor: windows extract-cmd: | $ProgressPreference = "SilentlyContinue" - Expand-Archive "iperf3-${env:BUILD_NAME}-windows-amd64.zip" . + Expand-Archive "${env:ARTEFACT_IDENTIFIER}.zip" . artefact-identifier: iperf3-<< pipeline.parameters.build-name >>-windows-amd64 - test-unified: name: test-macos-amd64 @@ -443,7 +443,7 @@ workflows: executor: macos extract-cmd: | brew uninstall --ignore-dependencies openssl - unzip "iperf3-${BUILD_NAME}-macos-amd64.zip" + unzip "${ARTEFACT_IDENTIFIER}.zip" artefact-identifier: iperf3-<< pipeline.parameters.build-name >>-macos-amd64 - release: From 67de7a0028318b37b448643ce1a9aba7acf3e699 Mon Sep 17 00:00:00 2001 From: Makoto Mizukami Date: Tue, 10 May 2022 23:54:55 +0900 Subject: [PATCH 5/5] Reduce flakiness --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 12ea247..9eca0ef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -371,6 +371,9 @@ jobs: command: bin/iperf3 -s working_directory: << parameters.artefact-identifier >> background: true + - run: + name: Pause for a while for the server process to be up and running + command: exit - run: name: Run as a client command: bin/iperf3 -c localhost -R