| 41 | |
| 42 | |
| 43 | def run_cargo_tests( |
| 44 | variants: List[Variant], |
| 45 | features: Mapping[str, Sequence[str]] | None = None, |
| 46 | target: str | None = None, |
| 47 | ): |
| 48 | args = [cargo_cmd_name()] |
| 49 | |
| 50 | args.extend(["build", "--tests", "--locked", "--workspace", "--exclude", DESKTOP_FUZZ_PACKAGE_NAME]) |
| 51 | |
| 52 | if target: |
| 53 | args.extend(["--target", target]) |
| 54 | |
| 55 | if Variant.FULL not in variants: |
| 56 | args.extend(["--exclude", DESKTOP_PACKAGE_NAME]) |
| 57 | |
| 58 | if features: |
| 59 | args.extend( |
| 60 | [ |
| 61 | "--features", |
| 62 | ",".join(set(itertools.chain.from_iterable(features.values()))), |
| 63 | ] |
| 64 | ) |
| 65 | |
| 66 | run_cmd( |
| 67 | args, |
| 68 | env={ |
| 69 | **os.environ, |
| 70 | **rust_env(release=False), |
| 71 | }, |
| 72 | ) |
| 73 | |
| 74 | args = [cargo_cmd_name()] |
| 75 | |
| 76 | # Run all lib, bin, and integration tests. Required to exclude running doc tests. |
| 77 | args.extend( |
| 78 | ["test", "--locked", "--workspace", "--lib", "--bins", "--test", "*", "--exclude", DESKTOP_FUZZ_PACKAGE_NAME] |
| 79 | ) |
| 80 | |
| 81 | if target: |
| 82 | args.extend(["--target", target]) |
| 83 | |
| 84 | # disable desktop tests for now |
| 85 | if isLinux(): |
| 86 | args.extend(["--exclude", DESKTOP_PACKAGE_NAME]) |
| 87 | |
| 88 | if features: |
| 89 | args.extend( |
| 90 | [ |
| 91 | "--features", |
| 92 | ",".join(set(itertools.chain.from_iterable(features.values()))), |
| 93 | ] |
| 94 | ) |
| 95 | |
| 96 | run_cmd( |
| 97 | args, |
| 98 | env={ |
| 99 | **os.environ, |
| 100 | **rust_env(release=False), |