diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53df056e..b87cf53c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,20 +71,20 @@ jobs: PYTHON_VERSION=$(python3 --version | cut -d " " -f 2 | cut -d "." -f1,2) \ PYTHON_DIR=$(which python3 | xargs dirname | xargs dirname) make -j $(nproc) - PYTHONDEVMODE=1 PYTHONASYNCIODEBUG=1 PYTHONWARNINGS=error PYTHONMALLOC=malloc_debug \ - UBSAN_OPTIONS="halt_on_error=1" ASAN_OPTIONS="detect_leaks=0:detect_stack_use_after_return=1:fast_unwind_on_malloc=0" \ - make check - - name: Run memory tests with sanitizers + - name: Run tests with sanitizers run: | QT_VERSION_FULL=$(qmake -query QT_VERSION) if [[ "$QT_VERSION_FULL" == 5.12* ]]; then echo "leak:QPlatformIntegrationFactory::create" >> $PWD/lsan.supp export LSAN_OPTIONS="suppressions=$PWD/lsan.supp" + export ASAN_OPTIONS="detect_leaks=0:detect_stack_use_after_return=1:fast_unwind_on_malloc=0" + fi + if [[ "$QT_VERSION_FULL" == 5.15* ]]; then + export ASAN_OPTIONS="detect_leaks=1:detect_stack_use_after_return=1:fast_unwind_on_malloc=0" fi PYTHONDEVMODE=1 PYTHONASYNCIODEBUG=1 PYTHONWARNINGS=error PYTHONMALLOC=malloc_debug \ - UBSAN_OPTIONS="halt_on_error=1" ASAN_OPTIONS="detect_leaks=1:detect_stack_use_after_return=1:fast_unwind_on_malloc=0" \ - PYTHONQT_RUN_ONLY_MEMORY_TESTS=1 \ + UBSAN_OPTIONS="halt_on_error=1" \ make check - name: Generate Wrappers diff --git a/tests/PythonQtTestMain.cpp b/tests/PythonQtTestMain.cpp index b50caefa..c0615e9a 100644 --- a/tests/PythonQtTestMain.cpp +++ b/tests/PythonQtTestMain.cpp @@ -73,7 +73,13 @@ int main( int argc, char **argv ) } PythonQt::preCleanup(); + +#if PY_VERSION_HEX < 0x03060000 + Py_Finalize(); +#else Py_FinalizeEx(); +#endif + PythonQt::cleanup(); if (failCount) { diff --git a/tests/PythonQtTests.cpp b/tests/PythonQtTests.cpp index f4c238e9..cf7e17c6 100644 --- a/tests/PythonQtTests.cpp +++ b/tests/PythonQtTests.cpp @@ -45,7 +45,11 @@ void PythonQtMemoryTests::cleanup() { if(PythonQt::self()) { PythonQt::preCleanup(); - Py_FinalizeEx(); +#if PY_VERSION_HEX < 0x03060000 + Py_Finalize(); +#else + Py_FinalizeEx(); +#endif PythonQt::cleanup(); } } diff --git a/tests/PythonQtTests.h b/tests/PythonQtTests.h index 2d259f7b..ddf928ac 100644 --- a/tests/PythonQtTests.h +++ b/tests/PythonQtTests.h @@ -72,6 +72,8 @@ private Q_SLOTS: void cleanup(); }; +// For the moment, it's not critical for tests; +// the main thing is to be able to build with the correct g++ and sanitizers. template class PtrRegistry { public: @@ -85,9 +87,12 @@ class PtrRegistry { } private: - static inline QList _objects; + static QList _objects; }; +template +QList PtrRegistry::_objects; + //! test the PythonQt api class PythonQtTestApi : public QObject {