Skip to content

Commit ad9d648

Browse files
authored
Merge pull request #1 from batfish/ari-travis
Modifications for batfish (READY FOR REVIEW)
2 parents 450f3c9 + f979613 commit ad9d648

15 files changed

+233
-213
lines changed

.travis.yml

+9-56
Original file line numberDiff line numberDiff line change
@@ -17,63 +17,14 @@ env:
1717
###############################################################################
1818
# Ubuntu 16.04 LTS
1919
###############################################################################
20-
# 64-bit UBSan Debug build
21-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/clang-3.9 CXX_COMPILER=/usr/bin/clang++-3.9 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=Debug UBSAN_BUILD=1 RUN_UNIT_TESTS=SKIP
22-
# 64-bit ASan Debug build
23-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/clang-3.9 CXX_COMPILER=/usr/bin/clang++-3.9 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=Debug ASAN_BUILD=1 RUN_UNIT_TESTS=SKIP ASAN_DSO=/usr/lib/clang/3.9/lib/linux/libclang_rt.asan-x86_64.so
24-
# Build for running unit tests under ASan/UBSan
25-
# FIXME: We should really be doing a debug build but the unit tests run too
26-
# slowly when we do that.
27-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/clang-3.9 CXX_COMPILER=/usr/bin/clang++-3.9 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=RelWithDebInfo ASAN_BUILD=1 RUN_UNIT_TESTS=BUILD_AND_RUN ASAN_DSO=/usr/lib/clang/3.9/lib/linux/libclang_rt.asan-x86_64.so UBSAN_BUILD=1 RUN_API_EXAMPLES=0 RUN_SYSTEM_TESTS=0 DOTNET_BINDINGS=0 JAVA_BINDINGS=0 PYTHON_BINDINGS=0
28-
29-
# 64-bit GCC 5.4 RelWithDebInfo
30-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/gcc-5 CXX_COMPILER=/usr/bin/g++-5 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=RelWithDebInfo
31-
# 64-bit Clang 3.9 RelWithDebInfo
32-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/clang-3.9 CXX_COMPILER=/usr/bin/clang++-3.9 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=RelWithDebInfo
33-
34-
# Debug builds
35-
#
36-
# Note the unit tests for the debug builds are compiled but **not**
37-
# executed. This is because the debug build of unit tests takes a large
38-
# amount of time to execute compared to the optimized builds. The hope is
39-
# that just running the optimized unit tests is sufficient.
40-
#
41-
# 64-bit GCC 5.4 Debug
42-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/gcc-5 CXX_COMPILER=/usr/bin/g++-5 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=Debug RUN_UNIT_TESTS=BUILD_ONLY
43-
# 64-bit Clang Debug
44-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/clang-3.9 CXX_COMPILER=/usr/bin/clang++-3.9 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=Debug RUN_UNIT_TESTS=BUILD_ONLY
45-
46-
# 32-bit GCC 5.4 RelWithDebInfo
47-
- LINUX_BASE=ubuntu32_16.04 C_COMPILER=/usr/bin/gcc-5 CXX_COMPILER=/usr/bin/g++-5 TARGET_ARCH=i686 Z3_BUILD_TYPE=RelWithDebInfo
48-
49-
# Both of the two configurations below build the docs because the current
50-
# implementation uses python as part of the building process.
51-
# TODO: Teach one of the configurations to upload built docs somewhere.
52-
# Test with Python 3 and API docs
53-
- LINUX_BASE=ubuntu_16.04 PYTHON_EXECUTABLE=/usr/bin/python3 BUILD_DOCS=1
54-
# Test with LibGMP and API docs
55-
- LINUX_BASE=ubuntu_16.04 TARGET_ARCH=x86_64 USE_LIBGMP=1 BUILD_DOCS=1 PYTHON_EXECUTABLE=/usr/bin/python2.7
56-
57-
# Test without OpenMP
58-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/gcc-5 CXX_COMPILER=/usr/bin/g++-5 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=RelWithDebInfo USE_OPENMP=0
59-
60-
# Unix Makefile generator build
61-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/gcc-5 CXX_COMPILER=/usr/bin/g++-5 TARGET_ARCH=x86_64 Z3_CMAKE_GENERATOR="Unix Makefiles"
62-
63-
# LTO build
64-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/gcc-5 CXX_COMPILER=/usr/bin/g++-5 TARGET_ARCH=x86_64 USE_LTO=1
65-
66-
# Static build. Note we have disable building the bindings because they won't work with a static libz3
67-
- LINUX_BASE=ubuntu_16.04 C_COMPILER=/usr/bin/gcc-5 CXX_COMPILER=/usr/bin/g++-5 TARGET_ARCH=x86_64 Z3_STATIC_BUILD=1 DOTNET_BINDINGS=0 JAVA_BINDINGS=0 PYTHON_BINDINGS=0
20+
# 64-bit default compilers RelWithDebInfo
21+
- LINUX_BASE=ubuntu_16.04 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=Release JAVA_BINDINGS=1
6822

6923
###############################################################################
7024
# Ubuntu 14.04 LTS
7125
###############################################################################
72-
# GCC 4.8
73-
# 64-bit GCC 4.8 RelWithDebInfo
74-
- LINUX_BASE=ubuntu_14.04 C_COMPILER=/usr/bin/gcc-4.8 CXX_COMPILER=/usr/bin/g++-4.8 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=RelWithDebInfo
75-
# 64-bit GCC 4.8 Debug
76-
- LINUX_BASE=ubuntu_14.04 C_COMPILER=/usr/bin/gcc-4.8 CXX_COMPILER=/usr/bin/g++-4.8 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=Debug RUN_UNIT_TESTS=BUILD_ONLY
26+
# 64-bit GCC 4.8 RelWithDebInfo java
27+
- LINUX_BASE=ubuntu_14.04 TARGET_ARCH=x86_64 Z3_BUILD_TYPE=Release JAVA_BINDINGS=1
7728

7829
# macOS (a.k.a OSX) support
7930
matrix:
@@ -82,9 +33,11 @@ matrix:
8233
# very slow so we should keep the number of configurations we test on this
8334
# OS to a minimum.
8435
- os: osx
85-
osx_image: xcode8.3
86-
# Note: Apple Clang does not support OpenMP
87-
env: Z3_BUILD_TYPE=RelWithDebInfo USE_OPENMP=0
36+
osx_image: xcode9.2
37+
env: Z3_BUILD_TYPE=Release USE_OPENMP=1 JAVA_BINDINGS=1
38+
- os: osx
39+
osx_image: xcode9.2
40+
env: Z3_BUILD_TYPE=Release USE_OPENMP=0 JAVA_BINDINGS=1
8841
script:
8942
# Use `travis_wait` when doing LTO builds because this configuration will
9043
# have long link times during which it will not show any output which

README.batfish

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
To generate zips on your local machine, do:
2+
3+
## Ubuntu 14,04 (USES DOCKER)
4+
LINUX_BASE=ubuntu_14.04 TRAVIS_OS_NAME=linux contrib/ci/scripts/travis_ci_entry_point.sh
5+
6+
## Ubuntu 16,04 (USES DOCKER)
7+
LINUX_BASE=ubuntu_16.04 TRAVIS_OS_NAME=linux contrib/ci/scripts/travis_ci_entry_point.sh
8+
9+
## OSX with OpenMP (RECOMMENDED, MUST BE RUN ON OSX, DOES NOT USE DOCKER)
10+
./package_z3_osx_openmp.sh
11+
12+
## OSX without OpenMP (NOT RECOMMENDED, MUST BE RUN ON OSX, DOES NOT USE DOCKER)
13+
./package_z3_osx.sh
14+
15+
16+
Output zips are placed in build/generated-packages/

common.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
z3_git_version() {
4+
if [ -n "${Z3_GIT_VERSION}" ]; then
5+
echo "${Z3_GIT_VERSION}"
6+
else
7+
COMMIT_HASH="$(git rev-parse HEAD)"
8+
if [ -z "${COMMIT_HASH}" ]; then
9+
echo "Not a git repository" 1>&2
10+
exit 1
11+
fi
12+
COMMIT_DATE="$(git show -s --format=%ci | awk '{ print $1 }')"
13+
echo "${COMMIT_DATE}-${COMMIT_HASH}"
14+
fi
15+
}
16+

contrib/ci/Dockerfiles/z3_base_ubuntu32_16.04.Dockerfile

-51
This file was deleted.

contrib/ci/Dockerfiles/z3_base_ubuntu_14.04.Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ RUN apt-get update && \
1717
libgomp1 \
1818
lib32gomp1 \
1919
llvm-3.9 \
20+
lsb-release \
2021
make \
21-
mono-devel \
2222
ninja-build \
2323
python3 \
2424
python3-setuptools \
2525
python2.7 \
26-
python-setuptools
26+
python-setuptools \
27+
zip
2728

2829
# Create `user` user for container with password `user`. and give it
2930
# password-less sudo access

contrib/ci/Dockerfiles/z3_base_ubuntu_16.04.Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ RUN apt-get update && \
1919
libomp5 \
2020
libomp-dev \
2121
llvm-3.9 \
22+
lsb-release \
2223
make \
23-
mono-devel \
2424
ninja-build \
2525
python3 \
2626
python3-setuptools \
2727
python2.7 \
2828
python-setuptools \
29-
sudo
29+
sudo \
30+
zip
3031

3132
# Create `user` user for container with password `user`. and give it
3233
# password-less sudo access
+14-83
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
ARG DOCKER_IMAGE_BASE
22
FROM ${DOCKER_IMAGE_BASE}
33

4-
54
# Build arguments. This can be changed when invoking
65
# `docker build`.
76
ARG ASAN_BUILD
@@ -27,99 +26,31 @@ ARG USE_OPENMP
2726
ARG Z3_SRC_DIR=/home/user/z3_src
2827
ARG Z3_BUILD_TYPE
2928
ARG Z3_CMAKE_GENERATOR
29+
ARG Z3_GIT_VERSION
3030
ARG Z3_INSTALL_PREFIX
3131
ARG Z3_STATIC_BUILD
3232
ARG Z3_SYSTEM_TEST_GIT_REVISION
3333
ARG Z3_WARNINGS_AS_ERRORS
3434
ARG Z3_VERBOSE_BUILD_OUTPUT
3535

3636
ENV \
37-
ASAN_BUILD=${ASAN_BUILD} \
38-
ASAN_DSO=${ASAN_DSO} \
39-
BUILD_DOCS=${BUILD_DOCS} \
4037
CC=${CC} \
38+
Z3_GIT_VERSION=${Z3_GIT_VERSION} \
4139
CXX=${CXX} \
42-
DOTNET_BINDINGS=${DOTNET_BINDINGS} \
43-
JAVA_BINDINGS=${JAVA_BINDINGS} \
44-
NO_SUPPRESS_OUTPUT=${NO_SUPPRESS_OUTPUT} \
45-
PYTHON_BINDINGS=${PYTHON_BINDINGS} \
46-
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} \
47-
SANITIZER_PRINT_SUPPRESSIONS=${SANITIZER_PRINT_SUPPRESSIONS} \
48-
RUN_API_EXAMPLES=${RUN_API_EXAMPLES} \
49-
RUN_SYSTEM_TESTS=${RUN_SYSTEM_TESTS} \
50-
RUN_UNIT_TESTS=${RUN_UNIT_TESTS} \
51-
TARGET_ARCH=${TARGET_ARCH} \
52-
TEST_INSTALL=${TEST_INSTALL} \
53-
UBSAN_BUILD=${UBSAN_BUILD} \
54-
USE_LIBGMP=${USE_LIBGMP} \
55-
USE_LTO=${USE_LTO} \
56-
USE_OPENMP=${USE_OPENMP} \
5740
Z3_SRC_DIR=${Z3_SRC_DIR} \
5841
Z3_BUILD_DIR=/home/user/z3_build \
59-
Z3_BUILD_TYPE=${Z3_BUILD_TYPE} \
60-
Z3_CMAKE_GENERATOR=${Z3_CMAKE_GENERATOR} \
61-
Z3_VERBOSE_BUILD_OUTPUT=${Z3_VERBOSE_BUILD_OUTPUT} \
62-
Z3_STATIC_BUILD=${Z3_STATIC_BUILD} \
63-
Z3_SYSTEM_TEST_DIR=/home/user/z3_system_test \
64-
Z3_SYSTEM_TEST_GIT_REVISION=${Z3_SYSTEM_TEST_GIT_REVISION} \
65-
Z3_WARNINGS_AS_ERRORS=${Z3_WARNINGS_AS_ERRORS} \
66-
Z3_INSTALL_PREFIX=${Z3_INSTALL_PREFIX}
67-
68-
# We add context across incrementally to maximal cache reuse
42+
Z3_BUILD_TYPE=${Z3_BUILD_TYPE}
6943

7044
# Build Z3
71-
RUN mkdir -p "${Z3_SRC_DIR}" && \
72-
mkdir -p "${Z3_SRC_DIR}/contrib/ci/scripts" && \
73-
mkdir -p "${Z3_SRC_DIR}/contrib/suppressions/sanitizers"
74-
# Deliberately leave out `contrib`
75-
ADD /cmake ${Z3_SRC_DIR}/cmake/
76-
ADD /doc ${Z3_SRC_DIR}/doc/
77-
ADD /examples ${Z3_SRC_DIR}/examples/
78-
ADD /scripts ${Z3_SRC_DIR}/scripts/
79-
ADD /src ${Z3_SRC_DIR}/src/
80-
ADD *.txt *.md RELEASE_NOTES ${Z3_SRC_DIR}/
81-
82-
ADD \
83-
/contrib/ci/scripts/build_z3_cmake.sh \
84-
/contrib/ci/scripts/ci_defaults.sh \
85-
/contrib/ci/scripts/set_compiler_flags.sh \
86-
/contrib/ci/scripts/set_generator_args.sh \
87-
${Z3_SRC_DIR}/contrib/ci/scripts/
88-
RUN ${Z3_SRC_DIR}/contrib/ci/scripts/build_z3_cmake.sh
89-
90-
# Test building docs
91-
ADD \
92-
/contrib/ci/scripts/test_z3_docs.sh \
93-
/contrib/ci/scripts/run_quiet.sh \
94-
${Z3_SRC_DIR}/contrib/ci/scripts/
95-
RUN ${Z3_SRC_DIR}/contrib/ci/scripts/test_z3_docs.sh
96-
97-
# Test examples
98-
ADD \
99-
/contrib/ci/scripts/test_z3_examples_cmake.sh \
100-
/contrib/ci/scripts/sanitizer_env.sh \
101-
${Z3_SRC_DIR}/contrib/ci/scripts/
102-
ADD \
103-
/contrib/suppressions/sanitizers/asan.txt \
104-
/contrib/suppressions/sanitizers/lsan.txt \
105-
/contrib/suppressions/sanitizers/ubsan.txt \
106-
${Z3_SRC_DIR}/contrib/suppressions/sanitizers/
107-
RUN ${Z3_SRC_DIR}/contrib/ci/scripts/test_z3_examples_cmake.sh
108-
109-
# Run unit tests
110-
ADD \
111-
/contrib/ci/scripts/test_z3_unit_tests_cmake.sh \
112-
${Z3_SRC_DIR}/contrib/ci/scripts/
113-
RUN ${Z3_SRC_DIR}/contrib/ci/scripts/test_z3_unit_tests_cmake.sh
114-
115-
# Run system tests
116-
ADD \
117-
/contrib/ci/scripts/test_z3_system_tests.sh \
118-
${Z3_SRC_DIR}/contrib/ci/scripts/
119-
RUN ${Z3_SRC_DIR}/contrib/ci/scripts/test_z3_system_tests.sh
45+
RUN mkdir -p "${Z3_SRC_DIR}"
46+
ADD --chown=user /cmake ${Z3_SRC_DIR}/cmake/
47+
ADD --chown=user /doc ${Z3_SRC_DIR}/doc/
48+
ADD --chown=user /examples ${Z3_SRC_DIR}/examples/
49+
ADD --chown=user /scripts ${Z3_SRC_DIR}/scripts/
50+
ADD --chown=user /src ${Z3_SRC_DIR}/src/
51+
ADD --chown=user *.txt *.md RELEASE_NOTES ${Z3_SRC_DIR}/
52+
ADD --chown=user /linux_common.sh ${Z3_SRC_DIR}/
53+
ADD --chown=user /common.sh ${Z3_SRC_DIR}/
54+
ADD --chown=user /package_z3_linux.sh ${Z3_SRC_DIR}/
55+
RUN ${Z3_SRC_DIR}/package_z3_linux.sh
12056

121-
# Test install
122-
ADD \
123-
/contrib/ci/scripts/test_z3_install_cmake.sh \
124-
${Z3_SRC_DIR}/contrib/ci/scripts/
125-
RUN ${Z3_SRC_DIR}/contrib/ci/scripts/test_z3_install_cmake.sh

contrib/ci/scripts/install_deps_osx.sh

+2
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ fi
4545
if [ "X${JAVA_BINDINGS}" = "X1" ]; then
4646
brew cask install java
4747
fi
48+
brew_install_or_upgrade llvm
49+

contrib/ci/scripts/travis_ci_linux_entry_point.sh

+14-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ set -x
66
set -e
77
set -o pipefail
88

9+
REPO_ROOT="${SCRIPT_DIR}/../../.."
10+
. "${REPO_ROOT}/common.sh"
11+
Z3_GIT_VERSION="$(z3_git_version)"
12+
PACKAGE_OUTPUT_DIR="${REPO_ROOT}/build/generated-packages"
13+
mkdir -p "${PACKAGE_OUTPUT_DIR}"
14+
915
DOCKER_FILE_DIR="$(cd ${SCRIPT_DIR}/../Dockerfiles; echo $PWD)"
1016

1117
: ${LINUX_BASE?"LINUX_BASE must be specified"}
@@ -71,6 +77,8 @@ if [ -n "${C_COMPILER}" ]; then
7177
BUILD_OPTS+=("--build-arg" "CC=${C_COMPILER}")
7278
fi
7379

80+
BUILD_OPTS+=("--build-arg" "Z3_GIT_VERSION=${Z3_GIT_VERSION}")
81+
7482
# TravisCI reserves CXX for itself so use a different name
7583
if [ -n "${CXX_COMPILER}" ]; then
7684
BUILD_OPTS+=("--build-arg" "CXX=${CXX_COMPILER}")
@@ -153,10 +161,6 @@ case ${LINUX_BASE} in
153161
BASE_DOCKER_FILE="${DOCKER_FILE_DIR}/z3_base_ubuntu_16.04.Dockerfile"
154162
BASE_DOCKER_IMAGE_NAME="z3_base_ubuntu:16.04"
155163
;;
156-
ubuntu32_16.04)
157-
BASE_DOCKER_FILE="${DOCKER_FILE_DIR}/z3_base_ubuntu32_16.04.Dockerfile"
158-
BASE_DOCKER_IMAGE_NAME="z3_base_ubuntu32:16.04"
159-
;;
160164
*)
161165
echo "Unknown Linux base ${LINUX_BASE}"
162166
exit 1
@@ -226,7 +230,13 @@ else
226230
fi
227231

228232
# Now build Z3 and test it using the created base image
233+
export POSTBUILD_IMAGE="batfish/z3-docker-postbuild-$(echo "${LINUX_BASE}" | tr -d '.')"
229234
docker build \
235+
-t "${POSTBUILD_IMAGE}" \
230236
-f "${DOCKER_BUILD_FILE}" \
231237
"${BUILD_OPTS[@]}" \
232238
.
239+
DOCKER_REPO_ROOT="/home/user/z3_src"
240+
Z3_ZIP="$(docker run "${POSTBUILD_IMAGE}" /bin/bash -c ". ${DOCKER_REPO_ROOT}/linux_common.sh && linux_zip_name")"
241+
docker cp "$(docker create "${POSTBUILD_IMAGE}"):${DOCKER_REPO_ROOT}/build/generated-packages/${Z3_ZIP}" "${PACKAGE_OUTPUT_DIR}/"
242+

0 commit comments

Comments
 (0)