Change filename in thread_manager::test-thread_context
This commit is contained in:
parent
e170256c9b
commit
cfcdce750b
@ -206,20 +206,21 @@ mod test {
|
|||||||
#[ignore = "Pas encore terminé, contient des bugs"]
|
#[ignore = "Pas encore terminé, contient des bugs"]
|
||||||
fn test_thread_context() {
|
fn test_thread_context() {
|
||||||
let mut machine = Machine::init_machine();
|
let mut machine = Machine::init_machine();
|
||||||
loader::load("../test.o", &mut machine, 0).expect("IO Error");
|
loader::load("./test/riscv_instructions/simple_arithmetics/unsigned_addition", &mut machine, 0).expect("IO Error");
|
||||||
|
let start_pc = 0x4000;
|
||||||
let system = &mut System::default();
|
let system = &mut System::default();
|
||||||
let thread1 = Thread::new("th1");
|
let thread1 = Thread::new("th1");
|
||||||
let thread1 = Rc::new(RefCell::new(thread1));
|
let thread1 = Rc::new(RefCell::new(thread1));
|
||||||
system.get_thread_manager().get_g_alive().push(Rc::clone(&thread1));
|
system.get_thread_manager().get_g_alive().push(Rc::clone(&thread1));
|
||||||
let owner = Process { num_thread: 0 };
|
let owner = Process { num_thread: 0 };
|
||||||
system.get_thread_manager().start_thread(Rc::clone(&thread1), owner, 0x94 as u64, 0);
|
system.get_thread_manager().start_thread(Rc::clone(&thread1), owner, start_pc, 0);
|
||||||
debug_assert_eq!(thread1.borrow_mut().thread_context.pc, 0x94 as u64);
|
debug_assert_eq!(thread1.borrow_mut().thread_context.pc, start_pc);
|
||||||
let to_run = system.get_thread_manager().find_next_to_run().unwrap();
|
let to_run = system.get_thread_manager().find_next_to_run().unwrap();
|
||||||
debug_assert_eq!(to_run, Rc::clone(&thread1));
|
debug_assert_eq!(to_run, Rc::clone(&thread1));
|
||||||
debug_assert!(system.get_thread_manager().get_g_alive().contains(&Rc::clone(&thread1)));
|
debug_assert!(system.get_thread_manager().get_g_alive().contains(&Rc::clone(&thread1)));
|
||||||
system.get_thread_manager().switch_to(&mut machine, Rc::clone(&to_run));
|
system.get_thread_manager().switch_to(&mut machine, Rc::clone(&to_run));
|
||||||
debug_assert_eq!(system.get_thread_manager().g_current_thread, Option::Some(Rc::clone(&thread1)));
|
debug_assert_eq!(system.get_thread_manager().g_current_thread, Option::Some(Rc::clone(&thread1)));
|
||||||
debug_assert_eq!(machine.pc, 0x94);
|
debug_assert_eq!(machine.pc, start_pc);
|
||||||
machine.run();
|
machine.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user