Skip to content

Commit fb517fa

Browse files
The greatest hack of all time
1 parent 478be86 commit fb517fa

File tree

5 files changed

+40
-18
lines changed

5 files changed

+40
-18
lines changed

.github/workflows/desktop-e2e.yml

-4
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,8 @@ jobs:
135135
steps:
136136
- name: Checkout repository
137137
uses: actions/checkout@v4
138-
# - name: Setup Docker
139-
# uses: crazy-max/ghaction-setup-docker@v3
140138
- name: Build test framework
141139
working-directory: test
142-
# env:
143-
# CONTAINER_RUNNER: docker
144140
run: ./scripts/container-run.sh ./scripts/build.sh
145141
- uses: actions/upload-artifact@v3
146142
with:

test/scripts/ci-runtests.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ echo "**********************************"
4848
echo "* Building test manager"
4949
echo "**********************************"
5050

51-
cargo build -p test-manager
51+
# TMP: Assume test-manager has been built already!
52+
# If we are testing Linux, spood that we compile test-manager and test-runner. Actually use-precompiled artifacts.
53+
if is_linux TEST_OS ; then
54+
cargo build -p test-manager
55+
fi
5256

5357
echo "**********************************"
5458
echo "* Running tests"

test/scripts/test-utils.sh

+17-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ LATEST_STABLE_RELEASE=$(jq -r '[.[] | select(.prerelease==false)] | .[0].tag_nam
2424
function get_current_version {
2525
local app_dir
2626
app_dir="$(get_test_utls_dir)/../.."
27-
cargo run -q --manifest-path="$app_dir/Cargo.toml" --bin mullvad-version
27+
# HACK:
28+
echo "2024.4-dev-7781ac"
29+
# cargo run -q --manifest-path="$app_dir/Cargo.toml" --bin mullvad-version
2830
}
2931

3032
CURRENT_VERSION=$(get_current_version)
@@ -150,6 +152,13 @@ function download_app_package {
150152
fi
151153
}
152154

155+
function is_linux {
156+
case $1 in
157+
debian*|ubuntu*|fedora*) true ;;
158+
*) false ;;
159+
esac
160+
}
161+
153162
function get_e2e_filename {
154163
local version=$1
155164
local os=$2
@@ -255,7 +264,11 @@ function run_tests_for_os {
255264
local test_dir
256265
test_dir=$(get_test_utls_dir)/..
257266
pushd "$test_dir"
258-
if ! RUST_LOG_STYLE=always cargo run --bin test-manager \
267+
TEST_MANAGER_BIN="cargo run --bin test-manager"
268+
if is_linux "$vm" ; then
269+
TEST_MANAGER_BIN="./dist/test-manager"
270+
fi
271+
if ! RUST_LOG_STYLE=always "$TEST_MANAGER_BIN" \
259272
run-tests \
260273
--account "${ACCOUNT_TOKEN:?Error: ACCOUNT_TOKEN not set}" \
261274
--app-package "${APP_PACKAGE:?Error: APP_PACKAGE not set}" \
@@ -278,7 +291,7 @@ function build_current_version {
278291
app_dir="$(get_test_utls_dir)/../.."
279292
local app_filename
280293
# TODO: TEST_OS must be set to local OS manually, should be set automatically
281-
app_filename=$(get_app_filename "$CURRENT_VERSION" "${TEST_OS:?Error: TEST_OS not set}")
294+
app_filename=$(get_app_filename "$CURRENT_VERSION" "${TEST_OS:?Error: TEST_OS not set}")
282295
local package_dir
283296
package_dir=$(get_package_dir)
284297
local app_package="$package_dir"/"$app_filename"
@@ -309,4 +322,4 @@ function build_current_version {
309322
else
310323
echo "GUI e2e executable for current version already exists at $gui_test_bin, skipping build"
311324
fi
312-
}
325+
}

test/test-manager/src/config.rs

+16-8
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,22 @@ impl VmConfig {
200200
Some((self.ssh_user.as_ref()?, self.ssh_password.as_ref()?))
201201
}
202202

203-
pub fn get_runner_dir(&self) -> PathBuf {
204-
let target_dir = self.get_target_dir();
205-
let subdir = match self.architecture {
206-
None | Some(Architecture::X64) => self.get_x64_runner_subdir(),
207-
Some(Architecture::Aarch64) => self.get_aarch64_runner_subdir(),
208-
};
209-
210-
target_dir.join(subdir)
203+
// HACK: `use_precompiled`.
204+
pub fn get_runner_dir(&self, use_precompiled: bool) -> PathBuf {
205+
if use_precompiled {
206+
Path::new(env!("CARGO_MANIFEST_DIR"))
207+
.join("..")
208+
.join("dist")
209+
.to_path_buf()
210+
} else {
211+
let target_dir = self.get_target_dir();
212+
let subdir = match self.architecture {
213+
None | Some(Architecture::X64) => self.get_x64_runner_subdir(),
214+
Some(Architecture::Aarch64) => self.get_aarch64_runner_subdir(),
215+
};
216+
217+
target_dir.join(subdir)
218+
}
211219
}
212220

213221
fn get_x64_runner_subdir(&self) -> &Path {

test/test-manager/src/vm/provision.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ pub async fn provision(
2525
provision_ssh(
2626
instance,
2727
config.os_type,
28-
&config.get_runner_dir(),
28+
// HACK: remove matches!
29+
&config.get_runner_dir(matches!(config.os_type, OsType::Linux)),
2930
app_manifest,
3031
user,
3132
password,

0 commit comments

Comments
 (0)