Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

Ci run all dart tests (#16328)

RustDeskb1761ee676b4
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ecc9ee782..2b375b03d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -234,7 +234,7 @@ jobs:
CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}"
;;
*)
- CARGO_TEST_OPTIONS="--workspace --no-fail-fast -- --skip test_get_cursor_pos --skip test_get_key_state"
+ CARGO_TEST_OPTIONS="--workspace --no-fail-fast"
;;
esac;
diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml
index c55e3f10b..f9dfee5c6 100644
--- a/.github/workflows/flutter-build.yml
+++ b/.github/workflows/flutter-build.yml
@@ -366,6 +366,17 @@ jobs:
Write-Host "Ingore the printer driver error."
}
+ - name: Run the Rust tests
+ # x86_64 only: the tests are the same code on arm64, and that runner is the slow one.
+ if: ${{ !inputs.upload-artifact && matrix.job.arch == 'x86_64' }}
+ shell: bash
+ run: |
+ # The build's own features, so the tests see the code that ships.
+ FEATURES=$(python3 ./build.py --portable --flutter --skip-portable-pack --hwcodec ${{ matrix.job.build-args }} --print-features)
+ cargo test --locked --release --lib --features "$FEATURES"
+ # Its Windows tests run nowhere else.
+ cargo test --locked --release -p clipboard
+
- name: find Runner.res
# Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res
# Runner.rc does not contain actual version, but Runner.res does
@@ -965,10 +976,10 @@ jobs:
name: bridge-artifact
path: ./
- - name: Test cursor sizing
+ - name: Run the Dart tests
if: ${{ !inputs.upload-artifact && matrix.job.arch == 'aarch64' }}
working-directory: flutter
- run: flutter test --timeout 60s test/cursor_size_test.dart test/cursor_replay_test.dart test/cursor_default_test.dart
+ run: flutter test --timeout 60s
- name: Setup vcpkg with Github Actions binary cache
uses: lukka/run-vcpkg@b1a0dd252f06b9e25b3c022a9a03bd7a427fb6a2 # v11
@@ -1022,6 +1033,16 @@ jobs:
cargo test --locked --release --lib verified_dmg_tests --features "flutter,hwcodec,unix-file-copy-paste${{ matrix.job.extra-cargo-features }}"
cargo test --locked --release --lib update_metadata::tests --features "flutter,hwcodec,unix-file-copy-paste${{ matrix.job.extra-cargo-features }}"
+ - name: Run the Rust tests
+ if: ${{ !inputs.upload-artifact && matrix.job.arch == 'aarch64' }}
+ run: |
+ # The build's own features, so the tests see the code that ships. MACOSX_DEPLOYMENT_TARGET
+ # comes from the build step's export.
+ FEATURES=$(./build.py --flutter --hwcodec --unix-file-copy-paste ${{ matrix.job.extra-build-args }} --print-features)
+ cargo test --locked --release --lib --features "$FEATURES"
+ # Opt-in, and its macOS tests run nowhere else.
+ cargo test --locked --release -p clipboard --features unix-file-copy-paste
+
- name: create unsigned dmg
if: env.UPLOAD_ARTIFACT == 'true'
run: |
@@ -2354,6 +2375,11 @@ jobs:
cargo test --locked -p scrap --features drm crtc_refresh_tests
run_drm_tests "scrap plane_rotation_tests" \
cargo test --locked -p scrap --features drm plane_rotation_tests
+ run_drm_tests "scrap drmtap_dl::tests" \
+ cargo test --locked -p scrap --features drm drmtap_dl::tests
+ # Opt-in like drm, and this container already builds with it.
+ run_drm_tests "clipboard unix-file-copy-paste" \
+ cargo test --locked -p clipboard --features unix-file-copy-paste
cargo build --locked --lib --features "$FEATURES" --release
rm -rf target/release/deps target/release/build
rm -rf ~/.cargo
diff --git a/AGENTS.md b/AGENTS.md
index eb8d01b7a..f56876fbe 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -186,6 +186,10 @@ A refactor added to cover a corner case rarely converges. Each new counter, time
* Do not add test infrastructure (browser runners, golden/screenshot harnesses, new mock layers, test-only hooks in production code) for a bug fix unless the maintainer asks.
* If the test diff is more than twice the fix, cut it back to the tests that pin the reported behavior. A state that needs long setup to reach is usually too rare to fix.
* When the number of tests needed to describe the behavior keeps growing, the implementation is too complex: simplify it instead of adding tests.
+* Dart tests go in `flutter/test/*_test.dart`, nowhere else: CI runs `flutter test` over that directory and nothing outside it. It runs on the VM, so a `@TestOn('browser')` suite runs in no CI job.
+* Rust unit tests go in a `#[cfg(test)]` module beside the code. CI runs `cargo test --workspace` with the default features on x86_64 Linux, `cargo test --lib` on the root package with the release feature set on macOS and Windows plus `-p clipboard` there, and on Linux the `drm` test modules by name plus the `clipboard` package with `unix-file-copy-paste`. A platform-gated test in another workspace crate runs on that platform only if a job names the crate with `-p`. Gate a test module on a feature or `target_os` only when the code under test is gated; a pure helper that only a gated path calls gets `#[cfg(any(feature = "...", test))]`, so its tests run everywhere.
+* A test behind a feature that no CI build enables needs a `cargo test` line in `.github/workflows/flutter-build.yml` that names it. In the Linux drm job, wrap it in `run_drm_tests` so a filter that matches nothing fails instead of passing.
+* Web core tests are `flutter/web/js/src/*.test.ts`, run by jest in that repository's own CI.
## Reviewing a PR