Skip to content

Instantly share code, notes, and snippets.

@Totktonada
Created December 21, 2018 15:19
Show Gist options
  • Save Totktonada/4d02568faf1858c55df35621f01f3d20 to your computer and use it in GitHub Desktop.
Save Totktonada/4d02568faf1858c55df35621f01f3d20 to your computer and use it in GitHub Desktop.
Tarantool 1.9 CentOS 7 RPM package with ASAN
diff --git a/packpack b/packpack
index f7460d6..211e370 100755
--- a/packpack
+++ b/packpack
@@ -146,6 +146,7 @@ chcon -Rt svirt_sandbox_file_t ${PACKDIR} ${SOURCEDIR} ${BUILDDIR} \
set -ex
docker pull ${DOCKER_REPO}:${DOCKER_IMAGE}
docker run \
+ --cap-add SYS_PTRACE \
--volume "${PACKDIR}:/pack:ro" \
--volume "${SOURCEDIR}:/source:ro" \
--volume "${BUILDDIR}:/build" \
diff --git a/rpm/prebuild.sh b/rpm/prebuild.sh
new file mode 100755
index 000000000..9fe71f765
--- /dev/null
+++ b/rpm/prebuild.sh
@@ -0,0 +1,37 @@
+cat <<EOF | sudo tee /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
+# CentOS-SCLo-rh.repo
+#
+# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
+# information
+
+[centos-sclo-rh]
+name=CentOS-7 - SCLo rh
+baseurl=http://mirror.centos.org/centos/7/sclo/\$basearch/rh/
+gpgcheck=1
+enabled=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
+
+[centos-sclo-rh-testing]
+name=CentOS-7 - SCLo rh Testing
+baseurl=http://buildlogs.centos.org/centos/7/sclo/\$basearch/rh/
+gpgcheck=0
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
+
+# A workaround for [Errno 14] HTTP Error 404 - Not Found
+# https://bugs.centos.org/view.php?id=12793
+#[centos-sclo-rh-source]
+#name=CentOS-7 - SCLo rh Sources
+#baseurl=http://vault.centos.org/centos/7/sclo/Source/rh/
+#gpgcheck=1
+#enabled=0
+#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
+
+[centos-sclo-rh-debuginfo]
+name=CentOS-7 - SCLo rh Debuginfo
+baseurl=http://debuginfo.centos.org/centos/7/sclo/\$basearch/
+gpgcheck=1
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
+EOF
+sudo yum -y install llvm-toolset-7
diff --git a/rpm/tarantool.spec b/rpm/tarantool.spec
index c87b1667d..d0aeaceac 100644
--- a/rpm/tarantool.spec
+++ b/rpm/tarantool.spec
@@ -11,6 +11,7 @@ BuildRequires: make
# RHEL 6 requires devtoolset
BuildRequires: gcc >= 4.5
BuildRequires: gcc-c++ >= 4.5
+BuildRequires: llvm-toolset-7
%endif
BuildRequires: coreutils
BuildRequires: sed
@@ -120,6 +121,11 @@ C and Lua/C modules.
%setup -q -n %{name}-%{version}
%build
+set +e
+source scl_source enable llvm-toolset-7
+set -e
+export CC=clang
+export CXX=clang++
# RHBZ #1301720: SYSCONFDIR an LOCALSTATEDIR must be specified explicitly
%cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=%{_localstatedir} \
@@ -135,7 +141,8 @@ C and Lua/C modules.
-DSYSTEMD_UNIT_DIR:PATH=%{_unitdir} \
-DSYSTEMD_TMPFILES_DIR:PATH=%{_tmpfilesdir} \
%endif
- -DENABLE_DIST:BOOL=ON
+ -DENABLE_DIST:BOOL=ON \
+ -DENABLE_ASAN:BOOL=ON
make %{?_smp_mflags}
%install
@@ -143,15 +150,18 @@ make %{?_smp_mflags}
# %%doc and %%license macroses are used instead
rm -rf %{buildroot}%{_datarootdir}/doc/tarantool/
-%check
-%if (0%{?fedora} >= 22 || 0%{?rhel} >= 7)
-# https://github.com/tarantool/tarantool/issues/1227
-echo "self.skip = True" > ./test/app/socket.skipcond
-# https://github.com/tarantool/tarantool/issues/1322
-echo "self.skip = True" > ./test/app/digest.skipcond
-# run a safe subset of the test suite
-cd test && ./test-run.py -j 1 unit/ app/ app-tap/ box/ box-tap/ engine/ vinyl/
-%endif
+#%check
+#set +e
+#source scl_source enable llvm-toolset-7
+#set -e
+#%if (0%{?fedora} >= 22 || 0%{?rhel} >= 7)
+## https://github.com/tarantool/tarantool/issues/1227
+#echo "self.skip = True" > ./test/app/socket.skipcond
+## https://github.com/tarantool/tarantool/issues/1322
+#echo "self.skip = True" > ./test/app/digest.skipcond
+## run a safe subset of the test suite
+#cd test && ./test-run.py -j 1 unit/ app/ app-tap/ box/ box-tap/ engine/ vinyl/
+#%endif
%pre
/usr/sbin/groupadd -r tarantool > /dev/null 2>&1 || :
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b1c4cd711..954cc8077 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,6 +3,7 @@
#
enable_tnt_compile_flags()
+include_directories(/opt/rh/llvm-toolset-7/root/usr/include)
include_directories(${LIBEV_INCLUDE_DIR})
include_directories(${LIBEIO_INCLUDE_DIR})
include_directories(${LIBCORO_INCLUDE_DIR})
diff --git a/src/fiber.c b/src/fiber.c
index 13c6175d6..cf591d072 100644
--- a/src/fiber.c
+++ b/src/fiber.c
@@ -54,7 +54,7 @@ static int (*fiber_invoke)(fiber_func f, va_list ap);
__sanitizer_start_switch_fiber((will_switch_back) ? &var_name : NULL, \
(bottom), (size))
#define ASAN_FINISH_SWITCH_FIBER(var_name) \
- __sanitizer_finish_switch_fiber(var_name);
+ __sanitizer_finish_switch_fiber(var_name, 0, 0);
#else
#define ASAN_START_SWITCH_FIBER(var_name, will_switch_back, bottom, size)
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 943788b94..3a0f786d9 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -5,6 +5,7 @@ endif()
file(GLOB all_sources *.c *.cc)
set_source_files_compile_flags(${all_sources})
+include_directories(/opt/rh/llvm-toolset-7/root/usr/include)
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_BINARY_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/src/box)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment