Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to c++11 #27

Merged
merged 5 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tests/PythonQtTestMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion tests/PythonQtTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
7 changes: 6 additions & 1 deletion tests/PythonQtTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T>
class PtrRegistry {
public:
Expand All @@ -85,9 +87,12 @@ class PtrRegistry {
}

private:
static inline QList<T*> _objects;
static QList<T*> _objects;
};

template<typename T>
QList<T*> PtrRegistry<T>::_objects;

//! test the PythonQt api
class PythonQtTestApi : public QObject
{
Expand Down
Loading