Browse Source

Fix tests

Isaac Woods 3 years ago
parent
commit
f97e39a447
2 changed files with 7 additions and 5 deletions
  1. 3 3
      aml/src/resource.rs
  2. 4 2
      aml/src/test_utils.rs

+ 3 - 3
aml/src/resource.rs

@@ -601,7 +601,7 @@ mod tests {
         ]
         .to_vec();
 
-        let value: AmlValue = AmlValue::Buffer(Arc::new(bytes));
+        let value: AmlValue = AmlValue::Buffer(Arc::new(spinning_top::Spinlock::new(bytes)));
         let resources = resource_descriptor_list(&value).unwrap();
 
         assert_eq!(
@@ -711,7 +711,7 @@ mod tests {
         ]
         .to_vec();
 
-        let value: AmlValue = AmlValue::Buffer(Arc::new(bytes));
+        let value: AmlValue = AmlValue::Buffer(Arc::new(spinning_top::Spinlock::new(bytes)));
         let resources = resource_descriptor_list(&value).unwrap();
 
         assert_eq!(
@@ -812,7 +812,7 @@ mod tests {
         ]
         .to_vec();
 
-        let value: AmlValue = AmlValue::Buffer(Arc::new(bytes));
+        let value: AmlValue = AmlValue::Buffer(Arc::new(spinning_top::Spinlock::new(bytes)));
         let resources = resource_descriptor_list(&value).unwrap();
 
         assert_eq!(

+ 4 - 2
aml/src/test_utils.rs

@@ -168,12 +168,14 @@ pub(crate) fn crudely_cmp_values(a: &AmlValue, b: &AmlValue) -> bool {
             _ => false,
         },
         AmlValue::Buffer(a) => match b {
-            AmlValue::Buffer(b) => a == b,
+            AmlValue::Buffer(b) => *a.lock() == *b.lock(),
             _ => false,
         },
         AmlValue::BufferField { buffer_data, offset, length } => match b {
             AmlValue::BufferField { buffer_data: b_buffer_data, offset: b_offset, length: b_length } => {
-                buffer_data == b_buffer_data && offset == b_offset && length == b_length
+                alloc::sync::Arc::as_ptr(buffer_data) == alloc::sync::Arc::as_ptr(b_buffer_data)
+                    && offset == b_offset
+                    && length == b_length
             }
             _ => false,
         },