mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
test: get test building again -- it still fails
Get test to the point where it builds. There's still an odd timeout issue we're running into, however. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
f031c0c25e
commit
5c4e76be2d
1 changed files with 59 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::TryInto;
|
use std::convert::{TryFrom, TryInto};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpStream, ToSocketAddrs};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpStream, ToSocketAddrs};
|
||||||
|
|
@ -125,6 +125,64 @@ impl ProcessArgs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This is returned when a process is created
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
pub struct ProcessStartup {
|
||||||
|
/// The process ID of the new process
|
||||||
|
pid: crate::PID,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&[usize; 7]> for ProcessStartup {
|
||||||
|
fn from(src: &[usize; 7]) -> ProcessStartup {
|
||||||
|
ProcessStartup {
|
||||||
|
pid: crate::PID::new(src[0] as _).unwrap(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<[usize; 8]> for ProcessStartup {
|
||||||
|
fn from(src: [usize; 8]) -> ProcessStartup {
|
||||||
|
let pid = crate::PID::new(src[1] as _).unwrap();
|
||||||
|
ProcessStartup { pid }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<[usize; 7]> for &ProcessStartup {
|
||||||
|
fn into(self) -> [usize; 7] {
|
||||||
|
[self.pid.get() as _, 0, 0, 0, 0, 0, 0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
impl Into<[usize; 7]> for &ProcessInit {
|
||||||
|
fn into(self) -> [usize; 7] {
|
||||||
|
[
|
||||||
|
u32::from_le_bytes(self.key.0[0..4].try_into().unwrap()) as _,
|
||||||
|
u32::from_le_bytes(self.key.0[4..8].try_into().unwrap()) as _,
|
||||||
|
u32::from_le_bytes(self.key.0[8..12].try_into().unwrap()) as _,
|
||||||
|
u32::from_le_bytes(self.key.0[12..16].try_into().unwrap()) as _,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TryFrom<[usize; 7]> for ProcessInit {
|
||||||
|
type Error = crate::Error;
|
||||||
|
fn try_from(src: [usize; 7]) -> core::result::Result<ProcessInit, crate::Error> {
|
||||||
|
let mut exploded = vec![];
|
||||||
|
for word in src[0..4].into_iter() {
|
||||||
|
exploded.extend_from_slice(&(*word as u32).to_le_bytes());
|
||||||
|
}
|
||||||
|
let mut key = [0u8; 16];
|
||||||
|
key.copy_from_slice(&exploded);
|
||||||
|
Ok(ProcessInit {
|
||||||
|
key: ProcessKey(key),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ProcessHandle(std::process::Child);
|
pub struct ProcessHandle(std::process::Child);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue