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

fix tests about comparing Arc<dyn KernelObject> #173

Merged
merged 1 commit into from
Sep 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions zircon-object/src/task/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,14 @@ mod tests {
#[test]
fn create() {
let root_job = Job::root();
let job: Arc<dyn KernelObject> =
Job::create_child(&root_job).expect("failed to create job");
let job = Job::create_child(&root_job).expect("failed to create job");

assert!(Arc::ptr_eq(&root_job.get_child(job.id()).unwrap(), &job));
let child = root_job
.get_child(job.id())
.unwrap()
.downcast_arc()
.unwrap();
assert!(Arc::ptr_eq(&child, &job));
assert_eq!(job.related_koid(), root_job.id());
assert_eq!(root_job.related_koid(), 0);

Expand Down
4 changes: 2 additions & 2 deletions zircon-object/src/task/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,9 @@ mod tests {
let thread = Thread::create(&proc, "thread").expect("failed to create thread");
assert_eq!(thread.flags(), ThreadFlag::empty());

let thread: Arc<dyn KernelObject> = thread;
assert_eq!(thread.related_koid(), proc.id());
assert!(Arc::ptr_eq(&proc.get_child(thread.id()).unwrap(), &thread));
let child = proc.get_child(thread.id()).unwrap().downcast_arc().unwrap();
assert!(Arc::ptr_eq(&child, &thread));
}

#[async_std::test]
Expand Down