Re: The Case for Rust (in the base system)

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Sun, 21 Jan 2024 16:40:52 UTC
On 21 Jan 2024, at 17:26, Poul-Henning Kamp wrote:
> Alan Somers writes:
>> * "<something> can't be implemented unless written in rust"
>>
>> I don't think anybody has claimed this yet.  But I _have_ made a similar claim,
>> that some things can't be written in C.  I'll elaborate on the project that
>> started this thread: the fusefs test suite.  When I designed the fusefs test
>> suite, I based it around the priniciple of Mocking. [...]
>
> Why would such a test-tool live in src rather than ports ?
>
It’s entirely reasonable for the test code to live in the same repository as the code it tests.

Doing otherwise would make life harder (e.g. how do you establish if a test failure is expected with a given src version) for no good reason.

I suspect we may be working with different views of what a test tool does here. You may be thinking more along the lines of something like iperf, while I’m thinking more of test like this one: https://cgit.freebsd.org/src/commit?id=4c84c69ba308b7758d07dc8845b13922ed667e02

I’ll take the opportunity to point out that there’s precedent for using non-base languages in tests (e.g. Python, for the test linked above), so using Rust code for in-tree tests looks like a reasonable way to get our toes wet, without immediately painting ourselves into a corner if it doesn’t work out.

—
Kristof