Author: Armin Rigo <[email protected]>
Branch:
Changeset: r522:a8273b98ef59
Date: 2013-09-07 16:42 +0200
http://bitbucket.org/pypy/stmgc/changeset/a8273b98ef59/
Log: Add a passing test for stm_clear_on_abort()
diff --git a/c4/test/support.py b/c4/test/support.py
--- a/c4/test/support.py
+++ b/c4/test/support.py
@@ -127,6 +127,8 @@
void stm_initialize_and_set_max_abort(int max_aborts);
void stm_initialize_tests(int max_aborts);
+ void stm_clear_on_abort(void *start, size_t bytes);
+
/* some constants normally private that are useful in the tests */
#define WORD ...
#define GC_PAGE_SIZE ...
diff --git a/c4/test/test_extra.py b/c4/test/test_extra.py
--- a/c4/test/test_extra.py
+++ b/c4/test/test_extra.py
@@ -253,5 +253,19 @@
check_free_old(p3o)
check_free_old(p2)
-
-
+
+def test_clear_on_abort():
+ p = ffi.new("char[]", "hello")
+ lib.stm_clear_on_abort(p, 2)
+ #
+ @perform_transaction
+ def run(retry_counter):
+ if retry_counter == 0:
+ assert ffi.string(p) == "hello"
+ abort_and_retry()
+ else:
+ assert p[0] == '\0'
+ assert p[1] == '\0'
+ assert p[2] == 'l'
+ assert p[3] == 'l'
+ assert p[4] == 'o'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit