about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2014-09-23 13:52:34 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2014-09-23 13:52:34 +0200
commitad0cdeffd3aff38cf46859fe4c9033d51e08f520 (patch)
tree2711827bcd81c1549985957bf03fcd59e1839dc9
parent0a4c136d6a82ed57714b033029d6c4dd7ee4e2dc (diff)
downloadrust-ad0cdeffd3aff38cf46859fe4c9033d51e08f520.tar.gz
rust-ad0cdeffd3aff38cf46859fe4c9033d51e08f520.zip
Add deallocate calls to the realloc-16687.rs test.
Fix #17303.
-rw-r--r--src/test/run-pass/realloc-16687.rs21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/test/run-pass/realloc-16687.rs b/src/test/run-pass/realloc-16687.rs
index fa38d647c7c..fa458130c7f 100644
--- a/src/test/run-pass/realloc-16687.rs
+++ b/src/test/run-pass/realloc-16687.rs
@@ -56,6 +56,13 @@ unsafe fn test_triangle() -> bool {
 
         ret
     }
+    unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) {
+        if PRINT { println!("deallocate(ptr=0x{:010x} size={:u} align={:u})",
+                            ptr as uint, size, align);
+        }
+
+        heap::deallocate(ptr, size, align);
+    }
     unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint,
                              old_size: uint) -> *mut u8 {
         if PRINT {
@@ -95,10 +102,16 @@ unsafe fn test_triangle() -> bool {
     }
 
     sanity_check(ascend.as_slice());
-    test_1(ascend);
-    test_2(ascend);
-    test_3(ascend);
-    test_4(ascend);
+    test_1(ascend); // triangle -> square
+    test_2(ascend); // square -> triangle
+    test_3(ascend); // triangle -> square
+    test_4(ascend); // square -> triangle
+
+    for i in range(0u, COUNT / 2) {
+        let size = idx_to_size(i);
+        deallocate(ascend[2*i], size, ALIGN);
+        deallocate(ascend[2*i+1], size, ALIGN);
+    }
 
     return true;