Skip to content

Comments

[RFC] Add a minimal baremetal testsuite to Phobos#6641

Closed
wilzbach wants to merge 1 commit intodlang:masterfrom
wilzbach:baremetal
Closed

[RFC] Add a minimal baremetal testsuite to Phobos#6641
wilzbach wants to merge 1 commit intodlang:masterfrom
wilzbach:baremetal

Conversation

@wilzbach
Copy link
Contributor

@wilzbach wilzbach commented Jul 21, 2018

Similarly to #6640, this will allow to add tests to Phobos for functionality that doesn't depend on libc.
It currently contains a minimal Linux x86 runtime.

Future

We probably want to add a special UDA (e.g. @test-baremetal and @test-betterc) to Phobos and thus extract such tests automatically (instead of keeping them separate).

Another possible route is to combine this with the testsuite runner of DMD or at least have support for minimal things like TEST_OUTPUT.

CC @ZombineDev

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + phobos#6641"

@wilzbach
Copy link
Contributor Author

We probably want to add a special UDA

dlang/tools#357 (also supports just strings, e.g. @("betterc"))

@wilzbach
Copy link
Contributor Author

wilzbach commented Jul 29, 2018

Posted about how the UDA (e.g. @betterCTest and @baremetalTest) could be named on the NG: https://forum.dlang.org/post/irovmywdhafdromajrwc@forum.dlang.org

@JinShil
Copy link
Contributor

JinShil commented Jul 31, 2018

I don't care for the term baremetal; I suggest freestanding instead. But, I also notice that this seems to still link in the C standard library.

Also, -betterC does not imply baremetal or freestanding; it just doen't link in the D runtime. To demonstrate D operating in a baremetal/freestanding environment, it should have a D runtime ported to that environment, so I suggest using a minimal runtime instead.

Ultimately, though, D should have a FreeStanding version identifier and the official D runtime code should have implementations for that environment that are expanded over time to include more and more features of D. There's no reason why even a GC couldn't be used in a baremetal/freestanding environment if the system has the resources and the use case allows it. I think we should strive for that instead.

Note also the freestanding-on-linux is not the same as freestanding-on-AMD64, freestanding-on-x86, freestanding-on-AArch64, etc. We'll need the D runtime to have implementations of all those scenarios, and preferably a CI that can actually exercise them (maybe in virtual environment like VirtualBox, QEMU, etc. or if possible on physical hardware).

@andralex
Copy link
Member

What is the use case?

@wilzbach
Copy link
Contributor Author

To test that some functions in Phobos don't depend on druntime at all which is important for people like @JinShil who would love to use parts of Phobos in their baremetal development.
Anyhow, this isn't very important to me and we managed to get @betterC, so I'm closing this for now ...

@wilzbach wilzbach closed this Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants