kernel: tests: remove excess prints

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-07-28 13:35:15 +08:00
parent 19222c34a9
commit 1512d2138e
3 changed files with 28 additions and 28 deletions

View file

@ -174,7 +174,7 @@ fn listen_thread(
chn: Sender<ThreadMessage>,
mut local_addr_sender: Option<Sender<SocketAddr>>,
new_pid_channel: Receiver<NewPidMessage>,
exit_channel: Receiver<ExitMessage>
exit_channel: Receiver<ExitMessage>,
) {
let should_exit = std::sync::Arc::new(core::sync::atomic::AtomicBool::new(false));
@ -209,7 +209,8 @@ fn listen_thread(
access_key,
))
.expect("couldn't request a new PID");
let NewPidMessage::NewPid(new_pid) = new_pid_channel.recv()
let NewPidMessage::NewPid(new_pid) = new_pid_channel
.recv()
.expect("couldn't receive message from main thread");
// println!("KERNEL({}): New client connected from {}", new_pid, _addr);
let conn_copy = conn.try_clone().expect("couldn't duplicate connection");
@ -257,15 +258,12 @@ fn listen_thread(
}
}
});
spawn(move || loop {
match exit_channel.recv() {
Ok(ExitMessage::Exit) => {
exit_sender.send(ClientMessage::Exit).unwrap();
}
Err(e) => {
println!("error receiving exit command: {}", e);
return;
}
spawn(move || match exit_channel.recv() {
Ok(ExitMessage::Exit) => {
exit_sender.send(ClientMessage::Exit).unwrap()
}
Err(std::sync::mpsc::RecvError) => {
println!("error receiving exit command")
}
});
@ -276,7 +274,7 @@ fn listen_thread(
exit_server(should_exit, clients);
return;
}
},
}
ClientMessage::Exit => {
exit_server(should_exit, clients);
return;
@ -353,7 +351,7 @@ pub fn idle() -> bool {
// This is because the "process" will be "terminated" (the network socket will be closed),
// and we won't be able to send the response after we're done.
if is_shutdown {
println!("KERNEL: Detected shutdown -- sending final \"Ok\" to the client");
// println!("KERNEL: Detected shutdown -- sending final \"Ok\" to the client");
let mut process = Process::current();
let mut response_vec = Vec::new();
response_vec.extend_from_slice(&thread_id.to_le_bytes());
@ -362,10 +360,13 @@ pub fn idle() -> bool {
}
process.send(&response_vec).unwrap_or_else(|_e| {
// If we're unable to send data to the process, assume it's dead and terminate it.
println!("Unable to send response to process: {:?} -- terminating", _e);
println!(
"Unable to send response to process: {:?} -- terminating",
_e
);
crate::syscall::handle(pid, thread_id, SysCall::TerminateProcess).ok();
});
println!("KERNEL: Done sending");
// println!("KERNEL: Done sending");
}
// Handle the syscall within the Xous kernel
@ -412,11 +413,11 @@ pub fn idle() -> bool {
}
}
println!("Exiting Xous because the listen thread channel has closed. Waiting for thread to finish...");
// println!("Exiting Xous because the listen thread channel has closed. Waiting for thread to finish...");
listen_thread_handle
.join()
.expect("error waiting for listen thread to return");
println!("Thank you for using Xous!");
// println!("Thank you for using Xous!");
false
}

View file

@ -25,7 +25,7 @@ fn start_kernel(server_spec: &str) -> JoinHandle<()> {
"XOUS_SERVER environment variable must be unset to run tests"
);
use rand::{Rng, thread_rng};
use rand::{thread_rng, Rng};
let mut pid1_key = [0u8; 16];
let mut rng = thread_rng();
for b in pid1_key.iter_mut() {
@ -97,10 +97,9 @@ fn shutdown() {
// Send a raw `Shutdown` message to terminate the kernel.
xous::create_process(xous::ProcessArgs::new(|| {
println!("Running in new process...");
let call_result = rsyscall(SysCall::Shutdown);
println!("Call result: {:?}", call_result);
})).unwrap();
rsyscall(SysCall::Shutdown).unwrap();
}))
.unwrap();
// Wait for the kernel to exit.
main_thread.join().expect("couldn't join main thread");

View file

@ -258,7 +258,7 @@ fn xous_connect_impl(
addr: SocketAddr,
key: &[u8; 16],
) -> core::result::Result<ServerConnection, ()> {
eprintln!("Opening connection to Xous server @ {} with key {:?}...", addr, key);
// eprintln!("Opening connection to Xous server @ {} with key {:?}...", addr, key);
assert_ne!(key, &[0u8; 16]);
match TcpStream::connect(addr) {
Ok(mut conn) => {
@ -374,7 +374,7 @@ fn _xous_syscall_result(
let response = Result::from_args(pkt);
println!(" Response: {:?}", response);
// println!(" Response: {:?}", response);
if Result::BlockedProcess == response {
// println!(" Waiting again");
continue;
@ -455,10 +455,10 @@ fn _xous_syscall_to(
call: &crate::SysCall,
xsc: &mut TcpStream,
) {
println!(
"Making Syscall: {:?}",
crate::SysCall::from_args(nr, a1, a2, a3, a4, a5, a6, a7).unwrap()
);
// println!(
// "Making Syscall: {:?}",
// crate::SysCall::from_args(nr, a1, a2, a3, a4, a5, a6, a7).unwrap()
// );
// Send the packet to the server
let mut pkt = vec![];