diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:40:55 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:40:55 +0100 |
| commit | 5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda (patch) | |
| tree | 1acdfa5220cd13b7be43a2a01368e80d306473ca /examples/redis-unstable/deps/jemalloc/scripts | |
| parent | c7ab12bba64d9c20ccd79b132dac475f7bc3923e (diff) | |
| download | crep-5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda.tar.gz | |
Add Redis source code for testing
Diffstat (limited to 'examples/redis-unstable/deps/jemalloc/scripts')
10 files changed, 627 insertions, 0 deletions
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/check-formatting.sh b/examples/redis-unstable/deps/jemalloc/scripts/check-formatting.sh new file mode 100755 index 0000000..68cafd8 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/check-formatting.sh | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # The files that need to be properly formatted. We'll grow this incrementally | ||
| 4 | # until it includes all the jemalloc source files (as we convert things over), | ||
| 5 | # and then just replace it with | ||
| 6 | # find -name '*.c' -o -name '*.h' -o -name '*.cpp | ||
| 7 | FILES=( | ||
| 8 | ) | ||
| 9 | |||
| 10 | if command -v clang-format &> /dev/null; then | ||
| 11 | CLANG_FORMAT="clang-format" | ||
| 12 | elif command -v clang-format-8 &> /dev/null; then | ||
| 13 | CLANG_FORMAT="clang-format-8" | ||
| 14 | else | ||
| 15 | echo "Couldn't find clang-format." | ||
| 16 | fi | ||
| 17 | |||
| 18 | if ! $CLANG_FORMAT -version | grep "version 8\." &> /dev/null; then | ||
| 19 | echo "clang-format is the wrong version." | ||
| 20 | exit 1 | ||
| 21 | fi | ||
| 22 | |||
| 23 | for file in ${FILES[@]}; do | ||
| 24 | if ! cmp --silent $file <($CLANG_FORMAT $file) &> /dev/null; then | ||
| 25 | echo "Error: $file is not clang-formatted" | ||
| 26 | exit 1 | ||
| 27 | fi | ||
| 28 | done | ||
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/freebsd/before_install.sh b/examples/redis-unstable/deps/jemalloc/scripts/freebsd/before_install.sh new file mode 100644 index 0000000..f2bee32 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/freebsd/before_install.sh | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #!/bin/tcsh | ||
| 2 | |||
| 3 | su -m root -c 'pkg install -y git' | ||
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/freebsd/before_script.sh b/examples/redis-unstable/deps/jemalloc/scripts/freebsd/before_script.sh new file mode 100644 index 0000000..29406f6 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/freebsd/before_script.sh | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #!/bin/tcsh | ||
| 2 | |||
| 3 | autoconf | ||
| 4 | # We don't perfectly track freebsd stdlib.h definitions. This is fine when | ||
| 5 | # we count as a system header, but breaks otherwise, like during these | ||
| 6 | # tests. | ||
| 7 | ./configure --with-jemalloc-prefix=ci_ ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS"} $CONFIGURE_FLAGS | ||
| 8 | JE_NCPUS=`sysctl -n kern.smp.cpus` | ||
| 9 | gmake -j${JE_NCPUS} | ||
| 10 | gmake -j${JE_NCPUS} tests | ||
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/freebsd/script.sh b/examples/redis-unstable/deps/jemalloc/scripts/freebsd/script.sh new file mode 100644 index 0000000..d9c53a2 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/freebsd/script.sh | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #!/bin/tcsh | ||
| 2 | |||
| 3 | gmake check | ||
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/gen_run_tests.py b/examples/redis-unstable/deps/jemalloc/scripts/gen_run_tests.py new file mode 100755 index 0000000..7c3075f --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/gen_run_tests.py | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | |||
| 3 | import sys | ||
| 4 | from itertools import combinations | ||
| 5 | from os import uname | ||
| 6 | from multiprocessing import cpu_count | ||
| 7 | from subprocess import call | ||
| 8 | |||
| 9 | # Later, we want to test extended vaddr support. Apparently, the "real" way of | ||
| 10 | # checking this is flaky on OS X. | ||
| 11 | bits_64 = sys.maxsize > 2**32 | ||
| 12 | |||
| 13 | nparallel = cpu_count() * 2 | ||
| 14 | |||
| 15 | uname = uname()[0] | ||
| 16 | |||
| 17 | if call("command -v gmake", shell=True) == 0: | ||
| 18 | make_cmd = 'gmake' | ||
| 19 | else: | ||
| 20 | make_cmd = 'make' | ||
| 21 | |||
| 22 | def powerset(items): | ||
| 23 | result = [] | ||
| 24 | for i in range(len(items) + 1): | ||
| 25 | result += combinations(items, i) | ||
| 26 | return result | ||
| 27 | |||
| 28 | possible_compilers = [] | ||
| 29 | for cc, cxx in (['gcc', 'g++'], ['clang', 'clang++']): | ||
| 30 | try: | ||
| 31 | cmd_ret = call([cc, "-v"]) | ||
| 32 | if cmd_ret == 0: | ||
| 33 | possible_compilers.append((cc, cxx)) | ||
| 34 | except: | ||
| 35 | pass | ||
| 36 | possible_compiler_opts = [ | ||
| 37 | '-m32', | ||
| 38 | ] | ||
| 39 | possible_config_opts = [ | ||
| 40 | '--enable-debug', | ||
| 41 | '--enable-prof', | ||
| 42 | '--disable-stats', | ||
| 43 | '--enable-opt-safety-checks', | ||
| 44 | '--with-lg-page=16', | ||
| 45 | ] | ||
| 46 | if bits_64: | ||
| 47 | possible_config_opts.append('--with-lg-vaddr=56') | ||
| 48 | |||
| 49 | possible_malloc_conf_opts = [ | ||
| 50 | 'tcache:false', | ||
| 51 | 'dss:primary', | ||
| 52 | 'percpu_arena:percpu', | ||
| 53 | 'background_thread:true', | ||
| 54 | ] | ||
| 55 | |||
| 56 | print('set -e') | ||
| 57 | print('if [ -f Makefile ] ; then %(make_cmd)s relclean ; fi' % {'make_cmd': | ||
| 58 | make_cmd}) | ||
| 59 | print('autoconf') | ||
| 60 | print('rm -rf run_tests.out') | ||
| 61 | print('mkdir run_tests.out') | ||
| 62 | print('cd run_tests.out') | ||
| 63 | |||
| 64 | ind = 0 | ||
| 65 | for cc, cxx in possible_compilers: | ||
| 66 | for compiler_opts in powerset(possible_compiler_opts): | ||
| 67 | for config_opts in powerset(possible_config_opts): | ||
| 68 | for malloc_conf_opts in powerset(possible_malloc_conf_opts): | ||
| 69 | if cc == 'clang' \ | ||
| 70 | and '-m32' in possible_compiler_opts \ | ||
| 71 | and '--enable-prof' in config_opts: | ||
| 72 | continue | ||
| 73 | config_line = ( | ||
| 74 | 'EXTRA_CFLAGS=-Werror EXTRA_CXXFLAGS=-Werror ' | ||
| 75 | + 'CC="{} {}" '.format(cc, " ".join(compiler_opts)) | ||
| 76 | + 'CXX="{} {}" '.format(cxx, " ".join(compiler_opts)) | ||
| 77 | + '../../configure ' | ||
| 78 | + " ".join(config_opts) + (' --with-malloc-conf=' + | ||
| 79 | ",".join(malloc_conf_opts) if len(malloc_conf_opts) > 0 | ||
| 80 | else '') | ||
| 81 | ) | ||
| 82 | |||
| 83 | # We don't want to test large vaddr spaces in 32-bit mode. | ||
| 84 | if ('-m32' in compiler_opts and '--with-lg-vaddr=56' in | ||
| 85 | config_opts): | ||
| 86 | continue | ||
| 87 | |||
| 88 | # Per CPU arenas are only supported on Linux. | ||
| 89 | linux_supported = ('percpu_arena:percpu' in malloc_conf_opts \ | ||
| 90 | or 'background_thread:true' in malloc_conf_opts) | ||
| 91 | # Heap profiling and dss are not supported on OS X. | ||
| 92 | darwin_unsupported = ('--enable-prof' in config_opts or \ | ||
| 93 | 'dss:primary' in malloc_conf_opts) | ||
| 94 | if (uname == 'Linux' and linux_supported) \ | ||
| 95 | or (not linux_supported and (uname != 'Darwin' or \ | ||
| 96 | not darwin_unsupported)): | ||
| 97 | print("""cat <<EOF > run_test_%(ind)d.sh | ||
| 98 | #!/bin/sh | ||
| 99 | |||
| 100 | set -e | ||
| 101 | |||
| 102 | abort() { | ||
| 103 | echo "==> Error" >> run_test.log | ||
| 104 | echo "Error; see run_tests.out/run_test_%(ind)d.out/run_test.log" | ||
| 105 | exit 255 # Special exit code tells xargs to terminate. | ||
| 106 | } | ||
| 107 | |||
| 108 | # Environment variables are not supported. | ||
| 109 | run_cmd() { | ||
| 110 | echo "==> \$@" >> run_test.log | ||
| 111 | \$@ >> run_test.log 2>&1 || abort | ||
| 112 | } | ||
| 113 | |||
| 114 | echo "=> run_test_%(ind)d: %(config_line)s" | ||
| 115 | mkdir run_test_%(ind)d.out | ||
| 116 | cd run_test_%(ind)d.out | ||
| 117 | |||
| 118 | echo "==> %(config_line)s" >> run_test.log | ||
| 119 | %(config_line)s >> run_test.log 2>&1 || abort | ||
| 120 | |||
| 121 | run_cmd %(make_cmd)s all tests | ||
| 122 | run_cmd %(make_cmd)s check | ||
| 123 | run_cmd %(make_cmd)s distclean | ||
| 124 | EOF | ||
| 125 | chmod 755 run_test_%(ind)d.sh""" % {'ind': ind, 'config_line': config_line, | ||
| 126 | 'make_cmd': make_cmd}) | ||
| 127 | ind += 1 | ||
| 128 | |||
| 129 | print('for i in `seq 0 %(last_ind)d` ; do echo run_test_${i}.sh ; done | xargs' | ||
| 130 | ' -P %(nparallel)d -n 1 sh' % {'last_ind': ind-1, 'nparallel': nparallel}) | ||
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/gen_travis.py b/examples/redis-unstable/deps/jemalloc/scripts/gen_travis.py new file mode 100755 index 0000000..4366a06 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/gen_travis.py | |||
| @@ -0,0 +1,327 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | |||
| 3 | from itertools import combinations, chain | ||
| 4 | from enum import Enum, auto | ||
| 5 | |||
| 6 | |||
| 7 | LINUX = 'linux' | ||
| 8 | OSX = 'osx' | ||
| 9 | WINDOWS = 'windows' | ||
| 10 | FREEBSD = 'freebsd' | ||
| 11 | |||
| 12 | |||
| 13 | AMD64 = 'amd64' | ||
| 14 | ARM64 = 'arm64' | ||
| 15 | PPC64LE = 'ppc64le' | ||
| 16 | |||
| 17 | |||
| 18 | TRAVIS_TEMPLATE = """\ | ||
| 19 | # This config file is generated by ./scripts/gen_travis.py. | ||
| 20 | # Do not edit by hand. | ||
| 21 | |||
| 22 | # We use 'minimal', because 'generic' makes Windows VMs hang at startup. Also | ||
| 23 | # the software provided by 'generic' is simply not needed for our tests. | ||
| 24 | # Differences are explained here: | ||
| 25 | # https://docs.travis-ci.com/user/languages/minimal-and-generic/ | ||
| 26 | language: minimal | ||
| 27 | dist: focal | ||
| 28 | |||
| 29 | jobs: | ||
| 30 | include: | ||
| 31 | {jobs} | ||
| 32 | |||
| 33 | before_install: | ||
| 34 | - |- | ||
| 35 | if test -f "./scripts/$TRAVIS_OS_NAME/before_install.sh"; then | ||
| 36 | source ./scripts/$TRAVIS_OS_NAME/before_install.sh | ||
| 37 | fi | ||
| 38 | |||
| 39 | before_script: | ||
| 40 | - |- | ||
| 41 | if test -f "./scripts/$TRAVIS_OS_NAME/before_script.sh"; then | ||
| 42 | source ./scripts/$TRAVIS_OS_NAME/before_script.sh | ||
| 43 | else | ||
| 44 | scripts/gen_travis.py > travis_script && diff .travis.yml travis_script | ||
| 45 | autoconf | ||
| 46 | # If COMPILER_FLAGS are not empty, add them to CC and CXX | ||
| 47 | ./configure ${{COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" \ | ||
| 48 | CXX="$CXX $COMPILER_FLAGS"}} $CONFIGURE_FLAGS | ||
| 49 | make -j3 | ||
| 50 | make -j3 tests | ||
| 51 | fi | ||
| 52 | |||
| 53 | script: | ||
| 54 | - |- | ||
| 55 | if test -f "./scripts/$TRAVIS_OS_NAME/script.sh"; then | ||
| 56 | source ./scripts/$TRAVIS_OS_NAME/script.sh | ||
| 57 | else | ||
| 58 | make check | ||
| 59 | fi | ||
| 60 | """ | ||
| 61 | |||
| 62 | |||
| 63 | class Option(object): | ||
| 64 | class Type: | ||
| 65 | COMPILER = auto() | ||
| 66 | COMPILER_FLAG = auto() | ||
| 67 | CONFIGURE_FLAG = auto() | ||
| 68 | MALLOC_CONF = auto() | ||
| 69 | FEATURE = auto() | ||
| 70 | |||
| 71 | def __init__(self, type, value): | ||
| 72 | self.type = type | ||
| 73 | self.value = value | ||
| 74 | |||
| 75 | @staticmethod | ||
| 76 | def as_compiler(value): | ||
| 77 | return Option(Option.Type.COMPILER, value) | ||
| 78 | |||
| 79 | @staticmethod | ||
| 80 | def as_compiler_flag(value): | ||
| 81 | return Option(Option.Type.COMPILER_FLAG, value) | ||
| 82 | |||
| 83 | @staticmethod | ||
| 84 | def as_configure_flag(value): | ||
| 85 | return Option(Option.Type.CONFIGURE_FLAG, value) | ||
| 86 | |||
| 87 | @staticmethod | ||
| 88 | def as_malloc_conf(value): | ||
| 89 | return Option(Option.Type.MALLOC_CONF, value) | ||
| 90 | |||
| 91 | @staticmethod | ||
| 92 | def as_feature(value): | ||
| 93 | return Option(Option.Type.FEATURE, value) | ||
| 94 | |||
| 95 | def __eq__(self, obj): | ||
| 96 | return (isinstance(obj, Option) and obj.type == self.type | ||
| 97 | and obj.value == self.value) | ||
| 98 | |||
| 99 | |||
| 100 | # The 'default' configuration is gcc, on linux, with no compiler or configure | ||
| 101 | # flags. We also test with clang, -m32, --enable-debug, --enable-prof, | ||
| 102 | # --disable-stats, and --with-malloc-conf=tcache:false. To avoid abusing | ||
| 103 | # travis though, we don't test all 2**7 = 128 possible combinations of these; | ||
| 104 | # instead, we only test combinations of up to 2 'unusual' settings, under the | ||
| 105 | # hope that bugs involving interactions of such settings are rare. | ||
| 106 | MAX_UNUSUAL_OPTIONS = 2 | ||
| 107 | |||
| 108 | |||
| 109 | GCC = Option.as_compiler('CC=gcc CXX=g++') | ||
| 110 | CLANG = Option.as_compiler('CC=clang CXX=clang++') | ||
| 111 | CL = Option.as_compiler('CC=cl.exe CXX=cl.exe') | ||
| 112 | |||
| 113 | |||
| 114 | compilers_unusual = [CLANG,] | ||
| 115 | |||
| 116 | |||
| 117 | CROSS_COMPILE_32BIT = Option.as_feature('CROSS_COMPILE_32BIT') | ||
| 118 | feature_unusuals = [CROSS_COMPILE_32BIT] | ||
| 119 | |||
| 120 | |||
| 121 | configure_flag_unusuals = [Option.as_configure_flag(opt) for opt in ( | ||
| 122 | '--enable-debug', | ||
| 123 | '--enable-prof', | ||
| 124 | '--disable-stats', | ||
| 125 | '--disable-libdl', | ||
| 126 | '--enable-opt-safety-checks', | ||
| 127 | '--with-lg-page=16', | ||
| 128 | )] | ||
| 129 | |||
| 130 | |||
| 131 | malloc_conf_unusuals = [Option.as_malloc_conf(opt) for opt in ( | ||
| 132 | 'tcache:false', | ||
| 133 | 'dss:primary', | ||
| 134 | 'percpu_arena:percpu', | ||
| 135 | 'background_thread:true', | ||
| 136 | )] | ||
| 137 | |||
| 138 | |||
| 139 | all_unusuals = (compilers_unusual + feature_unusuals | ||
| 140 | + configure_flag_unusuals + malloc_conf_unusuals) | ||
| 141 | |||
| 142 | |||
| 143 | def get_extra_cflags(os, compiler): | ||
| 144 | if os == FREEBSD: | ||
| 145 | return [] | ||
| 146 | |||
| 147 | if os == WINDOWS: | ||
| 148 | # For non-CL compilers under Windows (for now it's only MinGW-GCC), | ||
| 149 | # -fcommon needs to be specified to correctly handle multiple | ||
| 150 | # 'malloc_conf' symbols and such, which are declared weak under Linux. | ||
| 151 | # Weak symbols don't work with MinGW-GCC. | ||
| 152 | if compiler != CL.value: | ||
| 153 | return ['-fcommon'] | ||
| 154 | else: | ||
| 155 | return [] | ||
| 156 | |||
| 157 | # We get some spurious errors when -Warray-bounds is enabled. | ||
| 158 | extra_cflags = ['-Werror', '-Wno-array-bounds'] | ||
| 159 | if compiler == CLANG.value or os == OSX: | ||
| 160 | extra_cflags += [ | ||
| 161 | '-Wno-unknown-warning-option', | ||
| 162 | '-Wno-ignored-attributes' | ||
| 163 | ] | ||
| 164 | if os == OSX: | ||
| 165 | extra_cflags += [ | ||
| 166 | '-Wno-deprecated-declarations', | ||
| 167 | ] | ||
| 168 | return extra_cflags | ||
| 169 | |||
| 170 | |||
| 171 | # Formats a job from a combination of flags | ||
| 172 | def format_job(os, arch, combination): | ||
| 173 | compilers = [x.value for x in combination if x.type == Option.Type.COMPILER] | ||
| 174 | assert(len(compilers) <= 1) | ||
| 175 | compiler_flags = [x.value for x in combination if x.type == Option.Type.COMPILER_FLAG] | ||
| 176 | configure_flags = [x.value for x in combination if x.type == Option.Type.CONFIGURE_FLAG] | ||
| 177 | malloc_conf = [x.value for x in combination if x.type == Option.Type.MALLOC_CONF] | ||
| 178 | features = [x.value for x in combination if x.type == Option.Type.FEATURE] | ||
| 179 | |||
| 180 | if len(malloc_conf) > 0: | ||
| 181 | configure_flags.append('--with-malloc-conf=' + ','.join(malloc_conf)) | ||
| 182 | |||
| 183 | if not compilers: | ||
| 184 | compiler = GCC.value | ||
| 185 | else: | ||
| 186 | compiler = compilers[0] | ||
| 187 | |||
| 188 | extra_environment_vars = '' | ||
| 189 | cross_compile = CROSS_COMPILE_32BIT.value in features | ||
| 190 | if os == LINUX and cross_compile: | ||
| 191 | compiler_flags.append('-m32') | ||
| 192 | |||
| 193 | features_str = ' '.join([' {}=yes'.format(feature) for feature in features]) | ||
| 194 | |||
| 195 | stringify = lambda arr, name: ' {}="{}"'.format(name, ' '.join(arr)) if arr else '' | ||
| 196 | env_string = '{}{}{}{}{}{}'.format( | ||
| 197 | compiler, | ||
| 198 | features_str, | ||
| 199 | stringify(compiler_flags, 'COMPILER_FLAGS'), | ||
| 200 | stringify(configure_flags, 'CONFIGURE_FLAGS'), | ||
| 201 | stringify(get_extra_cflags(os, compiler), 'EXTRA_CFLAGS'), | ||
| 202 | extra_environment_vars) | ||
| 203 | |||
| 204 | job = ' - os: {}\n'.format(os) | ||
| 205 | job += ' arch: {}\n'.format(arch) | ||
| 206 | job += ' env: {}'.format(env_string) | ||
| 207 | return job | ||
| 208 | |||
| 209 | |||
| 210 | def generate_unusual_combinations(unusuals, max_unusual_opts): | ||
| 211 | """ | ||
| 212 | Generates different combinations of non-standard compilers, compiler flags, | ||
| 213 | configure flags and malloc_conf settings. | ||
| 214 | |||
| 215 | @param max_unusual_opts: Limit of unusual options per combination. | ||
| 216 | """ | ||
| 217 | return chain.from_iterable( | ||
| 218 | [combinations(unusuals, i) for i in range(max_unusual_opts + 1)]) | ||
| 219 | |||
| 220 | |||
| 221 | def included(combination, exclude): | ||
| 222 | """ | ||
| 223 | Checks if the combination of options should be included in the Travis | ||
| 224 | testing matrix. | ||
| 225 | |||
| 226 | @param exclude: A list of options to be avoided. | ||
| 227 | """ | ||
| 228 | return not any(excluded in combination for excluded in exclude) | ||
| 229 | |||
| 230 | |||
| 231 | def generate_jobs(os, arch, exclude, max_unusual_opts, unusuals=all_unusuals): | ||
| 232 | jobs = [] | ||
| 233 | for combination in generate_unusual_combinations(unusuals, max_unusual_opts): | ||
| 234 | if included(combination, exclude): | ||
| 235 | jobs.append(format_job(os, arch, combination)) | ||
| 236 | return '\n'.join(jobs) | ||
| 237 | |||
| 238 | |||
| 239 | def generate_linux(arch): | ||
| 240 | os = LINUX | ||
| 241 | |||
| 242 | # Only generate 2 unusual options for AMD64 to reduce matrix size | ||
| 243 | max_unusual_opts = MAX_UNUSUAL_OPTIONS if arch == AMD64 else 1 | ||
| 244 | |||
| 245 | exclude = [] | ||
| 246 | if arch == PPC64LE: | ||
| 247 | # Avoid 32 bit builds and clang on PowerPC | ||
| 248 | exclude = (CROSS_COMPILE_32BIT, CLANG,) | ||
| 249 | |||
| 250 | return generate_jobs(os, arch, exclude, max_unusual_opts) | ||
| 251 | |||
| 252 | |||
| 253 | def generate_macos(arch): | ||
| 254 | os = OSX | ||
| 255 | |||
| 256 | max_unusual_opts = 1 | ||
| 257 | |||
| 258 | exclude = ([Option.as_malloc_conf(opt) for opt in ( | ||
| 259 | 'dss:primary', | ||
| 260 | 'percpu_arena:percpu', | ||
| 261 | 'background_thread:true')] + | ||
| 262 | [Option.as_configure_flag('--enable-prof')] + | ||
| 263 | [CLANG,]) | ||
| 264 | |||
| 265 | return generate_jobs(os, arch, exclude, max_unusual_opts) | ||
| 266 | |||
| 267 | |||
| 268 | def generate_windows(arch): | ||
| 269 | os = WINDOWS | ||
| 270 | |||
| 271 | max_unusual_opts = 3 | ||
| 272 | unusuals = ( | ||
| 273 | Option.as_configure_flag('--enable-debug'), | ||
| 274 | CL, | ||
| 275 | CROSS_COMPILE_32BIT, | ||
| 276 | ) | ||
| 277 | return generate_jobs(os, arch, (), max_unusual_opts, unusuals) | ||
| 278 | |||
| 279 | |||
| 280 | def generate_freebsd(arch): | ||
| 281 | os = FREEBSD | ||
| 282 | |||
| 283 | max_unusual_opts = 4 | ||
| 284 | unusuals = ( | ||
| 285 | Option.as_configure_flag('--enable-debug'), | ||
| 286 | Option.as_configure_flag('--enable-prof --enable-prof-libunwind'), | ||
| 287 | Option.as_configure_flag('--with-lg-page=16 --with-malloc-conf=tcache:false'), | ||
| 288 | CROSS_COMPILE_32BIT, | ||
| 289 | ) | ||
| 290 | return generate_jobs(os, arch, (), max_unusual_opts, unusuals) | ||
| 291 | |||
| 292 | |||
| 293 | |||
| 294 | def get_manual_jobs(): | ||
| 295 | return """\ | ||
| 296 | # Development build | ||
| 297 | - os: linux | ||
| 298 | env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug \ | ||
| 299 | --disable-cache-oblivious --enable-stats --enable-log --enable-prof" \ | ||
| 300 | EXTRA_CFLAGS="-Werror -Wno-array-bounds" | ||
| 301 | # --enable-expermental-smallocx: | ||
| 302 | - os: linux | ||
| 303 | env: CC=gcc CXX=g++ CONFIGURE_FLAGS="--enable-debug \ | ||
| 304 | --enable-experimental-smallocx --enable-stats --enable-prof" \ | ||
| 305 | EXTRA_CFLAGS="-Werror -Wno-array-bounds" | ||
| 306 | """ | ||
| 307 | |||
| 308 | |||
| 309 | def main(): | ||
| 310 | jobs = '\n'.join(( | ||
| 311 | generate_windows(AMD64), | ||
| 312 | |||
| 313 | generate_freebsd(AMD64), | ||
| 314 | |||
| 315 | generate_linux(AMD64), | ||
| 316 | generate_linux(PPC64LE), | ||
| 317 | |||
| 318 | generate_macos(AMD64), | ||
| 319 | |||
| 320 | get_manual_jobs(), | ||
| 321 | )) | ||
| 322 | |||
| 323 | print(TRAVIS_TEMPLATE.format(jobs=jobs)) | ||
| 324 | |||
| 325 | |||
| 326 | if __name__ == '__main__': | ||
| 327 | main() | ||
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/linux/before_install.sh b/examples/redis-unstable/deps/jemalloc/scripts/linux/before_install.sh new file mode 100644 index 0000000..6741746 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/linux/before_install.sh | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | set -ev | ||
| 4 | |||
| 5 | if [[ "$TRAVIS_OS_NAME" != "linux" ]]; then | ||
| 6 | echo "Incorrect \$TRAVIS_OS_NAME: expected linux, got $TRAVIS_OS_NAME" | ||
| 7 | exit 1 | ||
| 8 | fi | ||
| 9 | |||
| 10 | if [[ "$CROSS_COMPILE_32BIT" == "yes" ]]; then | ||
| 11 | sudo apt-get update | ||
| 12 | sudo apt-get -y install gcc-multilib g++-multilib | ||
| 13 | fi | ||
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/windows/before_install.sh b/examples/redis-unstable/deps/jemalloc/scripts/windows/before_install.sh new file mode 100644 index 0000000..2740c45 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/windows/before_install.sh | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | set -e | ||
| 4 | |||
| 5 | # The purpose of this script is to install build dependencies and set | ||
| 6 | # $build_env to a function that sets appropriate environment variables, | ||
| 7 | # to enable (mingw32|mingw64) environment if we want to compile with gcc, or | ||
| 8 | # (mingw32|mingw64) + vcvarsall.bat if we want to compile with cl.exe | ||
| 9 | |||
| 10 | if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then | ||
| 11 | echo "Incorrect \$TRAVIS_OS_NAME: expected windows, got $TRAVIS_OS_NAME" | ||
| 12 | exit 1 | ||
| 13 | fi | ||
| 14 | |||
| 15 | [[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64 | ||
| 16 | choco uninstall -y mingw | ||
| 17 | choco upgrade --no-progress -y msys2 | ||
| 18 | |||
| 19 | msys_shell_cmd="cmd //C RefreshEnv.cmd && set MSYS=winsymlinks:nativestrict && C:\\tools\\msys64\\msys2_shell.cmd" | ||
| 20 | |||
| 21 | msys2() { $msys_shell_cmd -defterm -no-start -msys2 -c "$*"; } | ||
| 22 | mingw32() { $msys_shell_cmd -defterm -no-start -mingw32 -c "$*"; } | ||
| 23 | mingw64() { $msys_shell_cmd -defterm -no-start -mingw64 -c "$*"; } | ||
| 24 | |||
| 25 | if [[ "$CROSS_COMPILE_32BIT" == "yes" ]]; then | ||
| 26 | mingw=mingw32 | ||
| 27 | mingw_gcc_package_arch=i686 | ||
| 28 | else | ||
| 29 | mingw=mingw64 | ||
| 30 | mingw_gcc_package_arch=x86_64 | ||
| 31 | fi | ||
| 32 | |||
| 33 | if [[ "$CC" == *"gcc"* ]]; then | ||
| 34 | $mingw pacman -S --noconfirm --needed \ | ||
| 35 | autotools \ | ||
| 36 | git \ | ||
| 37 | mingw-w64-${mingw_gcc_package_arch}-make \ | ||
| 38 | mingw-w64-${mingw_gcc_package_arch}-gcc \ | ||
| 39 | mingw-w64-${mingw_gcc_package_arch}-binutils | ||
| 40 | build_env=$mingw | ||
| 41 | elif [[ "$CC" == *"cl"* ]]; then | ||
| 42 | $mingw pacman -S --noconfirm --needed \ | ||
| 43 | autotools \ | ||
| 44 | git \ | ||
| 45 | mingw-w64-${mingw_gcc_package_arch}-make \ | ||
| 46 | mingw-w64-${mingw_gcc_package_arch}-binutils | ||
| 47 | |||
| 48 | # In order to use MSVC compiler (cl.exe), we need to correctly set some environment | ||
| 49 | # variables, namely PATH, INCLUDE, LIB and LIBPATH. The correct values of these | ||
| 50 | # variables are set by a batch script "vcvarsall.bat". The code below generates | ||
| 51 | # a batch script that calls "vcvarsall.bat" and prints the environment variables. | ||
| 52 | # | ||
| 53 | # Then, those environment variables are transformed from cmd to bash format and put | ||
| 54 | # into a script $apply_vsenv. If cl.exe needs to be used from bash, one can | ||
| 55 | # 'source $apply_vsenv' and it will apply the environment variables needed for cl.exe | ||
| 56 | # to be located and function correctly. | ||
| 57 | # | ||
| 58 | # At last, a function "mingw_with_msvc_vars" is generated which forwards user input | ||
| 59 | # into a correct mingw (32 or 64) subshell that automatically performs 'source $apply_vsenv', | ||
| 60 | # making it possible for autotools to discover and use cl.exe. | ||
| 61 | vcvarsall="vcvarsall.tmp.bat" | ||
| 62 | echo "@echo off" > $vcvarsall | ||
| 63 | echo "call \"c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\\\vcvarsall.bat\" $USE_MSVC" >> $vcvarsall | ||
| 64 | echo "set" >> $vcvarsall | ||
| 65 | |||
| 66 | apply_vsenv="./apply_vsenv.sh" | ||
| 67 | cmd //C $vcvarsall | grep -E "^PATH=" | sed -n -e 's/\(.*\)=\(.*\)/export \1=$PATH:"\2"/g' \ | ||
| 68 | -e 's/\([a-zA-Z]\):[\\\/]/\/\1\//g' \ | ||
| 69 | -e 's/\\/\//g' \ | ||
| 70 | -e 's/;\//:\//gp' > $apply_vsenv | ||
| 71 | cmd //C $vcvarsall | grep -E "^(INCLUDE|LIB|LIBPATH)=" | sed -n -e 's/\(.*\)=\(.*\)/export \1="\2"/gp' >> $apply_vsenv | ||
| 72 | |||
| 73 | cat $apply_vsenv | ||
| 74 | mingw_with_msvc_vars() { $msys_shell_cmd -defterm -no-start -$mingw -c "source $apply_vsenv && ""$*"; } | ||
| 75 | build_env=mingw_with_msvc_vars | ||
| 76 | |||
| 77 | rm -f $vcvarsall | ||
| 78 | else | ||
| 79 | echo "Unknown C compiler: $CC" | ||
| 80 | exit 1 | ||
| 81 | fi | ||
| 82 | |||
| 83 | echo "Build environment function: $build_env" | ||
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/windows/before_script.sh b/examples/redis-unstable/deps/jemalloc/scripts/windows/before_script.sh new file mode 100644 index 0000000..9d30aba --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/windows/before_script.sh | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | set -e | ||
| 4 | |||
| 5 | if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then | ||
| 6 | echo "Incorrect \$TRAVIS_OS_NAME: expected windows, got $TRAVIS_OS_NAME" | ||
| 7 | exit 1 | ||
| 8 | fi | ||
| 9 | |||
| 10 | $build_env autoconf | ||
| 11 | $build_env ./configure $CONFIGURE_FLAGS | ||
| 12 | # mingw32-make simply means "make", unrelated to mingw32 vs mingw64. | ||
| 13 | # Simply disregard the prefix and treat is as "make". | ||
| 14 | $build_env mingw32-make -j3 | ||
| 15 | # At the moment, it's impossible to make tests in parallel, | ||
| 16 | # seemingly due to concurrent writes to '.pdb' file. I don't know why | ||
| 17 | # that happens, because we explicitly supply '/Fs' to the compiler. | ||
| 18 | # Until we figure out how to fix it, we should build tests sequentially | ||
| 19 | # on Windows. | ||
| 20 | $build_env mingw32-make tests | ||
diff --git a/examples/redis-unstable/deps/jemalloc/scripts/windows/script.sh b/examples/redis-unstable/deps/jemalloc/scripts/windows/script.sh new file mode 100644 index 0000000..3a27f70 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/scripts/windows/script.sh | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | set -e | ||
| 4 | |||
| 5 | if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then | ||
| 6 | echo "Incorrect \$TRAVIS_OS_NAME: expected windows, got $TRAVIS_OS_NAME" | ||
| 7 | exit 1 | ||
| 8 | fi | ||
| 9 | |||
| 10 | $build_env mingw32-make -k check | ||
