Skip to content

Add missing flags to Linux and Android #683

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

Merged
merged 2 commits into from
Jul 20, 2017
Merged

Conversation

ndusart
Copy link
Contributor

@ndusart ndusart commented Jul 20, 2017

No description provided.

@alexcrichton
Copy link
Member

Looks like there's CI failures?

@ndusart
Copy link
Contributor Author

ndusart commented Jul 20, 2017

@alexcrichton CI is passing now

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 20, 2017

📌 Commit a7ba0e8 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jul 20, 2017

⌛ Testing commit a7ba0e8 with merge 572dc6d...

bors added a commit that referenced this pull request Jul 20, 2017
Add missing flags to Linux and Android
@bors
Copy link
Contributor

bors commented Jul 20, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 572dc6d to master...

@bors bors merged commit a7ba0e8 into rust-lang:master Jul 20, 2017
bors bot added a commit to nix-rust/nix that referenced this pull request Jul 24, 2017
693: fix some tests for Android r=asomers

I tested the crate on an Android emulator and quite all the tests passed. Only 6 were failing.

> failures:
> 
> ---- sys::test_pthread::test_pthread_self stdout ----
> 	thread 'sys::test_pthread::test_pthread_self' panicked at 'assertion failed: tid > 0', test/sys/test_pthread.rs:6
> note: Run with `RUST_BACKTRACE=1` for a backtrace.
> 
> ---- sys::test_socket::test_getsockname stdout ----
> 	thread 'sys::test_socket::test_getsockname' panicked at 'bind failed: Sys(EACCES)', /checkout/src/libcore/result.rs:859
> 
> ---- sys::test_socket::test_unixdomain stdout ----
> 	thread 'sys::test_socket::test_unixdomain' panicked at 'bind failed: Sys(EACCES)', /checkout/src/libcore/result.rs:859
> 
> ---- sys::test_termios::test_local_flags stdout ----
> 	thread 'sys::test_termios::test_local_flags' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:329
> 
> ---- test_net::test_if_nametoindex stdout ----
> 	thread 'test_net::test_if_nametoindex' panicked at 'assertion failed: if_nametoindex(&LOOPBACK[..]).is_ok()', test/test_net.rs:11
> 
> ---- test_unistd::test_mkstemp stdout ----
> 	thread 'test_unistd::test_mkstemp' panicked at 'mkstemp failed: ENOENT: No such file or directory', test/test_unistd.rs:73

This PR fixes 3 of those:
 - `test_pthread_self`: pthread_t is unsigned, so it can be negative (and it is often the case)
 - `test_if_nametoindex`: constant `LOOPBACK` is the same than on Linux
 - `test_mkstemp`: directory `/tmp` does not exist in Android

Two are still failing (`test_unixdomain` and `test_getsockname`) because we need some special permissions on Android for playing with sockets. On a rooted physical device, they passed. So, if tests for Android are integrated in CI, we should try to embed the tests to run in an APK with requested permissions or find a way to give the permission to a native program.

`test_local_flags` is still failing also because `O_LARGEFILE` is hardcoded and is not the right value in Android. Then `fcntl::OFlag::from_bits(flags).unwrap()` fails because this flag is then not recognised.
I made a PR in `libc` so that we can rely on libc definitions for all `O_*` flags. (rust-lang/libc#683)

Do you prefer to wait for this one to be fixed for this PR to merged as well ?
@ndusart ndusart deleted the af_const branch July 24, 2017 08:26
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.

3 participants