Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port rand to CloudABI. #224

Merged
merged 1 commit into from
Jan 11, 2018
Merged

Port rand to CloudABI. #224

merged 1 commit into from
Jan 11, 2018

Conversation

EdSchouten
Copy link
Contributor

CloudABI has a special system call, random_get(), that can be used to
obtain random data from the environment (the kernel, emulator, etc). We
can invoke this system call by making use of the cloudabi crate.

@EdSchouten
Copy link
Contributor Author

I suspec that the test failure is not caused by this change specifically. Probably something wrong with the build environment?

@dhardy
Copy link
Member

dhardy commented Jan 7, 2018

Cargo not found. I've seen that before; it seems Travis just fails sometimes. Restarted that build.

I don't know anything about CloudABI. Is there some way we can test code for this platform?

@EdSchouten
Copy link
Contributor Author

Hey! Thanks for responding so quickly!

CloudABI is a strongly sandboxed UNIX-like runtime environment. Right now there is native support for running these executables on FreeBSD, experimental native support for Linux and NetBSD, and a userspace emulator that works on virtually any operating system out there (e.g., macOS).

Right now I'm still working on getting support for CloudABI integrated into Rust properly. I stumbled upon this build failure, because libstd (as built by ./x.py test) has a dependency on this crate. In other words: it's a big of a chicken-and-egg problem. I can't offer any ways of doing automated testing, as there is no version of Rust that supports CloudABI out of the box yet. Without this change, there is no way to build/test Rust for CloudABI.

In the meantime I am building a Docker container image that can be used to do automated tests for the main Rust codebase. I suspect that we may be able to reuse something like this to also run tests for rand.

@dhardy
Copy link
Member

dhardy commented Jan 8, 2018

Well, this certainly sounds like an interesting project!

I believe libstd has an internal copy of OsRng and doesn't depend on this rand. (Or if you are using rand, let me know which version; 0.3 is the old stable, 0.4 the new stable, and master is for the upcoming 0.5 so won't be released so soon.)

@EdSchouten
Copy link
Contributor Author

That's right. It looks like it's not that libstd depends on rand to build. It's just that libstd, liballoc and a couple of other libraries have rand as a development dependency, likely for automated tests and the likes. From Cargo.toml:

[dev-dependencies]
rand = "0.3"

I guess it makes sense to merge this change both to master and the 0.4 branch, right? Once this change makes it into a release, I can send out a pull request to rust/ to update from the version it uses right now (0.3.19) to 0.4.x.

@dhardy
Copy link
Member

dhardy commented Jan 8, 2018

Yes, that makes sense. This is going to conflict with #225; I can sort that out though.

@dhardy
Copy link
Member

dhardy commented Jan 11, 2018

#225 is now merged, could you please update this with compatible error-handling?

CloudABI has a special system call, random_get(), that can be used to
obtain random data from the environment (the kernel, emulator, etc). We
can invoke this system call by making use of the cloudabi crate.
@EdSchouten
Copy link
Contributor Author

Done! \o/

@dhardy dhardy merged commit c794c49 into rust-random:master Jan 11, 2018
pitdicker pushed a commit that referenced this pull request Apr 4, 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.

2 participants