mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
CI: restore JUnit output processing in Jenkinsfile
via wrapper which modifies the environment per test Workaround for https://github.com/google/gtest-parallel/pull/89
This commit is contained in:
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@@ -24,7 +24,7 @@ timestamps {
|
||||
}
|
||||
}
|
||||
stage('Integration test') {
|
||||
withEnv(['GTEST_OUTPUT=xml:integration-test.xml']) {
|
||||
withEnv(['GTEST_OUTPUT=xml:integration-XXX-test.xml']) {
|
||||
sh 'make install'
|
||||
sh 'make inttest'
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
49
test/integration/wrapper.py
Executable file
49
test/integration/wrapper.py
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/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 environment in the parallel execution of
|
||||
# the test with filenames of test results - otherwise all of them write to the
|
||||
# same file, so it races and produces invalid data
|
||||
|
||||
# See also: https://github.com/google/gtest-parallel/pull/89
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import random
|
||||
|
||||
flag = re.compile(r'--gtest_filter=(.*)')
|
||||
|
||||
test = ''
|
||||
for arg in sys.argv:
|
||||
m = flag.search(arg)
|
||||
if m:
|
||||
test = m[1]
|
||||
break
|
||||
|
||||
# TODO: perhaps it should be hash of test name instead?
|
||||
pid = os.getpid()
|
||||
rand = random.randint(0, 1000)
|
||||
value = f'{pid}-{rand}'
|
||||
for var in ['GTEST_OUTPUT']:
|
||||
if var in os.environ:
|
||||
os.environ[var] = os.environ[var].replace('XXX', value)
|
||||
|
||||
binary = os.environ['INTTEST_BIN']
|
||||
sys.argv[0] = binary
|
||||
|
||||
os.execv(binary, sys.argv)
|
||||
Reference in New Issue
Block a user