diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-02-12 13:57:40 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-02-25 12:06:49 +0100 |
| commit | 28a0154b9b788cedead8fe47dcc1ac12a8af356b (patch) | |
| tree | 43abb5b8e44d696a1aae2ce00a5a479c79de4dcd /test/scripts/build | |
| parent | 5df6076543862e5f8c0ac0430f2774ecb9cd8362 (diff) | |
| download | mullvadvpn-28a0154b9b788cedead8fe47dcc1ac12a8af356b.tar.xz mullvadvpn-28a0154b9b788cedead8fe47dcc1ac12a8af356b.zip | |
Rename some scripts (and move them to subdirectories)
Start off with the download app package / e2e tests binary in
`download.sh`. Rename `test-utils.sh` to `lib.sh` & start to break up
`lib.sh`.
Diffstat (limited to 'test/scripts/build')
| -rwxr-xr-x | test/scripts/build/runner-image.sh | 47 | ||||
| -rwxr-xr-x | test/scripts/build/test-manager.sh | 27 | ||||
| -rwxr-xr-x | test/scripts/build/test-runner.sh | 41 |
3 files changed, 115 insertions, 0 deletions
diff --git a/test/scripts/build/runner-image.sh b/test/scripts/build/runner-image.sh new file mode 100755 index 0000000000..47c41b2e38 --- /dev/null +++ b/test/scripts/build/runner-image.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# This script produces a virtual disk containing the test runner binaries. + +set -eu + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_FRAMEWORK_ROOT="$SCRIPT_DIR/../.." + +TEST_RUNNER_IMAGE_SIZE_MB=5000 + +case $TARGET in + "x86_64-pc-windows-gnu") + TEST_RUNNER_IMAGE_FILENAME=windows-test-runner.img + ;; + *) + echo "Unknown target: $TARGET" + exit 1 + ;; +esac + +echo "************************************************************" +echo "* Preparing test runner image: $TARGET" +echo "************************************************************" + +mkdir -p "${TEST_FRAMEWORK_REPO}/testrunner-images" +TEST_RUNNER_IMAGE_PATH="${TEST_FRAMEWORK_REPO}/testrunner-images/${TEST_RUNNER_IMAGE_FILENAME}" + +case $TARGET in + + "x86_64-pc-windows-gnu") + truncate -s "${TEST_RUNNER_IMAGE_SIZE_MB}M" "${TEST_RUNNER_IMAGE_PATH}" + mformat -F -i "${TEST_RUNNER_IMAGE_PATH}" "::" + mcopy \ + -i "${TEST_RUNNER_IMAGE_PATH}" \ + "${TEST_FRAMEWORK_ROOT}/target/$TARGET/release/test-runner.exe" \ + "${TEST_FRAMEWORK_ROOT}/target/$TARGET/release/connection-checker.exe" \ + "${PACKAGE_DIR}/"*.exe \ + "::" + mdir -i "${TEST_RUNNER_IMAGE_PATH}" + ;; + +esac + +echo "************************************************************" +echo "* Success! Built test runner image: $TARGET" +echo "************************************************************" diff --git a/test/scripts/build/test-manager.sh b/test/scripts/build/test-manager.sh new file mode 100755 index 0000000000..517bdf310f --- /dev/null +++ b/test/scripts/build/test-manager.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -eu + +# Build `test-manager` +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_FRAMEWORK_ROOT="$SCRIPT_DIR/../.." +REPO_DIR="$TEST_FRAMEWORK_ROOT/.." + +# shellcheck disable=SC1091 +source "$REPO_DIR/scripts/utils/log" + +build_linux() { + cd "$TEST_FRAMEWORK_ROOT" + # Build the test manager + cargo build -p test-manager --release +} + +case ${1-:""} in + linux) + build_linux + shift + ;; + *) + log_error "Invalid platform. Specify a valid platform as first argument" + exit 1 +esac diff --git a/test/scripts/build/test-runner.sh b/test/scripts/build/test-runner.sh new file mode 100755 index 0000000000..3e01353ac6 --- /dev/null +++ b/test/scripts/build/test-runner.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -eu + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +TEST_FRAMEWORK_ROOT="$SCRIPT_DIR/../.." +REPO_DIR="$TEST_FRAMEWORK_ROOT/.." + +cd "$SCRIPT_DIR" + +# shellcheck disable=SC1091 +source "$REPO_DIR/scripts/utils/log" + +case ${1-:""} in + linux) + TARGET=x86_64-unknown-linux-gnu + shift + ;; + windows) + TARGET=x86_64-pc-windows-gnu + shift + ;; + macos) + # TODO: x86 + TARGET=aarch64-apple-darwin + shift + ;; + *) + log_error "Invalid platform. Specify a valid platform as first argument" + exit 1 +esac + +cargo build \ + --bin test-runner \ + --bin connection-checker \ + --release --target "${TARGET}" + +# Only build runner image for Windows +if [[ $TARGET == x86_64-pc-windows-gnu ]]; then + TARGET="$TARGET" ./runner-image.sh +fi |
