1language: c
2
3matrix:
4  fast_finish: true
5  include:
6    # OS X Mavericks
7    - name: (macOS) General Test
8      os: osx
9      compiler: clang
10      script:
11        - make   # test library build
12        - make clean
13        - make test MOREFLAGS='-Werror -Wconversion -Wno-sign-conversion' | tee # test scenario where `stdout` is not the console
14
15    # Container-based 12.04 LTS Server Edition 64 bit (doesn't support 32-bit includes)
16    - name: (Precise) benchmark test
17      dist: precise
18      script:
19        - make -C tests test-lz4 test-lz4c test-fullbench
20
21    - name: (Precise) frame and fuzzer test
22      dist: precise
23      install:
24        - sudo sysctl -w vm.mmap_min_addr=4096
25      script:
26        - make -C tests test-frametest test-fuzzer
27
28    - name: ASAN tests with fuzzer and frametest
29      install:
30        - sudo sysctl -w vm.mmap_min_addr=4096
31      script:
32        - CC=clang MOREFLAGS=-fsanitize=address make -C tests test-frametest test-fuzzer
33
34    - name: Custom LZ4_DISTANCE_MAX ; lz4-wlib (CLI linked to dynamic library); LZ4_USER_MEMORY_FUNCTIONS
35      script:
36        - MOREFLAGS=-DLZ4_DISTANCE_MAX=8000 make check
37        - make clean
38        - make -C programs lz4-wlib
39        - make clean
40        - make -C tests fullbench-wmalloc  # test LZ4_USER_MEMORY_FUNCTIONS
41        - make clean
42        - CC="c++ -Wno-deprecated" make -C tests fullbench-wmalloc  # stricter function signature check
43
44    - name: (Precise) g++ and clang CMake test
45      dist: precise
46      script:
47        - make cxxtest
48        - make clean
49        - make examples
50        - make clean cmake
51        - make clean travis-install
52        - make clean clangtest
53
54    - name: x32 compatibility test
55      addons:
56        apt:
57          packages:
58            - gcc-multilib
59      script:
60        - make -C tests test MOREFLAGS=-mx32
61
62    # 14.04 LTS Server Edition 64 bit
63    # presume clang >= v3.9.0
64    - name: (Trusty) USan test
65      dist: trusty
66      compiler: clang
67      script:
68        - make usan MOREFLAGS=-Wcomma -Werror
69
70    - name: (Trusty) valgrind test
71      dist: trusty
72      install:
73        - sudo apt-get install -qq valgrind
74      script:
75        - make c_standards
76        - make -C tests test-lz4 test-mem
77
78    - name: (Trusty) c-to-c++ test
79      dist: trusty
80      script:
81        - make ctocpptest
82
83    - name: (Trusty) i386 benchmark + version test
84      dist: trusty
85      install:
86        - sudo apt-get install -qq python3 libc6-dev-i386 gcc-multilib
87      script:
88        - make -C tests test-lz4c32 test-fullbench32 versionsTest
89
90    - name: (Trusty) i386 frame + fuzzer test
91      dist: trusty
92      install:
93        - sudo apt-get install -qq libc6-dev-i386 gcc-multilib
94        - sudo sysctl -w vm.mmap_min_addr=4096
95      script:
96        - make -C tests test-frametest32 test-fuzzer32
97
98    - name: (Trusty) gcc-6 standard C compilation
99      dist: trusty
100      addons:
101        apt:
102          sources:
103            - ubuntu-toolchain-r-test
104          packages:
105            - gcc-6
106      env:
107        - CC=gcc-6
108      script:
109        - make c_standards
110        - make -C tests test-lz4 MOREFLAGS=-Werror
111
112    - name: (Trusty) arm + aarch64 compilation
113      dist: trusty
114      install:
115        - sudo apt-get install -qq
116            qemu-system-arm
117            qemu-user-static
118            gcc-arm-linux-gnueabi
119            libc6-dev-armel-cross
120            gcc-aarch64-linux-gnu
121            libc6-dev-arm64-cross
122      script:
123        - make platformTest CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static
124        - make platformTest CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static
125
126    - name: aarch64 real-hw tests
127      arch: arm64
128      script:
129        - make test
130
131    - name: PPC64LE real-hw tests
132      arch: ppc64le
133      script:
134        - make test
135
136    - name: IBM s390x real-hw tests
137      arch: s390x
138      script:
139        - make test
140
141    - name: (Xenial) gcc-5 compilation
142      dist: xenial
143      install:
144        - sudo apt-get install -qq libc6-dev-i386 gcc-multilib
145      script:
146        - make -C tests test-lz4 clean test-lz4c32 MOREFLAGS=-Werror
147
148    - name: (Trusty) clang-3.8 compilation
149      dist: trusty
150      addons:
151        apt:
152          sources:
153            - ubuntu-toolchain-r-test
154            - llvm-toolchain-precise-3.8
155          packages:
156            - clang-3.8
157      script:
158        - make -C tests test-lz4 CC=clang-3.8
159
160    - name: (Trusty) PowerPC + PPC64 compilation
161      dist: trusty
162      install:
163        - sudo apt-get install -qq qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu
164      script:
165        - make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static
166        - make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS=-m64
167
168    - name: (Trusty) scan-build + cppcheck
169      dist: trusty
170      compiler: clang
171      install:
172        - sudo apt-get install -qq cppcheck
173      script:
174        - make staticAnalyze
175        - make cppcheck
176
177    - name: (Trusty) gcc-4.4 compilation
178      dist: trusty
179      addons:
180        apt:
181          sources:
182            - ubuntu-toolchain-r-test
183          packages:
184            - libc6-dev-i386
185            - gcc-multilib
186            - gcc-4.4
187      script:
188        - make clean all CC=gcc-4.4 MOREFLAGS=-Werror
189        - make clean
190        - CFLAGS=-fPIC LDFLAGS='-pie -fPIE -D_FORTIFY_SOURCE=2' make -C programs
191
192    # tag-specific test
193    - name: tag build
194      if: tag =~ ^v[0-9]\.[0-9]
195      os: linux
196      script:
197        - make -C tests checkTag
198        - tests/checkTag "$TRAVIS_BRANCH"
199
200    - name: (Xenial) Meson + clang build
201      #env: ALLOW_FAILURES=true
202      dist: xenial
203      language: cpp
204      compiler: clang
205      install:
206        - sudo apt-get install -qq python3 tree
207        - |
208          travis_retry curl -o ~/ninja.zip -L 'https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip' &&
209          unzip ~/ninja.zip -d ~/.local/bin
210        - |
211          travis_retry curl -o ~/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' &&
212          python3 ~/get-pip.py --user &&
213          pip3 install --user meson
214      script:
215        - |
216          meson setup \
217            --buildtype=debug \
218            -Db_lundef=false \
219            -Dauto_features=enabled \
220            -Ddefault_library=both \
221            -Dbin_programs=true \
222            -Dbin_contrib=true \
223            -Dbin_tests=true \
224            -Dbin_examples=true \
225            contrib/meson build
226        - pushd build
227        - DESTDIR=./staging ninja install
228        - tree ./staging
229
230    # oss-fuzz compilation test
231    - name: Compile OSS-Fuzz targets
232      script:
233        - ./ossfuzz/travisoss.sh
234
235  allow_failures:
236    - env: ALLOW_FAILURES=true
237