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

Get nix passing mips tests #548

Merged
merged 4 commits into from
Mar 5, 2017
Merged

Get nix passing mips tests #548

merged 4 commits into from
Mar 5, 2017

Conversation

berkowski
Copy link
Contributor

Addresses #533

Working on getting nix to pass mips-unknown-linux-gnu and mipsel-unknown-linux-gnu

Includes a few commits to disable non-related failing tests. These will be reverted before merge.

Still fails two tests related to mq_setattr:

---- test_mq::test_mq_set_nonblocking stdout ----
	thread 'test_mq::test_mq_set_nonblocking' panicked at 'called `Result::unwrap()` on an `Err` value: Sys(EPERM)', /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-rustbuild-linux/build/src/libcore/result.rs:837

---- test_mq::test_mq_setattr stdout ----
	thread 'test_mq::test_mq_setattr' panicked at 'called `Result::unwrap()` on an `Err` value: Sys(EPERM)', /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-rustbuild-linux/build/src/libcore/result.rs:837

These will PASS if you override the value of libc::O_NONBLOCK to use the x86_64 value of 2048:

diff --git a/src/mqueue.rs b/src/mqueue.rs
index 2c12750..4024698 100644
--- a/src/mqueue.rs
+++ b/src/mqueue.rs
@@ -133,7 +133,7 @@ pub fn mq_setattr(mqd: mqd_t, newattr: &MqAttr) -> Result<MqAttr> {
 /// Returns the old attributes
 pub fn mq_set_nonblock(mqd: mqd_t) -> Result<(MqAttr)> {
     let oldattr = try!(mq_getattr(mqd));
-    let newattr = MqAttr::new(O_NONBLOCK.bits() as c_long,
+    let newattr = MqAttr::new(2048 as c_long,
                               oldattr.mq_attr.mq_maxmsg,
                               oldattr.mq_attr.mq_msgsize,
                               oldattr.mq_attr.mq_curmsgs);
diff --git a/test/test_mq.rs b/test/test_mq.rs
index fd050d4..b911e1e 100644
--- a/test/test_mq.rs
+++ b/test/test_mq.rs
@@ -83,7 +83,7 @@ fn test_mq_setattr() {
     // O_NONBLOCK can be set (see tests below)
     assert!(new_attr_get.unwrap() != new_attr);
 
-    let new_attr_non_blocking =  MqAttr::new(O_NONBLOCK.bits() as c_long, 10, MSG_SIZE, 0);
+    let new_attr_non_blocking =  MqAttr::new(2048 as c_long, 10, MSG_SIZE, 0);
     mq_setattr(mqd, &new_attr_non_blocking).unwrap();
     let new_attr_get = mq_getattr(mqd);
 
@@ -101,7 +101,7 @@ fn test_mq_set_nonblocking() {
     let mqd = mq_open(mq_name, O_CREAT | O_WRONLY, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH, Some(&initial_attr)).unwrap();
     mq_set_nonblock(mqd).unwrap();
     let new_attr = mq_getattr(mqd);
-    assert!(new_attr.unwrap().flags() == O_NONBLOCK.bits() as c_long);
+    assert!(new_attr.unwrap().flags() == 2048 as c_long);
     mq_remove_nonblock(mqd).unwrap();
     let new_attr = mq_getattr(mqd);
     assert!(new_attr.unwrap().flags() == 0);`

I don't understand this at the moment. Perhaps it's a bug with trust/cross? The value in libc matches current linux headers and their own checks.

@posborne
Copy link
Member

posborne commented Mar 3, 2017

@alexcrichton @japaric Any ideas on this one?

@alexcrichton
Copy link
Contributor

Unfortunately no, I've never used these APIs :(

@berkowski
Copy link
Contributor Author

I'm able to replicate these errors and behaviour using C and qemu-mips 2.6.1 and so I don't think there's an issue specific to trust or cross. Whatever is going on here seems outside of rust's scope and getting pretty far beyond my own knowledge.

I can clean up this pull as is -- it does fix a lot of other compile issues.

@posborne
Copy link
Member

posborne commented Mar 5, 2017

I can clean up this pull as is -- it does fix a lot of other compile issues.

Yes, let's move forward with that. The issues may be specific to the kernel/libc being used in the MIPS QEMU VM.

@berkowski
Copy link
Contributor Author

I removed the two commits modifying other test and travis behaviour. If you want the whole thing squashed let me know.

@posborne
Copy link
Member

posborne commented Mar 5, 2017

If you want the whole thing squashed let me know.

This looks fine to me; no need.

@posborne posborne merged commit d82b535 into nix-rust:new-ci/master Mar 5, 2017
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