From df3534a0953119d149d7b8cd3665d2e9859d7c2a Mon Sep 17 00:00:00 2001 From: Armin Rigo Date: Tue, 27 Feb 2018 19:56:57 +0100 Subject: Direct tests for close_lib() --- c/test_c.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/c/test_c.py b/c/test_c.py index ab3260c..4ff1549 100644 --- a/c/test_c.py +++ b/c/test_c.py @@ -406,6 +406,9 @@ def test_load_standard_library(): # the next one is from 'libm', not 'libc', but we assume # that it is already loaded too, so it should work assert x.load_function(BVoidP, 'sqrt') + # + x.close_lib() + py.test.raises(ValueError, x.load_function, BVoidP, 'sqrt') def test_no_len_on_nonarray(): p = new_primitive_type("int") @@ -1221,6 +1224,9 @@ def test_read_variable(): ll = find_and_load_library('c') stderr = ll.read_variable(BVoidP, "stderr") assert stderr == cast(BVoidP, _testfunc(8)) + # + ll.close_lib() + py.test.raises(ValueError, ll.read_variable, BVoidP, "stderr") def test_read_variable_as_unknown_length_array(): ## FIXME: this test assumes glibc specific behavior, it's not compliant with C standard @@ -1247,6 +1253,9 @@ def test_write_variable(): assert not ll.read_variable(BVoidP, "stderr") ll.write_variable(BVoidP, "stderr", stderr) assert ll.read_variable(BVoidP, "stderr") == stderr + # + ll.close_lib() + py.test.raises(ValueError, ll.write_variable, BVoidP, "stderr", stderr) def test_callback(): BInt = new_primitive_type("int") -- cgit v1.2.1