Clean up the disabled `tests/mtouch` suite: delete legacy tests, port the useful ones (mainly registrar validation)
- Dominant language
- C#
- Stars
- 2.9k
- Forks
- 576
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
## Summary
The `tests/mtouch` test suite has not run since the migration from classic Xamarin to .NET. It's a **.NET Framework 4.8** class library that references the classic `tools/mtouch/mtouch.csproj` (mtouch.exe) and drives it against classic `MonoTouch.*.sdk` / `lib/mono/Xamarin.iOS` layouts. It is **not** part of the build — `tests/Makefile` `SUBDIRS` only includes `test-libraries` and `dotnet` — so it hasn't been built or run in CI for a long time.
Many testcases no longer apply, but some still test useful behavior. In particular, the bulk of `RegistrarTest.cs` exercises registrar validation that the **current** static registrar still emits (verified: `tools/common/StaticRegistrar.cs` still produces MT4102, MT4111, MT4138, MT4145, MT4161, MT4169, MT4174, MT4176, …), and none of those codes are covered by any running suite today. The `tests/assembly-preparer` harness already compiles a C# snippet and runs the registrar via `AssemblyPreparer`, so these tests port over cleanly (only the assertion changes, from scraping mtouch output to asserting `Prepare` fails with the expected error).
## Goal
1. **Port the registrar-validation tests** (~39 of ~56 methods in `RegistrarTest.cs`) — mostly to `tests/assembly-preparer` as small "snippet + expected MT4xxx" unit tests, a few end-to-end ones to `tests/dotnet/UnitTests`.
2. **Port `ExportedSymbols` / `ExportedSymbols_VerifyLinkedAwayField`** from `MTouch.cs` (linker symbol preservation) to assembly-preparer / a dotnet build test.
3. **Port the pure-logic tinies:** `ErrorTest.cs` (`ProductException` formatting) and `StringUtilsTest.cs`, plus optionally `MiscTests.NoBannedApi` (banned **native** C symbols — complements the managed-only check in `cecil-tests`) and `MiscTests.PublicSymbols`.
4. **Evaluate then port-or-drop:** `ManyBigPInvokes`, `ExceptionMarshaling`, and any MT0xxx build-error messages still emitted by current MSBuild tasks.
5. **Delete `tests/mtouch/` entirely** once the above are ported.
Almost everything else in `MTouch.cs` and the smaller files is legacy (32-bit/fat/bitcode/FastDev/simlauncher/watchOS/mtouch-CLI/mlaunch-migrated device control/classic BCL profiles) or already covered by `tests/dotnet/UnitTests`, and should be deleted.
## Full per-testcase report
A detailed file-by-file, testcase-by-testcase classification (delete-legacy / delete-obsolete-mechanism / already-covered / port-candidate, with suggested port target) is in this gist:
https://gist.github.com/rolfbjarne/d099f5d24b3e701b5727528dcde6890c
## Rough scope
| File | Total | Port | Delete / already-covered |
|-------------------------------------------------------------|-------|---------------|--------------------------|
| `RegistrarTest.cs` | ~56 | ~39 | ~17 |
| `MTouch.cs` | ~127 | ~4–8 (verify) | ~120 |
| `MiscTests.cs` | 4 | 1–2 | 2–3 |
| `ErrorTest.cs` | 5 | 5 | 0 |
| `StringUtilsTest.cs` | 2 | 2 | 0 |
| `SdkTest`/`Inliner`/`Linker`/`Localization`/`Timing` | ~15 | 0 | ~15 |
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.