Add more scanf tests

This commit is contained in:
oddcoder
2020-06-03 23:19:08 +02:00
parent 8973535fdc
commit 92d6735e3f
12 changed files with 66 additions and 35 deletions
+4 -4
View File
@@ -5,6 +5,10 @@
//! compatibility. So, this module will be a hellhole.
use super::super::{errno, types::*, Pal, PalPtrace, PalSignal, Sys};
#[cfg(target_arch = "aarch64")]
use crate::header::arch_aarch64_user::user_regs_struct;
#[cfg(target_arch = "x86_64")]
use crate::header::arch_x64_user::user_regs_struct;
use crate::{
c_str::CString,
fs::File,
@@ -12,10 +16,6 @@ use crate::{
io::{self, prelude::*},
sync::{Mutex, Once},
};
#[cfg(target_arch = "aarch64")]
use crate::header::arch_aarch64_user::user_regs_struct;
#[cfg(target_arch = "x86_64")]
use crate::header::arch_x64_user::user_regs_struct;
use alloc::collections::{btree_map::Entry, BTreeMap};
use core::mem;
+4 -1
View File
@@ -143,7 +143,10 @@ unsafe fn inner_get_name(
inner_af_unix(&buf[5..], address, address_len);
} else {
// Socket doesn't belong to any scheme
panic!("socket {:?} doesn't match either tcp, udp or chan schemes", str::from_utf8(buf));
panic!(
"socket {:?} doesn't match either tcp, udp or chan schemes",
str::from_utf8(buf)
);
}
Ok(0)
+5 -3
View File
@@ -68,12 +68,14 @@ fn clock_gettime() {
#[test]
fn getrandom() {
use crate::header::sys_random;
use crate::platform::types::ssize_t;
use crate::{header::sys_random, platform::types::ssize_t};
let mut arrays = [[0; 32]; 32];
for i in 1..arrays.len() {
assert_eq!(Sys::getrandom(&mut arrays[i], 0), arrays[i].len() as ssize_t);
assert_eq!(
Sys::getrandom(&mut arrays[i], 0),
arrays[i].len() as ssize_t
);
for j in 0..arrays.len() {
if i != j {