2021-06-22 05:07:10 +08:00
|
|
|
#!/usr/bin/env python3
|
2017-01-26 04:58:50 +08:00
|
|
|
|
|
|
|
from itertools import combinations
|
|
|
|
|
|
|
|
travis_template = """\
|
|
|
|
language: generic
|
2021-06-22 05:07:10 +08:00
|
|
|
dist: focal
|
2017-01-26 04:58:50 +08:00
|
|
|
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
%s
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- autoconf
|
2018-07-11 21:18:40 +08:00
|
|
|
- scripts/gen_travis.py > travis_script && diff .travis.yml travis_script
|
2017-01-26 04:58:50 +08:00
|
|
|
- ./configure ${COMPILER_FLAGS:+ \
|
|
|
|
CC="$CC $COMPILER_FLAGS" \
|
|
|
|
CXX="$CXX $COMPILER_FLAGS" } \
|
|
|
|
$CONFIGURE_FLAGS
|
|
|
|
- make -j3
|
|
|
|
- make -j3 tests
|
|
|
|
|
|
|
|
script:
|
|
|
|
- make check
|
|
|
|
"""
|
|
|
|
|
|
|
|
# The 'default' configuration is gcc, on linux, with no compiler or configure
|
|
|
|
# flags. We also test with clang, -m32, --enable-debug, --enable-prof,
|
2017-04-21 08:21:37 +08:00
|
|
|
# --disable-stats, and --with-malloc-conf=tcache:false. To avoid abusing
|
|
|
|
# travis though, we don't test all 2**7 = 128 possible combinations of these;
|
|
|
|
# instead, we only test combinations of up to 2 'unusual' settings, under the
|
|
|
|
# hope that bugs involving interactions of such settings are rare.
|
2017-01-26 04:58:50 +08:00
|
|
|
MAX_UNUSUAL_OPTIONS = 2
|
|
|
|
|
|
|
|
os_default = 'linux'
|
|
|
|
os_unusual = 'osx'
|
|
|
|
|
2020-09-11 16:07:10 +08:00
|
|
|
arch_default = 'amd64'
|
|
|
|
arch_unusual = 'ppc64le'
|
|
|
|
|
2017-01-26 04:58:50 +08:00
|
|
|
compilers_default = 'CC=gcc CXX=g++'
|
|
|
|
compilers_unusual = 'CC=clang CXX=clang++'
|
|
|
|
|
|
|
|
compiler_flag_unusuals = ['-m32']
|
|
|
|
|
|
|
|
configure_flag_unusuals = [
|
2017-04-21 08:21:37 +08:00
|
|
|
'--enable-debug',
|
|
|
|
'--enable-prof',
|
|
|
|
'--disable-stats',
|
2019-02-07 05:36:56 +08:00
|
|
|
'--disable-libdl',
|
2019-03-23 08:08:53 +08:00
|
|
|
'--enable-opt-safety-checks',
|
2019-09-12 01:31:30 +08:00
|
|
|
'--with-lg-page=16',
|
2017-05-23 08:15:57 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
malloc_conf_unusuals = [
|
|
|
|
'tcache:false',
|
|
|
|
'dss:primary',
|
2017-05-24 01:53:36 +08:00
|
|
|
'percpu_arena:percpu',
|
2017-06-01 02:56:31 +08:00
|
|
|
'background_thread:true',
|
2017-01-26 04:58:50 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
all_unusuals = (
|
2020-09-11 16:07:10 +08:00
|
|
|
[os_unusual] + [arch_unusual] + [compilers_unusual] + compiler_flag_unusuals
|
2017-05-23 08:15:57 +08:00
|
|
|
+ configure_flag_unusuals + malloc_conf_unusuals
|
2017-01-26 04:58:50 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
unusual_combinations_to_test = []
|
2021-06-22 05:07:10 +08:00
|
|
|
for i in range(MAX_UNUSUAL_OPTIONS + 1):
|
2017-01-26 04:58:50 +08:00
|
|
|
unusual_combinations_to_test += combinations(all_unusuals, i)
|
|
|
|
|
2018-07-10 20:41:20 +08:00
|
|
|
gcc_multilib_set = False
|
2020-09-11 16:07:10 +08:00
|
|
|
gcc_ppc_set = False
|
2018-07-10 20:41:20 +08:00
|
|
|
# Formats a job from a combination of flags
|
|
|
|
def format_job(combination):
|
|
|
|
global gcc_multilib_set
|
2020-09-11 16:07:10 +08:00
|
|
|
global gcc_ppc_set
|
2017-01-26 04:58:50 +08:00
|
|
|
|
2018-07-10 20:41:20 +08:00
|
|
|
os = os_unusual if os_unusual in combination else os_default
|
|
|
|
compilers = compilers_unusual if compilers_unusual in combination else compilers_default
|
2020-09-11 16:07:10 +08:00
|
|
|
arch = arch_unusual if arch_unusual in combination else arch_default
|
2018-07-10 20:41:20 +08:00
|
|
|
compiler_flags = [x for x in combination if x in compiler_flag_unusuals]
|
|
|
|
configure_flags = [x for x in combination if x in configure_flag_unusuals]
|
|
|
|
malloc_conf = [x for x in combination if x in malloc_conf_unusuals]
|
2017-01-26 04:58:50 +08:00
|
|
|
|
2017-05-24 01:53:36 +08:00
|
|
|
# Filter out unsupported configurations on OS X.
|
|
|
|
if os == 'osx' and ('dss:primary' in malloc_conf or \
|
2017-06-01 02:56:31 +08:00
|
|
|
'percpu_arena:percpu' in malloc_conf or 'background_thread:true' \
|
|
|
|
in malloc_conf):
|
2018-07-10 20:41:20 +08:00
|
|
|
return ""
|
2021-07-08 06:16:38 +08:00
|
|
|
# gcc is just a redirect to clang on OS X. No need to test both.
|
|
|
|
if os == 'osx' and compilers_unusual in combination:
|
|
|
|
return ""
|
2017-05-23 08:15:57 +08:00
|
|
|
if len(malloc_conf) > 0:
|
|
|
|
configure_flags.append('--with-malloc-conf=' + ",".join(malloc_conf))
|
|
|
|
|
2017-01-26 04:58:50 +08:00
|
|
|
# Filter out an unsupported configuration - heap profiling on OS X.
|
|
|
|
if os == 'osx' and '--enable-prof' in configure_flags:
|
2018-07-10 20:41:20 +08:00
|
|
|
return ""
|
2017-01-26 04:58:50 +08:00
|
|
|
|
2020-09-11 16:07:10 +08:00
|
|
|
# Filter out unsupported OSX configuration on PPC64LE
|
|
|
|
if arch == 'ppc64le' and (
|
|
|
|
os == 'osx'
|
|
|
|
or '-m32' in combination
|
|
|
|
or compilers_unusual in combination
|
|
|
|
):
|
|
|
|
return ""
|
2017-01-26 04:58:50 +08:00
|
|
|
|
2018-07-10 20:41:20 +08:00
|
|
|
job = ""
|
|
|
|
job += ' - os: %s\n' % os
|
2020-09-11 16:07:10 +08:00
|
|
|
job += ' arch: %s\n' % arch
|
|
|
|
|
2018-07-10 20:41:20 +08:00
|
|
|
if '-m32' in combination and os == 'linux':
|
|
|
|
job += ' addons:'
|
|
|
|
if gcc_multilib_set:
|
|
|
|
job += ' *gcc_multilib\n'
|
|
|
|
else:
|
|
|
|
job += ' &gcc_multilib\n'
|
|
|
|
job += ' apt:\n'
|
|
|
|
job += ' packages:\n'
|
|
|
|
job += ' - gcc-multilib\n'
|
2021-06-22 05:07:10 +08:00
|
|
|
job += ' - g++-multilib\n'
|
2018-07-10 20:41:20 +08:00
|
|
|
gcc_multilib_set = True
|
2020-09-11 16:07:10 +08:00
|
|
|
|
|
|
|
# We get some spurious errors when -Warray-bounds is enabled.
|
2021-06-22 05:07:10 +08:00
|
|
|
extra_cflags = ['-Werror', '-Wno-array-bounds']
|
|
|
|
if 'clang' in compilers or os == 'osx':
|
|
|
|
extra_cflags += [
|
|
|
|
'-Wno-unknown-warning-option',
|
|
|
|
'-Wno-ignored-attributes'
|
|
|
|
]
|
|
|
|
if os == 'osx':
|
|
|
|
extra_cflags += [
|
|
|
|
'-Wno-deprecated-declarations',
|
|
|
|
]
|
2020-09-11 16:07:10 +08:00
|
|
|
env_string = ('{} COMPILER_FLAGS="{}" CONFIGURE_FLAGS="{}" '
|
2021-06-22 05:07:10 +08:00
|
|
|
'EXTRA_CFLAGS="{}"'.format(
|
|
|
|
compilers, ' '.join(compiler_flags), ' '.join(configure_flags),
|
|
|
|
' '.join(extra_cflags)))
|
2020-09-11 16:07:10 +08:00
|
|
|
|
|
|
|
job += ' env: %s\n' % env_string
|
2018-07-10 20:41:20 +08:00
|
|
|
return job
|
|
|
|
|
|
|
|
include_rows = ""
|
|
|
|
for combination in unusual_combinations_to_test:
|
|
|
|
include_rows += format_job(combination)
|
|
|
|
|
|
|
|
# Development build
|
|
|
|
include_rows += '''\
|
2018-07-10 19:58:37 +08:00
|
|
|
# Development build
|
2018-07-10 20:41:20 +08:00
|
|
|
- os: linux
|
|
|
|
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-cache-oblivious --enable-stats --enable-log --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
|
|
|
'''
|
2017-01-26 04:58:50 +08:00
|
|
|
|
2018-07-11 21:11:53 +08:00
|
|
|
# Enable-expermental-smallocx
|
|
|
|
include_rows += '''\
|
|
|
|
# --enable-expermental-smallocx:
|
|
|
|
- os: linux
|
|
|
|
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --enable-experimental-smallocx --enable-stats --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
|
|
|
'''
|
|
|
|
|
2021-06-22 05:07:10 +08:00
|
|
|
# Does not seem to be working on newer travis machines. Valgrind has long been a
|
|
|
|
# pain point; abandon it for now.
|
2018-07-10 19:58:37 +08:00
|
|
|
# Valgrind build bots
|
2021-06-22 05:07:10 +08:00
|
|
|
#include_rows += '''
|
|
|
|
# # Valgrind
|
|
|
|
# - os: linux
|
|
|
|
# arch: amd64
|
|
|
|
# env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" JEMALLOC_TEST_PREFIX="valgrind"
|
|
|
|
# addons:
|
|
|
|
# apt:
|
|
|
|
# packages:
|
|
|
|
# - valgrind
|
|
|
|
#'''
|
2018-07-10 19:58:37 +08:00
|
|
|
|
|
|
|
# To enable valgrind on macosx add:
|
|
|
|
#
|
|
|
|
# - os: osx
|
|
|
|
# env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" JEMALLOC_TEST_PREFIX="valgrind"
|
|
|
|
# install: brew install valgrind
|
|
|
|
#
|
|
|
|
# It currently fails due to: https://github.com/jemalloc/jemalloc/issues/1274
|
|
|
|
|
2021-06-22 05:07:10 +08:00
|
|
|
print(travis_template % include_rows)
|