[Pkg-ocaml-maint-commits] [ocaml-ctypes] 01/03: Fix test-roots
Stéphane Glondu
glondu at moszumanska.debian.org
Wed Jun 22 13:51:46 UTC 2016
This is an automated email from the git hooks/post-receive script.
glondu pushed a commit to branch master
in repository ocaml-ctypes.
commit 0f828ff2a7a32504796926027445ed48d130f88d
Author: Stephane Glondu <steph at glondu.net>
Date: Wed Jun 22 13:44:06 2016 +0200
Fix test-roots
---
debian/patches/0006-Fix-test-roots.patch | 86 ++++++++++++++++++++++
...06-Temporarily-disable-root-lifetime-test.patch | 23 ------
debian/patches/series | 2 +-
3 files changed, 87 insertions(+), 24 deletions(-)
diff --git a/debian/patches/0006-Fix-test-roots.patch b/debian/patches/0006-Fix-test-roots.patch
new file mode 100644
index 0000000..bfd3a6a
--- /dev/null
+++ b/debian/patches/0006-Fix-test-roots.patch
@@ -0,0 +1,86 @@
+From: Stephane Glondu <steph at glondu.net>
+Date: Wed, 22 Jun 2016 13:43:47 +0200
+Subject: Fix test-roots
+
+Better delimit v's lifetime with a local block. This is relevant in
+bytecode.
+---
+ tests/test-roots/test_roots.ml | 40 +++++++++++++++++++++++++---------------
+ 1 file changed, 25 insertions(+), 15 deletions(-)
+
+diff --git a/tests/test-roots/test_roots.ml b/tests/test-roots/test_roots.ml
+index f9d2a4e..0b399ed 100644
+--- a/tests/test-roots/test_roots.ml
++++ b/tests/test-roots/test_roots.ml
+@@ -19,26 +19,32 @@ let testlib = Dl.(dlopen ~filename:"clib/libtest_functions.so" ~flags:[RTLD_NOW]
+ let test_root_lifetime _ =
+ (* Check that values not registered as roots are collected. *)
+ let alive = ref true in
+- let v = [| 1; 2; 3 |] in
+- Gc.finalise (fun _ -> alive := false) v;
++ let () =
++ let v = [| 1; 2; 3 |] in
++ Gc.finalise (fun _ -> alive := false) v;
++ in
+ Gc.compact ();
+ assert_equal false !alive
+ ~msg:"values not registered as roots are collected";
+
+ (* Check that values registered as roots are not collected. *)
+ let alive = ref true in
+- let v = [| 1; 2; 3 |] in
+- Gc.finalise (fun _ -> alive := false) v;
+- let _r = Root.create v in
++ let _r =
++ let v = [| 1; 2; 3 |] in
++ Gc.finalise (fun _ -> alive := false) v;
++ Root.create v
++ in
+ Gc.compact ();
+ assert_equal true !alive
+ ~msg:"registered roots are not collected";
+
+ (* Check that values unregistered as roots are collected. *)
+ let alive = ref true in
+- let v = [| 1; 2; 3 |] in
+- Gc.finalise (fun _ -> alive := false) v;
+- let r = Root.create v in
++ let r =
++ let v = [| 1; 2; 3 |] in
++ Gc.finalise (fun _ -> alive := false) v;
++ Root.create v
++ in
+ Root.release r;
+ Gc.compact ();
+ assert_equal false !alive
+@@ -46,19 +52,23 @@ let test_root_lifetime _ =
+
+ (* Check that values assigned to roots are not collected. *)
+ let alive = ref true in
+- let v = [| 1; 2; 3 |] in
+- Gc.finalise (fun _ -> alive := false) v;
+- let r = Root.create () in
+- Root.set r v;
++ let () =
++ let v = [| 1; 2; 3 |] in
++ Gc.finalise (fun _ -> alive := false) v;
++ let r = Root.create () in
++ Root.set r v;
++ in
+ Gc.compact ();
+ assert_equal true !alive
+ ~msg:"values assigned to roots are not collected";
+
+ (* Check that values registered as roots and then overwritten are collected. *)
+ let alive = ref true in
+- let v = [| 1; 2; 3 |] in
+- Gc.finalise (fun _ -> alive := false) v;
+- let r = Root.create v in
++ let r =
++ let v = [| 1; 2; 3 |] in
++ Gc.finalise (fun _ -> alive := false) v;
++ Root.create v
++ in
+ Root.set r ();
+ Gc.compact ();
+ assert_equal false !alive
diff --git a/debian/patches/0006-Temporarily-disable-root-lifetime-test.patch b/debian/patches/0006-Temporarily-disable-root-lifetime-test.patch
deleted file mode 100644
index f6b0953..0000000
--- a/debian/patches/0006-Temporarily-disable-root-lifetime-test.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: Stephane Glondu <steph at glondu.net>
-Date: Wed, 22 Jun 2016 11:58:42 +0200
-Subject: Temporarily disable root lifetime test
-
----
- tests/test-roots/test_roots.ml | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/tests/test-roots/test_roots.ml b/tests/test-roots/test_roots.ml
-index f9d2a4e..b9e5837 100644
---- a/tests/test-roots/test_roots.ml
-+++ b/tests/test-roots/test_roots.ml
-@@ -90,8 +90,8 @@ let test_passing_roots _ =
-
-
- let suite = "Root tests" >:::
-- ["root lifetime"
-- >:: test_root_lifetime;
-+ [(*"root lifetime"
-+ >:: test_root_lifetime;*)
-
- "passing roots"
- >:: test_passing_roots;
diff --git a/debian/patches/series b/debian/patches/series
index b9d41d5..cce951b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,4 +3,4 @@
0003-Initialize-the-return-slot-for-small-return-values-f.patch
0004-Missing-return-in-ffi_return_type_adjustment.patch
0005-Add-support-for-bytecode-architectures.patch
-0006-Temporarily-disable-root-lifetime-test.patch
+0006-Fix-test-roots.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/ocaml-ctypes.git
More information about the Pkg-ocaml-maint-commits
mailing list