diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-05-03 11:33:01 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-05-03 11:33:01 +0300 |
commit | 850000492cd43e40109b3a11c8613b5fff577755 (patch) | |
tree | 0297fff124fbdf18a5cb125d0391561129ce46ef /tests | |
parent | e15ffff6b808d2b60c08f2a4401ff35a3dc37bb7 (diff) | |
download | sciteco-850000492cd43e40109b3a11c8613b5fff577755.tar.gz |
fixed teco_doc_undo_exchange(): use reference counting now
* When popping from the Q-Register stack to local Q-Registers in macro calls,
problems would arise when rubbing out that macro call since we would eventually restore
a pointer that has been permanently freed along with the local Q-Registers.
* Naturally this could result in everything from Valgrind warnings to crashes.
* Added test case.
* There is still a test case that fails when run under `--valgrind`,
but it's apparently due to a glib-internal memory leak.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testsuite.at | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/testsuite.at b/tests/testsuite.at index ab1154b..dabab92 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -1,6 +1,8 @@ AT_INIT AT_COLOR_TESTS +# Will usually be called as +# make chek TESTSUITEFLAGS=--valgrind AT_ARG_OPTION([valgrind], AS_HELP_STRING([--valgrind], [Run tests under Valgrind (memcheck)])) @@ -10,7 +12,7 @@ AT_ARG_OPTION([valgrind], # idiom "(0/0)" to enforce a "Division by zero" error # whenever we want to fail. # -# NOTE: Square brackets are significant for M4 but +# NOTE: Square brackets are the current quote characters for M4 but # often required in TECO code as well. # We therefore use double brackets [[ ... ]] # (translated to [ ... ]) in simple cases where balanced @@ -18,6 +20,11 @@ AT_ARG_OPTION([valgrind], # quadrigraphs (@<:@ and @:>@) in all other cases. # Single round brackets also have to be replaced with the # quadrigraphs @{:@ and @:}@. +# +# FIXME: Can we use changequote() to simplify that or will it +# confuse all of Autotest's macros? +# We might also write new M4 macros that care about +# shell escaping (or writing out all test cases into files). AT_BANNER([Language features]) @@ -375,6 +382,14 @@ AT_CHECK([$SCITECO_CMDLINE '0@W{-D}C'], 0, ignore, stderr) AT_FAIL_IF([! $GREP "^Error:" stderr]) AT_CLEANUP +AT_SETUP([Rub out stack operations in macro calls]) +# This was causing memory corruptions, that would at least show up under Valgrind. +AT_CHECK([$SCITECO_CMDLINE '@^Um{[[.a]].b}Mm{-2D}'], 0, ignore, stderr) +AT_FAIL_IF([$GREP "^Error:" stderr]) +AT_CHECK([$SCITECO_CMDLINE '[[.a@^Um{]].b}Mm{-2D}'], 0, ignore, stderr) +AT_FAIL_IF([$GREP "^Error:" stderr]) +AT_CLEANUP + AT_SETUP([Searches from macro calls]) AT_CHECK([$SCITECO_CMDLINE "@^Um{:@S/XXX/} :Mm\"S(0/0)' Mm\"S(0/0)'"], 0, ignore, stderr) AT_FAIL_IF([$GREP "^Error:" stderr]) |