Skip to content
Snippets Groups Projects
Verified Commit 2e27cf52 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Work on adding cargo test capability

parent 79f26574
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ use crate::{
platform::{self, types::*, Pal, Sys},
};
use self::constants::*;
pub use self::constants::*;
pub mod constants;
mod strftime;
......
......@@ -26,6 +26,9 @@ mod sys;
#[path = "redox/mod.rs"]
mod sys;
#[cfg(test)]
mod test;
mod pte;
pub use self::rlb::{Line, RawLineBuffer};
......
use crate::platform::{PalEpoll, Sys};
use crate::platform::{Pal, Sys};
// Stub for call used in exit
#[no_mangle]
pub extern "C" fn pthread_terminate() {}
mod epoll;
#[test]
fn access() {
use crate::header::{
errno,
unistd,
};
//TODO: create test files
assert_eq!(Sys::access(c_str!("not a file!"), unistd::F_OK), !0);
assert_eq!(Sys::access(c_str!("README.md"), unistd::R_OK), 0);
assert_eq!(Sys::access(c_str!("README.md"), unistd::W_OK), 0);
assert_eq!(Sys::access(c_str!("README.md"), unistd::X_OK), !0);
}
#[test]
fn brk() {
use core::ptr;
let current = Sys::brk(ptr::null_mut());
assert_ne!(current, ptr::null_mut());
let request = unsafe { current.add(4096) };
let next = Sys::brk(request);
assert_eq!(next, request);
}
#[test]
fn chdir() {
//TODO: create test files
assert_eq!(Sys::chdir(c_str!("src")), 0);
}
//TODO: chmod
//TODO: chown
#[test]
fn clock_gettime() {
use crate::header::{
time
};
{
let mut timespec = time::timespec {
tv_sec: -1,
tv_nsec: -1,
};
assert_eq!(Sys::clock_gettime(time::CLOCK_REALTIME, &mut timespec), 0);
assert_ne!(timespec.tv_sec, -1);
assert_ne!(timespec.tv_nsec, -1);
}
{
let mut timespec = time::timespec {
tv_sec: -1,
tv_nsec: -1,
};
assert_eq!(Sys::clock_gettime(time::CLOCK_MONOTONIC, &mut timespec), 0);
assert_ne!(timespec.tv_sec, -1);
assert_ne!(timespec.tv_nsec, -1);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment