From 1a8e22d813efd749c5467edd7d10073f4d441611 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 Aug 2021 14:39:43 +0200 Subject: [PATCH 1/6] Rename self-hosted Mac CI workflow file for consistency Call this file consistently with the other CI files and also ignore all of the other files in each workflow to avoid unnecessary rebuilds. Finally, remove a leftover mention of Travis file which doesn't exist any longer. --- .github/workflows/ci.yml | 4 ++-- .github/workflows/ci_cmake.yml | 2 ++ .../{MacS-M1-make.yml => ci_mac_selfhosted.yml} | 10 +++++++--- .github/workflows/ci_msw_cross.yml | 4 ++++ 4 files changed, 15 insertions(+), 5 deletions(-) rename .github/workflows/{MacS-M1-make.yml => ci_mac_selfhosted.yml} (95%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b25dbf588a..6ad5ef60e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: branches: - master paths-ignore: - - '.github/workflows/MacS-M1-make.yml' + - '.github/workflows/ci_mac_selfhosted.yml' - '.github/workflows/ci_cmake.yml' - '.github/workflows/ci_msw_cross.yml' - 'build/tools/appveyor*.bat' @@ -24,7 +24,7 @@ on: branches: - master paths-ignore: - - '.github/workflows/MacS-M1-make.yml' + - '.github/workflows/ci_mac_selfhosted.yml' - '.github/workflows/ci_cmake.yml' - '.github/workflows/ci_msw_cross.yml' - 'build/tools/appveyor*.bat' diff --git a/.github/workflows/ci_cmake.yml b/.github/workflows/ci_cmake.yml index 1e3ad23fd0..2a5e599db7 100644 --- a/.github/workflows/ci_cmake.yml +++ b/.github/workflows/ci_cmake.yml @@ -7,6 +7,7 @@ on: - master paths-ignore: - '.github/workflows/ci.yml' + - '.github/workflows/ci_mac_selfhosted.yml' - '.github/workflows/ci_msw_cross.yml' - 'build/tools/appveyor*.bat' - 'distrib/**' @@ -24,6 +25,7 @@ on: - master paths-ignore: - '.github/workflows/ci.yml' + - '.github/workflows/ci_mac_selfhosted.yml' - '.github/workflows/ci_msw_cross.yml' - 'build/tools/appveyor*.bat' - 'distrib/**' diff --git a/.github/workflows/MacS-M1-make.yml b/.github/workflows/ci_mac_selfhosted.yml similarity index 95% rename from .github/workflows/MacS-M1-make.yml rename to .github/workflows/ci_mac_selfhosted.yml index 55d16fe8a3..bb4acfca44 100644 --- a/.github/workflows/MacS-M1-make.yml +++ b/.github/workflows/ci_mac_selfhosted.yml @@ -1,12 +1,14 @@ -name: Mac make CI +name: Mac builds on: workflow_dispatch: push: branches: [ master ] paths-ignore: + - '.github/workflows/ci.yml' + - '.github/workflows/ci_cmake.yml' + - '.github/workflows/ci_msw_cross.yml' - 'build/tools/appveyor*.bat' - - 'build/tools/travis-ci.sh' - 'distrib/**' - 'docs/**' - 'interface/**' @@ -30,8 +32,10 @@ on: pull_request: branches: [ master ] paths-ignore: + - '.github/workflows/ci.yml' + - '.github/workflows/ci_cmake.yml' + - '.github/workflows/ci_msw_cross.yml' - 'build/tools/appveyor*.bat' - - 'build/tools/travis-ci.sh' - 'distrib/**' - 'docs/**' - 'interface/**' diff --git a/.github/workflows/ci_msw_cross.yml b/.github/workflows/ci_msw_cross.yml index 8b6043fed4..88ea846a2d 100644 --- a/.github/workflows/ci_msw_cross.yml +++ b/.github/workflows/ci_msw_cross.yml @@ -7,6 +7,8 @@ on: - master paths-ignore: - '.github/workflows/ci.yml' + - '.github/workflows/ci_cmake.yml' + - '.github/workflows/ci_mac_selfhosted.yml' - 'build/tools/appveyor*.bat' - 'distrib/**' - 'docs/**' @@ -25,6 +27,8 @@ on: - master paths-ignore: - '.github/workflows/ci.yml' + - '.github/workflows/ci_cmake.yml' + - '.github/workflows/ci_mac_selfhosted.yml' - 'build/tools/appveyor*.bat' - 'distrib/**' - 'docs/**' From cc3c8367111b2310bfb710a73a3d274e8cde1017 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 Aug 2021 14:55:58 +0200 Subject: [PATCH 2/6] Fix tests build with wxDEBUG_LEVEL==0 Define various macros used in the test code (or in the headers included from it) as nothing when wxDEBUG_LEVEL==0. Also don't define a helper function used when asserts are enabled in this build to avoid clang warnings about unused function. --- include/wx/debug.h | 2 ++ tests/misc/misctests.cpp | 4 ++++ tests/testprec.h | 1 + 3 files changed, 7 insertions(+) diff --git a/include/wx/debug.h b/include/wx/debug.h index c9e78c6f9f..a56d266e5c 100644 --- a/include/wx/debug.h +++ b/include/wx/debug.h @@ -331,6 +331,8 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file, #define wxFAIL #define wxFAIL_MSG(msg) #define wxFAIL_COND_MSG(cond, msg) + #define wxFAIL_MSG_AT(msg, file, line, func) + #define wxFAIL_COND_MSG_AT(cond, msg, file, line, func) #endif // wxDEBUG_LEVEL #if wxDEBUG_LEVEL >= 2 diff --git a/tests/misc/misctests.cpp b/tests/misc/misctests.cpp index 7ec98633b8..ddd7063a69 100644 --- a/tests/misc/misctests.cpp +++ b/tests/misc/misctests.cpp @@ -125,6 +125,8 @@ void MiscTestCase::Delete() namespace { +#ifdef __WXDEBUG__ + // helper function used just to avoid warnings about value computed not being // used in WX_ASSERT_FAILS_WITH_ASSERT() in StaticCast() below bool IsNull(void *p) @@ -132,6 +134,8 @@ bool IsNull(void *p) return p == NULL; } +#endif // __WXDEBUG__ + } // anonymous namespace void MiscTestCase::StaticCast() diff --git a/tests/testprec.h b/tests/testprec.h index d3340eff03..1dcaa0a289 100644 --- a/tests/testprec.h +++ b/tests/testprec.h @@ -128,6 +128,7 @@ public: // normal build with wxDEBUG_LEVEL != 0 we can pass something not // evaluating to a bool at all but it then would fail to compile in // wxDEBUG_LEVEL == 0 case, so just don't do anything at all now). + #define WX_ASSERT_FAILS_WITH_ASSERT_MESSAGE(msg, code) #define WX_ASSERT_FAILS_WITH_ASSERT(cond) #endif From 6f3be7ab262b60fbb84532325c51b79368e815d5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 Aug 2021 14:41:02 +0200 Subject: [PATCH 3/6] Reduce the number of Mac CI builds and add a universal one Don't run 8 builds for all combinations of arch/debug/C++ dialect but just a few of them covering all of the possibilities. Also add a static universal build which is what is commonly used for distributing software using wxWidgets under Mac. --- .github/workflows/ci_mac_selfhosted.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci_mac_selfhosted.yml b/.github/workflows/ci_mac_selfhosted.yml index bb4acfca44..b2bcf10372 100644 --- a/.github/workflows/ci_mac_selfhosted.yml +++ b/.github/workflows/ci_mac_selfhosted.yml @@ -65,26 +65,24 @@ jobs: runs-on: self-hosted - name: ${{ matrix.build }}, arch ${{ matrix.arch }}, cxx${{ matrix.cxx }} + name: ${{ matrix.name }} strategy: fail-fast: false matrix: - arch: [arm64e, x86_64] - build: [debug, release] - cxx: [11, 17] include: - - build: debug - configure_flags: --without-liblzma --enable-debug --disable-sys-libs --with-osx_cocoa - - build: release - configure_flags: --without-liblzma --disable-sys-libs --with-osx_cocoa - - cxx: 17 - cxxconfig: --with-macosx-version-min=10.12 - - cxx: 11 - cxxconfig: + - name: ARM C++11 + arch: arm64 + configure_flags: --with-cxx=11 --disable-debug + - name: Intel C++17 + arch: x86_64 + configure_flags: --with-cxx=17 --with-macosx-version-min=10.12 --enable-debug + - name: Universal C++14 + arch: arm64 + configure_flags: --with-cxx=14 --enable-universal_binary=arm64,x86_64 --disable-shared --disable-debug env: - wxCONFIGURE_FLAGS: ${{ matrix.configure_flags }} ${{ matrix.cxxconfig }} --with-cxx=${{ matrix.cxx }} --prefix=${{ github.workspace }}/localbin_${{ matrix.arch }} + wxCONFIGURE_FLAGS: --disable-sys-libs --without-liblzma ${{ matrix.configure_flags }} --prefix=${{ github.workspace }}/localbin_${{ matrix.arch }} DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer NSUnbufferedIO: YES From 95a337349dacf00137e309a4b3ca6f3c14450ed6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 Aug 2021 15:25:17 +0200 Subject: [PATCH 4/6] Report errors in wxTestingModalHook in non-debug builds too wxFAIL_MSG_AT() does nothing in these builds, so do at least something else -- even if it's not ideal, it's still better than doing nothing. --- include/wx/testing.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/wx/testing.h b/include/wx/testing.h index 317040130b..63d578f004 100644 --- a/include/wx/testing.h +++ b/include/wx/testing.h @@ -34,6 +34,10 @@ class WXDLLIMPEXP_FWD_CORE wxFileDialogBase; #include "wx/msgdlg.h" #include "wx/filedlg.h" +#ifndef __WXDEBUG__ + #include "wx/crt.h" +#endif // !__WXDEBUG__ + #include class wxTestingModalHook; @@ -421,10 +425,20 @@ protected: // course, can itself be customized. virtual void ReportFailure(const wxString& msg) { +#ifdef __WXDEBUG__ wxFAIL_MSG_AT( msg, m_file ? m_file : __FILE__, m_line ? m_line : __LINE__, m_func ? m_func : __WXFUNCTION__ ); +#else // !__WXDEBUG__ + // We still need to report the failure somehow when wx asserts are + // disabled. + wxFprintf(stderr, wxASCII_STR("%s at %s:%d in %s()\n"), + msg, + wxASCII_STR(m_file ? m_file : __FILE__), + m_line ? m_line : __LINE__, + wxASCII_STR(m_func ? m_func : __WXFUNCTION__)); +#endif // __WXDEBUG__/!__WXDEBUG__ } private: From 1c0258e5d6e2c41e3ada52bb7fa6cc809e8f3e7d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 Aug 2021 15:43:44 +0200 Subject: [PATCH 5/6] Make wxMSW CI builds name more consistent with the other ones No real changes, this is purely cosmetic. --- .github/workflows/ci_msw_cross.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_msw_cross.yml b/.github/workflows/ci_msw_cross.yml index 88ea846a2d..d8e6041f81 100644 --- a/.github/workflows/ci_msw_cross.yml +++ b/.github/workflows/ci_msw_cross.yml @@ -1,5 +1,5 @@ # CI workflow cross-building wxMSW under Linux. -name: wxMSW cross-build +name: MSW cross-builds on: push: From 4c2707d3dc3278b4d40c05acf3f97bf6ec967317 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 Aug 2021 16:17:26 +0200 Subject: [PATCH 6/6] Enable ASAN for the ARM M1 CI build Run the tests under ASAN to detect potential problems. Also enable optimizations for the universal build (overriding --disable-optimise used by default) to check that there are no problems with building wxWidgets for real production use. --- .github/workflows/ci_mac_selfhosted.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_mac_selfhosted.yml b/.github/workflows/ci_mac_selfhosted.yml index b2bcf10372..96dcc3ee54 100644 --- a/.github/workflows/ci_mac_selfhosted.yml +++ b/.github/workflows/ci_mac_selfhosted.yml @@ -73,16 +73,18 @@ jobs: include: - name: ARM C++11 arch: arm64 - configure_flags: --with-cxx=11 --disable-debug + configure_flags: --with-cxx=11 + use_asan: true - name: Intel C++17 arch: x86_64 configure_flags: --with-cxx=17 --with-macosx-version-min=10.12 --enable-debug - name: Universal C++14 arch: arm64 - configure_flags: --with-cxx=14 --enable-universal_binary=arm64,x86_64 --disable-shared --disable-debug + configure_flags: --with-cxx=14 --enable-universal_binary=arm64,x86_64 --disable-shared --disable-debug --enable-optimise env: wxCONFIGURE_FLAGS: --disable-sys-libs --without-liblzma ${{ matrix.configure_flags }} --prefix=${{ github.workspace }}/localbin_${{ matrix.arch }} + wxUSE_ASAN: ${{ matrix.use_asan && 1 || 0 }} DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer NSUnbufferedIO: YES @@ -134,6 +136,15 @@ jobs: run: | wxCONFIGURE_OPTIONS="--disable-optimise $wxCONFIGURE_FLAGS" ./configure $wxCONFIGURE_OPTIONS --disable-debug_info || rc=$? + if [ ${{ matrix.use_asan }} ]; then + wxASAN_CFLAGS="-fsanitize=address -fno-omit-frame-pointer" + wxASAN_CXXFLAGS=$wxASAN_CFLAGS + wxASAN_LDFLAGS="-fsanitize=address" + + ./configure $wxCONFIGURE_OPTIONS --enable-debug "CFLAGS=$wxASAN_CFLAGS" "CXXFLAGS=$wxASAN_CXXFLAGS" "LDFLAGS=$wxASAN_LDFLAGS" || rc=$? + else + ./configure $wxCONFIGURE_OPTIONS --disable-debug_info || rc=$? + fi if [ -n "$rc" ]; then echo '*** Configuring failed, contents of config.log follows: ***' echo '-----------------------------------------------------------'