CI: Refactor gen_travis.py
The CI consolidation project adds more operating systems to Travis. This refactoring is aimed to decouple the configuration of each individual OS from the actual job matrix generation and formatting. Otherwise, format_job function would turn into a huge collection of ad-hoc conditions.
This commit is contained in:
parent
7dcf77809c
commit
d9bbf539ff
127
.travis.yml
127
.travis.yml
@ -1,17 +1,15 @@
|
||||
|
||||
# This config file is generated by ./scripts/gen_travis.py.
|
||||
# Do not edit by hand.
|
||||
|
||||
language: generic
|
||||
dist: focal
|
||||
|
||||
matrix:
|
||||
jobs:
|
||||
include:
|
||||
- os: linux
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: amd64
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes"
|
||||
@ -53,57 +51,6 @@ matrix:
|
||||
- os: linux
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: amd64
|
||||
addons: *gcc_multilib
|
||||
@ -313,18 +260,76 @@ matrix:
|
||||
- os: linux
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
arch: ppc64le
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-lg-page=16" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
- os: osx
|
||||
arch: amd64
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds -Wno-unknown-warning-option -Wno-ignored-attributes -Wno-deprecated-declarations"
|
||||
# Development build
|
||||
- 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"
|
||||
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --disable-cache-oblivious --enable-stats --enable-log --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
# --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"
|
||||
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug --enable-experimental-smallocx --enable-stats --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
|
||||
|
||||
before_script:
|
||||
- autoconf
|
||||
- scripts/gen_travis.py > travis_script && diff .travis.yml travis_script
|
||||
- ./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS" } $CONFIGURE_FLAGS
|
||||
# If COMPILER_FLAGS are not empty, add them to CC and CXX
|
||||
- ./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS"} $CONFIGURE_FLAGS
|
||||
- make -j3
|
||||
- make -j3 tests
|
||||
|
||||
|
@ -1,22 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from itertools import combinations
|
||||
from itertools import combinations, chain
|
||||
from enum import Enum, auto
|
||||
|
||||
|
||||
LINUX = 'linux'
|
||||
OSX = 'osx'
|
||||
|
||||
|
||||
AMD64 = 'amd64'
|
||||
ARM64 = 'arm64'
|
||||
PPC64LE = 'ppc64le'
|
||||
|
||||
|
||||
TRAVIS_TEMPLATE = """
|
||||
# This config file is generated by ./scripts/gen_travis.py.
|
||||
# Do not edit by hand.
|
||||
|
||||
travis_template = """\
|
||||
language: generic
|
||||
dist: focal
|
||||
|
||||
matrix:
|
||||
jobs:
|
||||
include:
|
||||
%s
|
||||
{jobs}
|
||||
|
||||
before_script:
|
||||
- autoconf
|
||||
- scripts/gen_travis.py > travis_script && diff .travis.yml travis_script
|
||||
- ./configure ${COMPILER_FLAGS:+ \
|
||||
CC="$CC $COMPILER_FLAGS" \
|
||||
CXX="$CXX $COMPILER_FLAGS" } \
|
||||
$CONFIGURE_FLAGS
|
||||
# If COMPILER_FLAGS are not empty, add them to CC and CXX
|
||||
- ./configure ${{COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" \
|
||||
CXX="$CXX $COMPILER_FLAGS"}} $CONFIGURE_FLAGS
|
||||
- make -j3
|
||||
- make -j3 tests
|
||||
|
||||
@ -24,6 +37,39 @@ script:
|
||||
- make check
|
||||
"""
|
||||
|
||||
|
||||
class Option(object):
|
||||
class Type:
|
||||
COMPILER = auto()
|
||||
COMPILER_FLAG = auto()
|
||||
CONFIGURE_FLAG = auto()
|
||||
MALLOC_CONF = auto()
|
||||
|
||||
def __init__(self, type, value):
|
||||
self.type = type
|
||||
self.value = value
|
||||
|
||||
@staticmethod
|
||||
def as_compiler(value):
|
||||
return Option(Option.Type.COMPILER, value)
|
||||
|
||||
@staticmethod
|
||||
def as_compiler_flag(value):
|
||||
return Option(Option.Type.COMPILER_FLAG, value)
|
||||
|
||||
@staticmethod
|
||||
def as_configure_flag(value):
|
||||
return Option(Option.Type.CONFIGURE_FLAG, value)
|
||||
|
||||
@staticmethod
|
||||
def as_malloc_conf(value):
|
||||
return Option(Option.Type.MALLOC_CONF, value)
|
||||
|
||||
def __eq__(self, obj):
|
||||
return (isinstance(obj, Option) and obj.type == self.type
|
||||
and obj.value == self.value)
|
||||
|
||||
|
||||
# The 'default' configuration is gcc, on linux, with no compiler or configure
|
||||
# flags. We also test with clang, -m32, --enable-debug, --enable-prof,
|
||||
# --disable-stats, and --with-malloc-conf=tcache:false. To avoid abusing
|
||||
@ -32,84 +78,80 @@ script:
|
||||
# hope that bugs involving interactions of such settings are rare.
|
||||
MAX_UNUSUAL_OPTIONS = 2
|
||||
|
||||
os_default = 'linux'
|
||||
os_unusual = 'osx'
|
||||
|
||||
arch_default = 'amd64'
|
||||
arch_unusual = 'ppc64le'
|
||||
GCC = Option.as_compiler('CC=gcc CXX=g++')
|
||||
CLANG = Option.as_compiler('CC=clang CXX=clang++')
|
||||
|
||||
compilers_default = 'CC=gcc CXX=g++'
|
||||
compilers_unusual = 'CC=clang CXX=clang++'
|
||||
|
||||
compiler_flag_unusuals = ['-m32']
|
||||
compiler_default = GCC
|
||||
compilers_unusual = [CLANG,]
|
||||
|
||||
configure_flag_unusuals = [
|
||||
|
||||
compiler_flag_unusuals = [Option.as_compiler_flag(opt) for opt in ('-m32',)]
|
||||
|
||||
|
||||
configure_flag_unusuals = [Option.as_configure_flag(opt) for opt in (
|
||||
'--enable-debug',
|
||||
'--enable-prof',
|
||||
'--disable-stats',
|
||||
'--disable-libdl',
|
||||
'--enable-opt-safety-checks',
|
||||
'--with-lg-page=16',
|
||||
]
|
||||
)]
|
||||
|
||||
malloc_conf_unusuals = [
|
||||
|
||||
malloc_conf_unusuals = [Option.as_malloc_conf(opt) for opt in (
|
||||
'tcache:false',
|
||||
'dss:primary',
|
||||
'percpu_arena:percpu',
|
||||
'background_thread:true',
|
||||
]
|
||||
)]
|
||||
|
||||
all_unusuals = (
|
||||
[os_unusual] + [arch_unusual] + [compilers_unusual] + compiler_flag_unusuals
|
||||
+ configure_flag_unusuals + malloc_conf_unusuals
|
||||
)
|
||||
|
||||
unusual_combinations_to_test = []
|
||||
for i in range(MAX_UNUSUAL_OPTIONS + 1):
|
||||
unusual_combinations_to_test += combinations(all_unusuals, i)
|
||||
all_unusuals = (compilers_unusual + compiler_flag_unusuals
|
||||
+ configure_flag_unusuals + malloc_conf_unusuals)
|
||||
|
||||
|
||||
gcc_multilib_set = False
|
||||
gcc_ppc_set = False
|
||||
|
||||
|
||||
def get_extra_cflags(os, compiler):
|
||||
# We get some spurious errors when -Warray-bounds is enabled.
|
||||
extra_cflags = ['-Werror', '-Wno-array-bounds']
|
||||
if compiler == CLANG.value or os == OSX:
|
||||
extra_cflags += [
|
||||
'-Wno-unknown-warning-option',
|
||||
'-Wno-ignored-attributes'
|
||||
]
|
||||
if os == OSX:
|
||||
extra_cflags += [
|
||||
'-Wno-deprecated-declarations',
|
||||
]
|
||||
return extra_cflags
|
||||
|
||||
|
||||
# Formats a job from a combination of flags
|
||||
def format_job(combination):
|
||||
def format_job(os, arch, combination):
|
||||
global gcc_multilib_set
|
||||
global gcc_ppc_set
|
||||
|
||||
os = os_unusual if os_unusual in combination else os_default
|
||||
compilers = compilers_unusual if compilers_unusual in combination else compilers_default
|
||||
arch = arch_unusual if arch_unusual in combination else arch_default
|
||||
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]
|
||||
compiler = [x.value for x in combination if x.type == Option.Type.COMPILER]
|
||||
assert(len(compiler) <= 1)
|
||||
if not compiler:
|
||||
compiler = compiler_default.value
|
||||
else:
|
||||
compiler = compiler[0]
|
||||
compiler_flags = [x.value for x in combination if x.type == Option.Type.COMPILER_FLAG]
|
||||
configure_flags = [x.value for x in combination if x.type == Option.Type.CONFIGURE_FLAG]
|
||||
malloc_conf = [x.value for x in combination if x.type == Option.Type.MALLOC_CONF]
|
||||
|
||||
# Filter out unsupported configurations on OS X.
|
||||
if os == 'osx' and ('dss:primary' in malloc_conf or \
|
||||
'percpu_arena:percpu' in malloc_conf or 'background_thread:true' \
|
||||
in malloc_conf):
|
||||
return ""
|
||||
# gcc is just a redirect to clang on OS X. No need to test both.
|
||||
if os == 'osx' and compilers_unusual in combination:
|
||||
return ""
|
||||
if len(malloc_conf) > 0:
|
||||
configure_flags.append('--with-malloc-conf=' + ",".join(malloc_conf))
|
||||
|
||||
# Filter out an unsupported configuration - heap profiling on OS X.
|
||||
if os == 'osx' and '--enable-prof' in configure_flags:
|
||||
return ""
|
||||
|
||||
# Filter out unsupported OSX configuration on PPC64LE
|
||||
if arch == 'ppc64le' and (
|
||||
os == 'osx'
|
||||
or '-m32' in combination
|
||||
or compilers_unusual in combination
|
||||
):
|
||||
return ""
|
||||
configure_flags.append('--with-malloc-conf=' + ','.join(malloc_conf))
|
||||
|
||||
job = ""
|
||||
job += ' - os: %s\n' % os
|
||||
job += ' arch: %s\n' % arch
|
||||
job += ' - os: {}\n'.format(os)
|
||||
job += ' arch: {}\n'.format(arch)
|
||||
|
||||
if '-m32' in combination and os == 'linux':
|
||||
if '-m32' in compiler_flags and os == 'linux':
|
||||
job += ' addons:'
|
||||
if gcc_multilib_set:
|
||||
job += ' *gcc_multilib\n'
|
||||
@ -121,63 +163,99 @@ def format_job(combination):
|
||||
job += ' - g++-multilib\n'
|
||||
gcc_multilib_set = True
|
||||
|
||||
# We get some spurious errors when -Warray-bounds is enabled.
|
||||
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',
|
||||
]
|
||||
env_string = ('{} COMPILER_FLAGS="{}" CONFIGURE_FLAGS="{}" '
|
||||
'EXTRA_CFLAGS="{}"'.format(
|
||||
compilers, ' '.join(compiler_flags), ' '.join(configure_flags),
|
||||
' '.join(extra_cflags)))
|
||||
compiler,
|
||||
' '.join(compiler_flags),
|
||||
' '.join(configure_flags),
|
||||
' '.join(get_extra_cflags(os, compiler))))
|
||||
|
||||
job += ' env: %s\n' % env_string
|
||||
job += ' env: {}'.format(env_string)
|
||||
return job
|
||||
|
||||
include_rows = ""
|
||||
for combination in unusual_combinations_to_test:
|
||||
include_rows += format_job(combination)
|
||||
|
||||
# Development build
|
||||
include_rows += '''\
|
||||
def generate_unusual_combinations(max_unusual_opts):
|
||||
"""
|
||||
Generates different combinations of non-standard compilers, compiler flags,
|
||||
configure flags and malloc_conf settings.
|
||||
|
||||
@param max_unusual_opts: Limit of unusual options per combination.
|
||||
"""
|
||||
return chain.from_iterable(
|
||||
[combinations(all_unusuals, i) for i in range(max_unusual_opts + 1)])
|
||||
|
||||
|
||||
def included(combination, exclude):
|
||||
"""
|
||||
Checks if the combination of options should be included in the Travis
|
||||
testing matrix.
|
||||
"""
|
||||
return not any(excluded in combination for excluded in exclude)
|
||||
|
||||
|
||||
def generate_jobs(os, arch, exclude, max_unusual_opts):
|
||||
jobs = []
|
||||
for combination in generate_unusual_combinations(max_unusual_opts):
|
||||
if included(combination, exclude):
|
||||
jobs.append(format_job(os, arch, combination))
|
||||
return '\n'.join(jobs)
|
||||
|
||||
|
||||
def generate_linux(arch):
|
||||
os = LINUX
|
||||
|
||||
# Only generate 2 unusual options for AMD64 to reduce matrix size
|
||||
max_unusual_opts = MAX_UNUSUAL_OPTIONS if arch == AMD64 else 1
|
||||
|
||||
exclude = []
|
||||
if arch == PPC64LE:
|
||||
# Avoid 32 bit builds and clang on PowerPC
|
||||
exclude = [Option.as_compiler_flag('-m32')] + compilers_unusual
|
||||
|
||||
return generate_jobs(os, arch, exclude, max_unusual_opts)
|
||||
|
||||
|
||||
def generate_macos(arch):
|
||||
os = OSX
|
||||
|
||||
max_unusual_opts = 1
|
||||
|
||||
exclude = ([Option.as_malloc_conf(opt) for opt in (
|
||||
'dss:primary',
|
||||
'percpu_arena:percpu',
|
||||
'background_thread:true')] +
|
||||
[Option.as_configure_flag('--enable-prof')] +
|
||||
[CLANG,])
|
||||
|
||||
return generate_jobs(os, arch, exclude, max_unusual_opts)
|
||||
|
||||
|
||||
def get_manual_jobs():
|
||||
return """\
|
||||
# Development build
|
||||
- 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"
|
||||
'''
|
||||
|
||||
# Enable-expermental-smallocx
|
||||
include_rows += '''\
|
||||
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug \
|
||||
--disable-cache-oblivious --enable-stats --enable-log --enable-prof" \
|
||||
EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
# --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"
|
||||
'''
|
||||
env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug \
|
||||
--enable-experimental-smallocx --enable-stats --enable-prof" \
|
||||
EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
"""
|
||||
|
||||
# Does not seem to be working on newer travis machines. Valgrind has long been a
|
||||
# pain point; abandon it for now.
|
||||
# Valgrind build bots
|
||||
#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
|
||||
#'''
|
||||
|
||||
# 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
|
||||
def main():
|
||||
jobs = '\n'.join((
|
||||
generate_linux(AMD64),
|
||||
generate_linux(PPC64LE),
|
||||
|
||||
print(travis_template % include_rows)
|
||||
generate_macos(AMD64),
|
||||
get_manual_jobs()
|
||||
))
|
||||
|
||||
print(TRAVIS_TEMPLATE.format(jobs=jobs))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user