From 0dd9d2e77471666fbf1536ed363d8bdc10ec027d Mon Sep 17 00:00:00 2001 From: Karl Wette Date: Sat, 16 Jul 2022 21:33:27 +1000 Subject: [PATCH 1/2] .gitlab-ci.yml: save generated sources in artifacts --- .gitlab-ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0ca976df3e..792224b287 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -381,6 +381,9 @@ workflow: # log files - "rpmbuild/BUILD/**/config.log" - "rpmbuild/BUILD/**/test-suite.log" + # generated sources + - "rpmbuild/BUILD/**/swiglal_octave.cpp" + - "rpmbuild/BUILD/**/swiglal_python.c" reports: junit: "rpmbuild/BUILD/**/*junit*.xml" when: always @@ -457,6 +460,9 @@ workflow: # log files - "${CI_JOB_NAME%%:*}*/**/config.log" - "${CI_JOB_NAME%%:*}*/**/test-suite.log" + # generated sources + - "${CI_JOB_NAME%%:*}*/**/swiglal_octave.cpp" + - "${CI_JOB_NAME%%:*}*/**/swiglal_python.c" # the orig tarball - "${CI_JOB_NAME%%:*}*.orig.*" reports: @@ -589,6 +595,9 @@ workflow: # log files - "conda-bld/${CI_JOB_NAME%%:*}-*/work/**/config.log" - "conda-bld/${CI_JOB_NAME%%:*}-*/work/**/test-suite.log" + # generated sources + - "conda-bld/${CI_JOB_NAME%%:*}-*/work/**/swiglal_octave.cpp" + - "conda-bld/${CI_JOB_NAME%%:*}-*/work/**/swiglal_python.c" # the feedstock - "${CI_JOB_NAME%%:*}/${CI_JOB_NAME%%:*}-feedstock/" reports: -- GitLab From 09e6750bda437ca72ed643ea78605cb193499c8e Mon Sep 17 00:00:00 2001 From: Karl Wette Date: Sat, 16 Jul 2022 21:33:27 +1000 Subject: [PATCH 2/2] SWIG: use "nasty" error handlers in tests - Tests will now abort() on error; "make check" still runs fine - Enables running tests under debugger (e.g. gdb) to debug failures: $ cd swig/ && make debug-{octave|python}-test - Requires SWIG >= 4.0.2 for Octave for exception raising fixes --- gnuscripts/lalsuite_swig.am | 12 ++++- lal/swig/SWIGTestLALOctave.m | 47 +++++++++++++++++++ lal/swig/SWIGTestLALPython.py | 39 +++++++++++++++ lalburst/swig/SWIGTestLALBurstOctave.m | 15 ++++++ lalburst/swig/SWIGTestLALBurstPython.py | 7 +++ lalframe/swig/SWIGTestLALFrameOctave.m | 15 ++++++ lalframe/swig/SWIGTestLALFramePython.py | 7 +++ .../swig/SWIGTestLALInferenceOctave.m | 15 ++++++ .../swig/SWIGTestLALInferencePython.py | 7 +++ lalinspiral/swig/SWIGTestLALInspiralOctave.m | 15 ++++++ lalinspiral/swig/SWIGTestLALInspiralPython.py | 7 +++ lalmetaio/swig/SWIGTestLALMetaIOOctave.m | 15 ++++++ lalmetaio/swig/SWIGTestLALMetaIOPython.py | 7 +++ lalpulsar/swig/SWIGTestLALPulsarOctave.m | 17 ++++++- lalpulsar/swig/SWIGTestLALPulsarPython.py | 9 +++- .../swig/SWIGTestLALSimulationOctave.m | 15 ++++++ .../swig/SWIGTestLALSimulationPython.py | 7 +++ 17 files changed, 252 insertions(+), 4 deletions(-) diff --git a/gnuscripts/lalsuite_swig.am b/gnuscripts/lalsuite_swig.am index a85d3851a8..43ea644f9f 100644 --- a/gnuscripts/lalsuite_swig.am +++ b/gnuscripts/lalsuite_swig.am @@ -19,11 +19,13 @@ include $(top_srcdir)/gnuscripts/lalsuite_test.am .PHONY: swig-octave-install-hook .PHONY: swig-octave-uninstall-hook .PHONY: run-octave +.PHONY: debug-octave-test .PHONY: swig-python-all-local .PHONY: swig-python-clean-local .PHONY: swig-python-install-hook .PHONY: swig-python-uninstall-hook .PHONY: run-python +.PHONY: debug-python-test header-links: header-links-local @@ -197,7 +199,10 @@ swig-octave-uninstall-hook: test_scripts += SWIGTest$(PACKAGE_NAME)Octave.m run-octave: $(octexec_LTLIBRARIES) - $(AM_V_at)$(TESTS_ENVIRONMENT)$(test_script_compiler) $(RUNTOOL) $(OCTAVE) $(RUNARGS) + $(AM_V_at)$(TESTS_ENVIRONMENT)$(test_script_compiler) $(OCTAVE) + +debug-octave-test: $(octexec_LTLIBRARIES) + $(AM_V_at)$(TESTS_ENVIRONMENT)$(test_script_compiler) $${DEBUGGER:-gdb --args} $(OCTAVE) ./SWIGTest$(PACKAGE_NAME)Octave.m endif # SWIG_BUILD_OCTAVE @@ -266,7 +271,10 @@ swig-python-uninstall-hook: test_scripts += SWIGTest$(PACKAGE_NAME)Python.py run-python: $(pkgpyexec_LTLIBRARIES) - $(AM_V_at)$(TESTS_ENVIRONMENT)$(test_script_compiler) $(RUNTOOL) $(PYTHON) $(RUNARGS) + $(AM_V_at)$(TESTS_ENVIRONMENT)$(test_script_compiler) $(PYTHON) + +debug-python-test: $(pkgpyexec_LTLIBRARIES) + $(AM_V_at)$(TESTS_ENVIRONMENT)$(test_script_compiler) $${DEBUGGER:-gdb --args} $(PYTHON) ./SWIGTest$(PACKAGE_NAME)Python.py endif # SWIG_BUILD_PYTHON diff --git a/lal/swig/SWIGTestLALOctave.m b/lal/swig/SWIGTestLALOctave.m index 174be5e3c9..149fc6669f 100644 --- a/lal/swig/SWIGTestLALOctave.m +++ b/lal/swig/SWIGTestLALOctave.m @@ -13,6 +13,21 @@ lal_c_si = LAL_C_SI; lal_180_pi = LAL_180_PI; disp("PASSED module load"); +# set error handlers +function set_nice_error_handlers() + swig_set_nice_error_handlers(); +endfunction +function set_default_error_handlers() + lal; + if swig_version >= 0x040002 + # see https://github.com/swig/swig/pull/1789 + swig_set_nasty_error_handlers(); + else + swig_set_nice_error_handlers(); + endif +endfunction +set_default_error_handlers(); + ## check memory allocation disp("checking memory allocation ..."); if !lal.NoDebug @@ -22,10 +37,12 @@ if !lal.NoDebug mem3 = XLALCreateREAL8Vector(3); mem4 = XLALCreateREAL4TimeSeries("test", LIGOTimeGPS(0), 100, 0.1, lal.DimensionlessUnit, 10); disp("*** below should be an error message from CheckMemoryLeaks() ***"); + set_nice_error_handlers(); try LALCheckMemoryLeaks(); expected_exception = 1; end_try_catch + set_default_error_handlers(); assert(!expected_exception); disp("*** above should be an error message from CheckMemoryLeaks() ***"); clear mem1; @@ -135,10 +152,12 @@ assert(all(size(sts.mat) == [2, 3])); sts.vec = [3; 2; 1]; assert(all(sts.vec == [3; 2; 1])); sts.mat = [4, 5, 6; 9, 8, 7]; +set_nice_error_handlers(); try sts.mat = [1.1, 2.3, 4.5; 6.5, 4.3, 2.1]; expected_exception = 1; end_try_catch +set_default_error_handlers(); assert(!expected_exception); assert(all(all(sts.mat == [4, 5, 6; 9, 8, 7]))); for i = 1:3 @@ -166,10 +185,12 @@ assert(lal.swig_lal_test_INT4_const_vector(3) == 4); lal.swig_lal_test_INT4_matrix = lal.swig_lal_test_INT4_const_matrix; assert(all(lal.swig_lal_test_INT4_matrix == [[1, 2, 4]; [2, 4, 8]])); assert(lal.swig_lal_test_INT4_const_matrix(2, 3) == 8); +set_nice_error_handlers(); try lal.swig_lal_test_INT4_const_vector(20); expected_exception = 1; end_try_catch +set_default_error_handlers(); assert(!expected_exception); lal.swig_lal_test_REAL8_vector(1) = 3.4; assert(lal.swig_lal_test_REAL8_vector(1) == 3.4); @@ -198,15 +219,19 @@ function check_dynamic_vector_matrix(iv, ivl, rv, rvl, cm, cms1, cms2) assert(all(rv.data == [1.2; 3.4; 2.6; 4.8; 3.5])); rv.data(rvl) = 7.5; assert(rv.data(rvl) == 7.5); + set_nice_error_handlers(); try rv.data(rvl + 1) = 99.9; expected_exception = 1; end_try_catch + set_default_error_handlers(); assert(!expected_exception); + set_nice_error_handlers(); try iv.data = rv.data; expected_exception = 1; end_try_catch + set_default_error_handlers(); assert(!expected_exception); rv.data = iv.data; assert(all(rv.data == iv.data)); @@ -219,15 +244,19 @@ function check_dynamic_vector_matrix(iv, ivl, rv, rvl, cm, cms1, cms2) endfor assert(cm.data(2, 3) == complex(0.5, 1.5)); assert(cm.data(3, 2) == complex(0.75, 1.0)); + set_nice_error_handlers(); try iv.data(0) = cm.data(2, 3); expected_exception = 1; end_try_catch + set_default_error_handlers(); assert(!expected_exception); + set_nice_error_handlers(); try rv.data(0) = cm.data(3, 2); expected_exception = 1; end_try_catch + set_default_error_handlers(); assert(!expected_exception); endfunction ## check LAL vector and matrix datatypes @@ -278,15 +307,19 @@ assert(all(swig_lal_test_copyin_array2(a2in, 15) == a2out)); a3in = {lal.LIGOTimeGPS(1234.5); lal.LIGOTimeGPS(678.9)}; a3out = {a3in{1} * 3; a3in{2} * 3}; assert(all(cellfun(@(x, y) x == y, lal.swig_lal_test_copyin_array3(a3in, 3), a3out))); +set_nice_error_handlers(); try swig_lal_test_viewin_array1([0,0,0,0], 0); expected_exception = 1; end_try_catch +set_default_error_handlers(); assert(!expected_exception); +set_nice_error_handlers(); try swig_lal_test_viewin_array2([1.2,3.4; 0,0; 0,0], 0); expected_exception = 1; end_try_catch +set_default_error_handlers(); assert(!expected_exception); clear a3in; clear a3out; @@ -794,15 +827,19 @@ disp("PASSED input views of numeric array structs (GSL)"); function check_input_view_type_safety(f, a, b, expect_exception) expected_exception = 0; if expect_exception + set_nice_error_handlers(); try f(a, b); expected_exception = 1; end_try_catch + set_default_error_handlers(); assert(!expected_exception); + set_nice_error_handlers(); try f(b, a); expected_exception = 1; end_try_catch + set_default_error_handlers(); assert(!expected_exception); else f(a, b); @@ -1104,23 +1141,29 @@ assert(t4struct.t == 1234.5); t5 = LIGOTimeGPS("1000"); assert(t5 == 1000); disp("*** below should be error messages from LIGOTimeGPS constructor ***"); +set_nice_error_handlers(); try t5 = LIGOTimeGPS("abc1000"); expected_exception = 1; end_try_catch +set_default_error_handlers(); assert(!expected_exception); +set_nice_error_handlers(); try t5 = LIGOTimeGPS("1000abc"); expected_exception = 1; end_try_catch +set_default_error_handlers(); assert(!expected_exception); disp("*** above should be error messages from LIGOTimeGPS constructor ***"); assert(swig_lal_test_noptrgps(LIGOTimeGPS(1234.5)) == swig_lal_test_noptrgps(1234.5)) disp("*** below should be error messages from LIGOTimeGPS constructor ***"); +set_nice_error_handlers(); try LIGOTimeGPS([]); expected_exception = 1; end_try_catch +set_default_error_handlers(); assert(!expected_exception); disp("*** above should be error messages from LIGOTimeGPS constructor ***"); clear t0; @@ -1143,10 +1186,12 @@ u2 = lal.MeterUnit * lal.KiloGramUnit / lal.SecondUnit ^ 2; assert(u1 == u2 && strcmp(swig_type(u2), "LALUnit")); u2 = lal.MeterUnit^[1,2] * lal.KiloGramUnit^[1,2] * lal.SecondUnit ^ -1; assert(u1^[1,2] == u2 && strcmp(swig_type(u2), "LALUnit")); +set_nice_error_handlers(); try lal.SecondUnit ^ [1,0]; expected_exception = 1; end_try_catch +set_default_error_handlers(); assert(!expected_exception); u1 *= lal.MeterUnit; assert(u1 == lal.JouleUnit && strcmp(swig_type(u1), "LALUnit")); @@ -1162,10 +1207,12 @@ assert(u1 == lal.MegaUnit / 1000 * lal.WattUnit); assert(u1.__int__() == 1000); u1 /= 10000; assert(u1 == 100 * lal.MilliUnit * lal.WattUnit); +set_nice_error_handlers(); try u1 *= 1.234; expected_exception = 1; end_try_catch +set_default_error_handlers(); assert(!expected_exception); assert(u1.norm() == u1); clear u1; diff --git a/lal/swig/SWIGTestLALPython.py b/lal/swig/SWIGTestLALPython.py index ca81a69500..48fdbf5bce 100644 --- a/lal/swig/SWIGTestLALPython.py +++ b/lal/swig/SWIGTestLALPython.py @@ -23,6 +23,13 @@ lal_c_si = lal.C_SI lal_180_pi = lal.LAL_180_PI print("PASSED module load") +# set error handlers +def set_nice_error_handlers(): + lal.swig_set_nice_error_handlers() +def set_default_error_handlers(): + lal.swig_set_nasty_error_handlers() +set_default_error_handlers() + # check memory allocation print("checking memory allocation ...") if not lal.NoDebug: @@ -32,11 +39,13 @@ if not lal.NoDebug: mem3 = lal.CreateREAL8Vector(3) mem4 = lal.CreateREAL4TimeSeries("test", lal.LIGOTimeGPS(0), 100, 0.1, lal.DimensionlessUnit, 10) print("*** below should be an error message from CheckMemoryLeaks() ***") + set_nice_error_handlers() try: lal.CheckMemoryLeaks() expected_exception = True except: pass + set_default_error_handlers() assert not expected_exception print("*** above should be an error message from CheckMemoryLeaks() ***") del mem1 @@ -136,11 +145,13 @@ assert sts.mat.shape == (2, 3) sts.vec = [3, 2, 1] assert (sts.vec == [3, 2, 1]).all() sts.mat = [[4, 5, 6], (9, 8, 7)] +set_nice_error_handlers() try: sts.mat = [[1.1, 2.3, 4.5], [6.5, 4.3, 2.1]] expected_exception = True except: pass +set_default_error_handlers() assert not expected_exception assert (sts.mat == [[4, 5, 6], [9, 8, 7]]).all() for i in range(0, 3): @@ -166,11 +177,13 @@ assert lalglobalvar.swig_lal_test_INT4_const_vector[2] == 4 lalglobalvar.swig_lal_test_INT4_matrix = lalglobalvar.swig_lal_test_INT4_const_matrix assert (lalglobalvar.swig_lal_test_INT4_matrix == [[1, 2, 4], [2, 4, 8]]).all() assert lalglobalvar.swig_lal_test_INT4_const_matrix[1, 2] == 8 +set_nice_error_handlers() try: lalglobalvar.swig_lal_test_INT4_const_vector(20) expected_exception = True except: pass +set_default_error_handlers() assert not expected_exception lalglobalvar.swig_lal_test_REAL8_vector[0] = 3.4 assert lalglobalvar.swig_lal_test_REAL8_vector[0] == 3.4 @@ -199,17 +212,21 @@ def check_dynamic_vector_matrix(iv, ivl, rv, rvl, cm, cms1, cms2): assert (rv.data == [1.2, 3.4, 2.6, 4.8, 3.5]).all() rv.data[rvl - 1] = 7.5 assert rv.data[rvl - 1] == 7.5 + set_nice_error_handlers() try: rv.data[rvl] = 99.9 expected_exception = True except: pass + set_default_error_handlers() assert not expected_exception + set_nice_error_handlers() try: iv.data = rv.data expected_exception = True except: pass + set_default_error_handlers() assert not expected_exception rv.data = iv.data assert (rv.data == iv.data).all() @@ -220,6 +237,7 @@ def check_dynamic_vector_matrix(iv, ivl, rv, rvl, cm, cms1, cms2): cm.data[i, j] = complex(i / 4.0, j / 2.0) assert cm.data[2, 3] == complex(0.5, 1.5) assert cm.data[3, 2] == complex(0.75, 1.0) + set_nice_error_handlers() try: iv.data[0] = cm.data[2, 3] if not hasattr(numpy, "ComplexWarning"): @@ -227,7 +245,9 @@ def check_dynamic_vector_matrix(iv, ivl, rv, rvl, cm, cms1, cms2): expected_exception = True except: pass + set_default_error_handlers() assert not expected_exception + set_nice_error_handlers() try: rv.data[0] = cm.data[3, 2] if not hasattr(numpy, "ComplexWarning"): @@ -235,6 +255,7 @@ def check_dynamic_vector_matrix(iv, ivl, rv, rvl, cm, cms1, cms2): expected_exception = True except: pass + set_default_error_handlers() assert not expected_exception # check LAL vector and matrix datatypes iv = lal.CreateINT4Vector(5) @@ -279,17 +300,21 @@ assert (lal.swig_lal_test_copyin_array2(a2in, 15) == a2out).all() a3in = numpy.array([lal.LIGOTimeGPS(1234.5), lal.LIGOTimeGPS(678.9)]) a3out = a3in * 3 assert (lal.swig_lal_test_copyin_array3(a3in, 3) == a3out).all() +set_nice_error_handlers() try: lal.swig_lal_test_copyin_array1(numpy.array([0,0,0,0], dtype=numpy.double), 0) expected_exception = True except: pass +set_default_error_handlers() assert not expected_exception +set_nice_error_handlers() try: lal.swig_lal_test_copyin_array2(numpy.array([[1.2,3.4],[0,0],[0,0]], dtype=numpy.double), 0) expected_exception = True except: pass +set_default_error_handlers() assert not expected_exception del a3in del a3out @@ -828,17 +853,21 @@ print("PASSED input views of numeric array structs (GSL)") def check_input_view_type_safety(f, a, b, expect_exception): expected_exception = False if expect_exception: + set_nice_error_handlers() try: f(a, b) expected_exception = True except: pass + set_default_error_handlers() assert not expected_exception + set_nice_error_handlers() try: f(b, a) expected_exception = True except: pass + set_default_error_handlers() assert not expected_exception else: f(a, b) @@ -1136,26 +1165,32 @@ assert t4struct.t == 1234.5 t5 = LIGOTimeGPS("1000") assert t5 == 1000 print("*** below should be error messages from LIGOTimeGPS constructor ***") +set_nice_error_handlers() try: t5 = LIGOTimeGPS("abc1000") expected_exception = True except: pass +set_default_error_handlers() assert not expected_exception +set_nice_error_handlers() try: t5 = LIGOTimeGPS("1000abc") expected_exception = True except: pass +set_default_error_handlers() assert not expected_exception print("*** above should be error messages from LIGOTimeGPS constructor ***") assert lal.swig_lal_test_noptrgps(LIGOTimeGPS(1234.5)) == lal.swig_lal_test_noptrgps(1234.5) print("*** below should be error messages from LIGOTimeGPS constructor ***") +set_nice_error_handlers() try: LIGOTimeGPS(None) expected_exception = True except: pass +set_default_error_handlers() assert not expected_exception print("*** above should be error messages from LIGOTimeGPS constructor ***") del t0 @@ -1199,11 +1234,13 @@ u2 = lal.MeterUnit * lal.KiloGramUnit / lal.SecondUnit ** 2 assert is_value_and_type(u2, u1, lal.Unit) u2 = lal.MeterUnit**(1,2) * lal.KiloGramUnit**(1,2) * lal.SecondUnit ** -1 assert is_value_and_type(u2, u1**(1,2), lal.Unit) +set_nice_error_handlers() try: lal.SecondUnit ** (1,0) expected_exception = True except: pass +set_default_error_handlers() assert not expected_exception u1 *= lal.MeterUnit assert is_value_and_type(u1, lal.JouleUnit, lal.Unit) @@ -1219,11 +1256,13 @@ assert u1 == lal.MegaUnit / 1000 * lal.WattUnit assert int(u1) == 1000 u1 /= 10000 assert u1 == 100 * lal.MilliUnit * lal.WattUnit +set_nice_error_handlers() try: u1 *= 1.234 expected_exception = True except: pass +set_default_error_handlers() assert not expected_exception assert u1.norm() == u1 del u1 diff --git a/lalburst/swig/SWIGTestLALBurstOctave.m b/lalburst/swig/SWIGTestLALBurstOctave.m index 8bc419f9d7..48f778e63b 100644 --- a/lalburst/swig/SWIGTestLALBurstOctave.m +++ b/lalburst/swig/SWIGTestLALBurstOctave.m @@ -12,6 +12,21 @@ lal; assert(exist("lal")); disp("PASSED module load"); +# set error handlers +function set_nice_error_handlers() + swig_set_nice_error_handlers(); +endfunction +function set_default_error_handlers() + lal; + if swig_version >= 0x040002 + # see https://github.com/swig/swig/pull/1789 + swig_set_nasty_error_handlers(); + else + swig_set_nice_error_handlers(); + endif +endfunction +set_default_error_handlers(); + ## check object parent tracking disp("checking object parent tracking ..."); a = lalburst.new_swig_lalburst_test_parent_map_struct(); diff --git a/lalburst/swig/SWIGTestLALBurstPython.py b/lalburst/swig/SWIGTestLALBurstPython.py index 7728386158..ebe1235941 100644 --- a/lalburst/swig/SWIGTestLALBurstPython.py +++ b/lalburst/swig/SWIGTestLALBurstPython.py @@ -9,6 +9,13 @@ from lalburst import globalvar as lalburstglobalvar from lal import globalvar as lalglobalvar print("PASSED module load") +# set error handlers +def set_nice_error_handlers(): + lal.swig_set_nice_error_handlers() +def set_default_error_handlers(): + lal.swig_set_nasty_error_handlers() +set_default_error_handlers() + # check object parent tracking print("checking object parent tracking ...") a = lalburst.swig_lalburst_test_parent_map_struct() diff --git a/lalframe/swig/SWIGTestLALFrameOctave.m b/lalframe/swig/SWIGTestLALFrameOctave.m index bc85967475..aef95e8058 100644 --- a/lalframe/swig/SWIGTestLALFrameOctave.m +++ b/lalframe/swig/SWIGTestLALFrameOctave.m @@ -12,6 +12,21 @@ lal; assert(exist("lal")); disp("PASSED module load"); +# set error handlers +function set_nice_error_handlers() + swig_set_nice_error_handlers(); +endfunction +function set_default_error_handlers() + lal; + if swig_version >= 0x040002 + # see https://github.com/swig/swig/pull/1789 + swig_set_nasty_error_handlers(); + else + swig_set_nice_error_handlers(); + endif +endfunction +set_default_error_handlers(); + ## check object parent tracking disp("checking object parent tracking ..."); a = lalframe.new_swig_lalframe_test_parent_map_struct(); diff --git a/lalframe/swig/SWIGTestLALFramePython.py b/lalframe/swig/SWIGTestLALFramePython.py index ae13846cbe..503d9f39df 100644 --- a/lalframe/swig/SWIGTestLALFramePython.py +++ b/lalframe/swig/SWIGTestLALFramePython.py @@ -9,6 +9,13 @@ from lalframe import globalvar as lalframeglobalvar from lal import globalvar as lalglobalvar print("PASSED module load") +# set error handlers +def set_nice_error_handlers(): + lal.swig_set_nice_error_handlers() +def set_default_error_handlers(): + lal.swig_set_nasty_error_handlers() +set_default_error_handlers() + # check object parent tracking print("checking object parent tracking ...") a = lalframe.swig_lalframe_test_parent_map_struct() diff --git a/lalinference/swig/SWIGTestLALInferenceOctave.m b/lalinference/swig/SWIGTestLALInferenceOctave.m index adf2f44646..c3a0438989 100644 --- a/lalinference/swig/SWIGTestLALInferenceOctave.m +++ b/lalinference/swig/SWIGTestLALInferenceOctave.m @@ -12,6 +12,21 @@ lal; assert(exist("lal")); disp("PASSED module load"); +# set error handlers +function set_nice_error_handlers() + swig_set_nice_error_handlers(); +endfunction +function set_default_error_handlers() + lal; + if swig_version >= 0x040002 + # see https://github.com/swig/swig/pull/1789 + swig_set_nasty_error_handlers(); + else + swig_set_nice_error_handlers(); + endif +endfunction +set_default_error_handlers(); + ## check object parent tracking disp("checking object parent tracking ..."); a = lalinference.new_swig_lalinference_test_parent_map_struct(); diff --git a/lalinference/swig/SWIGTestLALInferencePython.py b/lalinference/swig/SWIGTestLALInferencePython.py index 1681cfcda2..5546ba0917 100644 --- a/lalinference/swig/SWIGTestLALInferencePython.py +++ b/lalinference/swig/SWIGTestLALInferencePython.py @@ -9,6 +9,13 @@ from lalinference import globalvar as lalinferenceglobalvar from lal import globalvar as lalglobalvar print("PASSED module load") +# set error handlers +def set_nice_error_handlers(): + lal.swig_set_nice_error_handlers() +def set_default_error_handlers(): + lal.swig_set_nasty_error_handlers() +set_default_error_handlers() + # check object parent tracking print("checking object parent tracking ...") a = lalinference.swig_lalinference_test_parent_map_struct() diff --git a/lalinspiral/swig/SWIGTestLALInspiralOctave.m b/lalinspiral/swig/SWIGTestLALInspiralOctave.m index 94ceec49f6..9ff18bdaab 100644 --- a/lalinspiral/swig/SWIGTestLALInspiralOctave.m +++ b/lalinspiral/swig/SWIGTestLALInspiralOctave.m @@ -12,6 +12,21 @@ lal; assert(exist("lal")); disp("PASSED module load"); +# set error handlers +function set_nice_error_handlers() + swig_set_nice_error_handlers(); +endfunction +function set_default_error_handlers() + lal; + if swig_version >= 0x040002 + # see https://github.com/swig/swig/pull/1789 + swig_set_nasty_error_handlers(); + else + swig_set_nice_error_handlers(); + endif +endfunction +set_default_error_handlers(); + ## check object parent tracking disp("checking object parent tracking ..."); a = lalinspiral.new_swig_lalinspiral_test_parent_map_struct(); diff --git a/lalinspiral/swig/SWIGTestLALInspiralPython.py b/lalinspiral/swig/SWIGTestLALInspiralPython.py index 561e703d3f..fb8084ecb1 100644 --- a/lalinspiral/swig/SWIGTestLALInspiralPython.py +++ b/lalinspiral/swig/SWIGTestLALInspiralPython.py @@ -9,6 +9,13 @@ from lalinspiral import globalvar as lalinspiralglobalvar from lal import globalvar as lalglobalvar print("PASSED module load") +# set error handlers +def set_nice_error_handlers(): + lal.swig_set_nice_error_handlers() +def set_default_error_handlers(): + lal.swig_set_nasty_error_handlers() +set_default_error_handlers() + # check object parent tracking print("checking object parent tracking ...") a = lalinspiral.swig_lalinspiral_test_parent_map_struct() diff --git a/lalmetaio/swig/SWIGTestLALMetaIOOctave.m b/lalmetaio/swig/SWIGTestLALMetaIOOctave.m index a8c3d5d768..f621aeb543 100644 --- a/lalmetaio/swig/SWIGTestLALMetaIOOctave.m +++ b/lalmetaio/swig/SWIGTestLALMetaIOOctave.m @@ -12,6 +12,21 @@ lal; assert(exist("lal")); disp("PASSED module load"); +# set error handlers +function set_nice_error_handlers() + swig_set_nice_error_handlers(); +endfunction +function set_default_error_handlers() + lal; + if swig_version >= 0x040002 + # see https://github.com/swig/swig/pull/1789 + swig_set_nasty_error_handlers(); + else + swig_set_nice_error_handlers(); + endif +endfunction +set_default_error_handlers(); + ## check object parent tracking disp("checking object parent tracking ..."); a = lalmetaio.new_swig_lalmetaio_test_parent_map_struct(); diff --git a/lalmetaio/swig/SWIGTestLALMetaIOPython.py b/lalmetaio/swig/SWIGTestLALMetaIOPython.py index 2210e6a61e..5124489be4 100644 --- a/lalmetaio/swig/SWIGTestLALMetaIOPython.py +++ b/lalmetaio/swig/SWIGTestLALMetaIOPython.py @@ -9,6 +9,13 @@ from lalmetaio import globalvar as lalmetaioglobalvar from lal import globalvar as lalglobalvar print("PASSED module load") +# set error handlers +def set_nice_error_handlers(): + lal.swig_set_nice_error_handlers() +def set_default_error_handlers(): + lal.swig_set_nasty_error_handlers() +set_default_error_handlers() + # check object parent tracking print("checking object parent tracking ...") a = lalmetaio.swig_lalmetaio_test_parent_map_struct() diff --git a/lalpulsar/swig/SWIGTestLALPulsarOctave.m b/lalpulsar/swig/SWIGTestLALPulsarOctave.m index 07d45dd359..8fe60c201f 100644 --- a/lalpulsar/swig/SWIGTestLALPulsarOctave.m +++ b/lalpulsar/swig/SWIGTestLALPulsarOctave.m @@ -12,6 +12,21 @@ lal; assert(exist("lal")); disp("PASSED module load"); +# set error handlers +function set_nice_error_handlers() + swig_set_nice_error_handlers(); +endfunction +function set_default_error_handlers() + lal; + if swig_version >= 0x040002 + # see https://github.com/swig/swig/pull/1789 + swig_set_nasty_error_handlers(); + else + swig_set_nice_error_handlers(); + endif +endfunction +set_default_error_handlers(); + ## check object parent tracking disp("checking object parent tracking ..."); a = lalpulsar.new_swig_lalpulsar_test_parent_map_struct(); @@ -38,7 +53,7 @@ mts.data(1) = ts0; lal.swig_set_nasty_error_handlers(); clear mts; clear ts0; -lal.swig_set_nice_error_handlers(); +set_default_error_handlers(); LALCheckMemoryLeaks(); disp("PASSED array element assignment"); diff --git a/lalpulsar/swig/SWIGTestLALPulsarPython.py b/lalpulsar/swig/SWIGTestLALPulsarPython.py index 840f7a1ef2..831b21fcb2 100644 --- a/lalpulsar/swig/SWIGTestLALPulsarPython.py +++ b/lalpulsar/swig/SWIGTestLALPulsarPython.py @@ -9,6 +9,13 @@ from lalpulsar import globalvar as lalpulsarglobalvar from lal import globalvar as lalglobalvar print("PASSED module load") +# set error handlers +def set_nice_error_handlers(): + lal.swig_set_nice_error_handlers() +def set_default_error_handlers(): + lal.swig_set_nasty_error_handlers() +set_default_error_handlers() + # check object parent tracking print("checking object parent tracking ...") a = lalpulsar.swig_lalpulsar_test_parent_map_struct() @@ -32,7 +39,7 @@ mts.data[0] = ts0 lal.swig_set_nasty_error_handlers() del mts del ts0 -lal.swig_set_nice_error_handlers() +set_default_error_handlers() lal.CheckMemoryLeaks() print("PASSED array element assignment") diff --git a/lalsimulation/swig/SWIGTestLALSimulationOctave.m b/lalsimulation/swig/SWIGTestLALSimulationOctave.m index 78c2d9e1d2..10a9d28cdc 100644 --- a/lalsimulation/swig/SWIGTestLALSimulationOctave.m +++ b/lalsimulation/swig/SWIGTestLALSimulationOctave.m @@ -12,6 +12,21 @@ lal; assert(exist("lal")); disp("PASSED module load"); +# set error handlers +function set_nice_error_handlers() + swig_set_nice_error_handlers(); +endfunction +function set_default_error_handlers() + lal; + if swig_version >= 0x040002 + # see https://github.com/swig/swig/pull/1789 + swig_set_nasty_error_handlers(); + else + swig_set_nice_error_handlers(); + endif +endfunction +set_default_error_handlers(); + ## check object parent tracking disp("checking object parent tracking ..."); a = lalsimulation.new_swig_lalsimulation_test_parent_map_struct(); diff --git a/lalsimulation/swig/SWIGTestLALSimulationPython.py b/lalsimulation/swig/SWIGTestLALSimulationPython.py index 66cb08808d..cc8e58273c 100644 --- a/lalsimulation/swig/SWIGTestLALSimulationPython.py +++ b/lalsimulation/swig/SWIGTestLALSimulationPython.py @@ -9,6 +9,13 @@ from lalsimulation import globalvar as lalsimulationglobalvar from lal import globalvar as lalglobalvar print("PASSED module load") +# set error handlers +def set_nice_error_handlers(): + lal.swig_set_nice_error_handlers() +def set_default_error_handlers(): + lal.swig_set_nasty_error_handlers() +set_default_error_handlers() + # check object parent tracking print("checking object parent tracking ...") a = lalsimulation.swig_lalsimulation_test_parent_map_struct() -- GitLab