diff --git a/.github/build.sh b/.github/build.sh index 33a56ed3..b3ecfb45 100644 --- a/.github/build.sh +++ b/.github/build.sh @@ -47,7 +47,7 @@ case "${CC:-gcc}" in export PATH=$PATH:/Library/Developer/CommandLineTools/usr/bin fi llvm-profdata merge unittest.profraw -o unittest.profdata - llvm-profdata merge inttest.profraw -o inttest.profdata + llvm-profdata merge inttest.profraw* -o inttest.profdata llvm-cov show -show-line-counts-or-regions -instr-profile=unittest.profdata test/unittest_bin > unittest-cmake-coverage.txt llvm-cov show -show-line-counts-or-regions -instr-profile=inttest.profdata /usr/local/bin/znc > inttest-znc-coverage.txt find /usr/local/lib/znc -name '*.so' -or -name '*.bundle' | while read f; do llvm-cov show -show-line-counts-or-regions -instr-profile=inttest.profdata $f > inttest-$(basename $f)-coverage.txt; done diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 780a7fb6..827cdb86 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -102,6 +102,7 @@ add_custom_target(inttest COMMAND # znc-buildmod should use the correct compiler. # https://bugs.gentoo.org/699258 is an example of how it can go wrong. ${CMAKE_COMMAND} -E env MAKEFLAGS= CXX=${CMAKE_CXX_COMPILER} + "INTTEST_BIN=${CMAKE_CURRENT_BINARY_DIR}/integration/inttest" "${PROJECT_SOURCE_DIR}/third_party/gtest-parallel/gtest-parallel" - "${CMAKE_CURRENT_BINARY_DIR}/integration/inttest") + "${CMAKE_CURRENT_SOURCE_DIR}/integration/wrapper.py") add_dependencies(inttest inttest_bin) diff --git a/test/integration/tests/scripting.cpp b/test/integration/tests/scripting.cpp index 211c631d..86c3f950 100644 --- a/test/integration/tests/scripting.cpp +++ b/test/integration/tests/scripting.cpp @@ -159,6 +159,9 @@ TEST_F(ZNCTest, ModperlSocket) { TEST_F(ZNCTest, ModpythonUnixSocket) { #ifndef WANT_PYTHON GTEST_SKIP() << "Modpython is disabled"; +#endif +#ifdef __CYGWIN__ + GTEST_SKIP() << "Bug to fix: https://github.com/znc/znc/issues/1947"; #endif auto znc = Run(); znc->CanLeak(); @@ -207,6 +210,9 @@ TEST_F(ZNCTest, ModpythonUnixSocket) { TEST_F(ZNCTest, ModperlUnixSocket) { #ifndef WANT_PERL GTEST_SKIP() << "Modperl is disabled"; +#endif +#ifdef __CYGWIN__ + GTEST_SKIP() << "Bug to fix: https://github.com/znc/znc/issues/1947"; #endif auto znc = Run(); znc->CanLeak(); diff --git a/test/integration/wrapper.py b/test/integration/wrapper.py new file mode 100755 index 00000000..efa707a9 --- /dev/null +++ b/test/integration/wrapper.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2004-2025 ZNC, see the NOTICE file for details. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# The purpose of this file is to fix LLVM profiler data in the parallel +# execution of the test - all of them write to the same file, so it races and +# produces invalid data + +import os +import sys +import re + +test = '' +for arg in sys.argv: + m = re.match(r'--gtest_filter=(.*)', arg) + if m: + test = m[1] + break + +if test != '' and 'LLVM_PROFILE_FILE' in os.environ: + os.environ['LLVM_PROFILE_FILE'] += '.' + test + +binary = os.environ['INTTEST_BIN'] +sys.argv[0] = binary + +os.execv(binary, sys.argv)