Simplify code related to testing of xtest

This commit is contained in:
Martin Liska 2024-09-21 14:40:22 +02:00 committed by Amanieu d'Antras
parent d9430d094b
commit 6a75539815
2 changed files with 3 additions and 27 deletions

View file

@ -167,6 +167,7 @@ mod tests {
use stdarch_test::simd_test;
#[repr(align(64))]
#[derive(Debug)]
struct XsaveArea {
// max size for 256-bit registers is 800 bytes:
// see https://software.intel.com/en-us/node/682996
@ -198,19 +199,6 @@ mod tests {
}
}
impl fmt::Debug for XsaveArea {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[")?;
for i in 0..self.data.len() {
write!(f, "{}", self.data[i])?;
if i != self.data.len() - 1 {
write!(f, ", ")?;
}
}
write!(f, "]")
}
}
// We cannot test for `_xsave`, `xrstor`, `_xsetbv`, `_xsaveopt`, `_xsaves`, `_xrstors` as they
// are privileged instructions and will need access to kernel mode to execute and test them.
// see https://github.com/rust-lang/stdarch/issues/209

View file

@ -131,6 +131,7 @@ mod tests {
use stdarch_test::simd_test;
#[repr(align(64))]
#[derive(Debug)]
struct XsaveArea {
// max size for 256-bit registers is 800 bytes:
// see https://software.intel.com/en-us/node/682996
@ -144,7 +145,7 @@ mod tests {
XsaveArea { data: [0; 2560] }
}
fn ptr(&mut self) -> *mut u8 {
&mut self.data[0] as *mut _ as *mut u8
self.data.as_mut_ptr()
}
}
@ -162,19 +163,6 @@ mod tests {
}
}
impl fmt::Debug for XsaveArea {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[")?;
for i in 0..self.data.len() {
write!(f, "{}", self.data[i])?;
if i != self.data.len() - 1 {
write!(f, ", ")?;
}
}
write!(f, "]")
}
}
// We cannot test `_xsave64`, `_xrstor64`, `_xsaveopt64`, `_xsaves64` and `_xrstors64` directly
// as they are privileged instructions and will need access to the kernel to run and test them.
// See https://github.com/rust-lang/stdarch/issues/209