Add CI autotest and Fix compile warning
This commit is contained in:
253
.gitlab-ci.yml
Normal file
253
.gitlab-ci.yml
Normal file
@@ -0,0 +1,253 @@
|
||||
variables:
|
||||
GIT_STRATEGY: "clone"
|
||||
BUILD_PADDING_PREFIX: /tmp/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX_PREFIX/
|
||||
INSTALL_PREFIX: "/opt/tsg/stellar"
|
||||
TESTING_VERSION_BUILD: 0
|
||||
BUILD_IMAGE_CENTOS7: "git.mesalab.cn:7443/mesa_platform/build-env:master"
|
||||
BUILD_IMAGE_CENTOS8: "git.mesalab.cn:7443/mesa_platform/build-env:rockylinux"
|
||||
|
||||
stages:
|
||||
- build
|
||||
- envelope
|
||||
- upload
|
||||
|
||||
.build_before_script:
|
||||
before_script:
|
||||
- mkdir -p $BUILD_PADDING_PREFIX/$CI_PROJECT_NAMESPACE/
|
||||
- ln -s $CI_PROJECT_DIR $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
|
||||
- cd $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
|
||||
- chmod +x ./ci/travis.sh
|
||||
- yum makecache
|
||||
- yum install -y elfutils-libelf-devel
|
||||
|
||||
.build_by_travis_for_centos7:
|
||||
stage: build
|
||||
image: $BUILD_IMAGE_CENTOS7
|
||||
extends: .build_before_script
|
||||
script:
|
||||
- ./ci/travis.sh
|
||||
tags:
|
||||
- share
|
||||
|
||||
.build_by_travis_for_centos8:
|
||||
stage: build
|
||||
image: $BUILD_IMAGE_CENTOS8
|
||||
extends: .build_before_script
|
||||
script:
|
||||
- ./ci/travis.sh
|
||||
tags:
|
||||
- share
|
||||
|
||||
###############################################################################
|
||||
# compile use image: build-env:master
|
||||
###############################################################################
|
||||
|
||||
branch_build_debug_for_centos7:
|
||||
extends: .build_by_travis_for_centos7
|
||||
variables:
|
||||
BUILD_TYPE: Debug
|
||||
except:
|
||||
- /^develop-.*$/i
|
||||
- /^release-.*$/i
|
||||
- tags
|
||||
|
||||
branch_build_release_for_centos7:
|
||||
variables:
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
extends: .build_by_travis_for_centos7
|
||||
except:
|
||||
- /^develop-.*$/i
|
||||
- /^release-.*$/i
|
||||
- tags
|
||||
|
||||
develop_build_debug_for_centos7:
|
||||
extends: .build_by_travis_for_centos7
|
||||
variables:
|
||||
TESTING_VERSION_BUILD: 1
|
||||
UPLOAD_SYMBOL_FILES: 1
|
||||
BUILD_TYPE: Debug
|
||||
# ASAN_OPTION: ADDRESS
|
||||
PACKAGE: 1
|
||||
PULP3_REPO_NAME: stellar-testing-x86_64.el7
|
||||
PULP3_DIST_NAME: stellar-testing-x86_64.el7
|
||||
artifacts:
|
||||
name: "stellar-develop-$CI_COMMIT_REF_NAME-debug"
|
||||
paths:
|
||||
- build/*.rpm
|
||||
only:
|
||||
- /^develop-.*$/i
|
||||
- /^release-.*$/i
|
||||
|
||||
develop_build_release_for_centos7:
|
||||
extends: .build_by_travis_for_centos7
|
||||
variables:
|
||||
TESTING_VERSION_BUILD: 1
|
||||
UPLOAD_SYMBOL_FILES: 1
|
||||
# ASAN_OPTION: ADDRESS
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
PACKAGE: 1
|
||||
PULP3_REPO_NAME: stellar-testing-x86_64.el7
|
||||
PULP3_DIST_NAME: stellar-testing-x86_64.el7
|
||||
artifacts:
|
||||
name: "stellar-develop-$CI_COMMIT_REF_NAME-release"
|
||||
paths:
|
||||
- build/*.rpm
|
||||
only:
|
||||
- /^develop-.*$/i
|
||||
- /^release-.*$/i
|
||||
|
||||
release_build_debug_for_centos7:
|
||||
variables:
|
||||
UPLOAD_SYMBOL_FILES: 1
|
||||
BUILD_TYPE: Debug
|
||||
PACKAGE: 1
|
||||
PULP3_REPO_NAME: stellar-stable-x86_64.el7
|
||||
PULP3_DIST_NAME: stellar-stable-x86_64.el7
|
||||
extends: .build_by_travis_for_centos7
|
||||
artifacts:
|
||||
name: "stellar-install-$CI_COMMIT_REF_NAME-debug"
|
||||
paths:
|
||||
- build/*.rpm
|
||||
only:
|
||||
- tags
|
||||
|
||||
release_build_release_for_centos7:
|
||||
variables:
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
UPLOAD_SYMBOL_FILES: 1
|
||||
PACKAGE: 1
|
||||
PULP3_REPO_NAME: stellar-stable-x86_64.el7
|
||||
PULP3_DIST_NAME: stellar-stable-x86_64.el7
|
||||
extends: .build_by_travis_for_centos7
|
||||
artifacts:
|
||||
name: "stellar-install-$CI_COMMIT_REF_NAME-release"
|
||||
paths:
|
||||
- build/*.rpm
|
||||
only:
|
||||
- tags
|
||||
|
||||
###############################################################################
|
||||
# compile use image: build-env:rockylinux
|
||||
###############################################################################
|
||||
|
||||
branch_build_debug_for_centos8:
|
||||
extends: .build_by_travis_for_centos8
|
||||
variables:
|
||||
BUILD_TYPE: Debug
|
||||
except:
|
||||
- /^develop-.*$/i
|
||||
- /^release-.*$/i
|
||||
- tags
|
||||
|
||||
branch_build_release_for_centos8:
|
||||
variables:
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
extends: .build_by_travis_for_centos8
|
||||
except:
|
||||
- /^develop-.*$/i
|
||||
- /^release-.*$/i
|
||||
- tags
|
||||
|
||||
develop_build_debug_for_centos8:
|
||||
extends: .build_by_travis_for_centos8
|
||||
variables:
|
||||
TESTING_VERSION_BUILD: 1
|
||||
UPLOAD_SYMBOL_FILES: 1
|
||||
BUILD_TYPE: Debug
|
||||
# ASAN_OPTION: ADDRESS
|
||||
PACKAGE: 1
|
||||
PULP3_REPO_NAME: stellar-testing-x86_64.el8
|
||||
PULP3_DIST_NAME: stellar-testing-x86_64.el8
|
||||
artifacts:
|
||||
name: "stellar-develop-$CI_COMMIT_REF_NAME-debug"
|
||||
paths:
|
||||
- build/*.rpm
|
||||
only:
|
||||
- /^develop-.*$/i
|
||||
- /^release-.*$/i
|
||||
|
||||
develop_build_release_for_centos8:
|
||||
extends: .build_by_travis_for_centos8
|
||||
variables:
|
||||
TESTING_VERSION_BUILD: 1
|
||||
UPLOAD_SYMBOL_FILES: 1
|
||||
# ASAN_OPTION: ADDRESS
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
PACKAGE: 1
|
||||
PULP3_REPO_NAME: stellar-testing-x86_64.el8
|
||||
PULP3_DIST_NAME: stellar-testing-x86_64.el8
|
||||
artifacts:
|
||||
name: "stellar-develop-$CI_COMMIT_REF_NAME-release"
|
||||
paths:
|
||||
- build/*.rpm
|
||||
only:
|
||||
- /^develop-.*$/i
|
||||
- /^release-.*$/i
|
||||
|
||||
release_build_debug_for_centos8:
|
||||
variables:
|
||||
UPLOAD_SYMBOL_FILES: 1
|
||||
BUILD_TYPE: Debug
|
||||
PACKAGE: 1
|
||||
PULP3_REPO_NAME: stellar-stable-x86_64.el8
|
||||
PULP3_DIST_NAME: stellar-stable-x86_64.el8
|
||||
extends: .build_by_travis_for_centos8
|
||||
artifacts:
|
||||
name: "stellar-install-$CI_COMMIT_REF_NAME-debug"
|
||||
paths:
|
||||
- build/*.rpm
|
||||
only:
|
||||
- tags
|
||||
|
||||
release_build_release_for_centos8:
|
||||
variables:
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
UPLOAD_SYMBOL_FILES: 1
|
||||
PACKAGE: 1
|
||||
PULP3_REPO_NAME: stellar-stable-x86_64.el8
|
||||
PULP3_DIST_NAME: stellar-stable-x86_64.el8
|
||||
extends: .build_by_travis_for_centos8
|
||||
artifacts:
|
||||
name: "stellar-install-$CI_COMMIT_REF_NAME-release"
|
||||
paths:
|
||||
- build/*.rpm
|
||||
only:
|
||||
- tags
|
||||
|
||||
###############################################################################
|
||||
# envelope and upload
|
||||
###############################################################################
|
||||
|
||||
envelope_rpm:
|
||||
stage: envelope
|
||||
image: $BUILD_IMAGE_CENTOS7
|
||||
variables:
|
||||
FEATURE_ID: 100
|
||||
APP_NAME_IN_RPM_SPEC: stellar
|
||||
script:
|
||||
- chmod +x ./ci/envelope_rpm.sh
|
||||
- ./ci/envelope_rpm.sh
|
||||
artifacts:
|
||||
name: "stellar-pr-$CI_COMMIT_REF_NAME-release"
|
||||
paths:
|
||||
- build/*-pr-*.rpm
|
||||
tags:
|
||||
- envelope
|
||||
only:
|
||||
- tags
|
||||
|
||||
upload_enveloped_rpm:
|
||||
stage: upload
|
||||
image: $BUILD_IMAGE_CENTOS7
|
||||
variables:
|
||||
PULP3_REPO_NAME_EL7: stellar-stable-x86_64.el7
|
||||
PULP3_DIST_NAME_EL7: stellar-stable-x86_64.el7
|
||||
PULP3_REPO_NAME_EL8: stellar-stable-x86_64.el8
|
||||
PULP3_DIST_NAME_EL8: stellar-stable-x86_64.el8
|
||||
script:
|
||||
- chmod +x ./ci/upload_enveloped_rpm.sh
|
||||
- ./ci/upload_enveloped_rpm.sh
|
||||
tags:
|
||||
- share
|
||||
only:
|
||||
- tags
|
||||
@@ -1,21 +1,35 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(stellar)
|
||||
|
||||
# GoogleTest requires at least C++11
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
#find required package
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
include(Version)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(PCAP REQUIRED)
|
||||
pkg_check_modules(SYSTEMD REQUIRED systemd)
|
||||
include(Package)
|
||||
|
||||
add_definitions(-D_GNU_SOURCE)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||
endif()
|
||||
|
||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set (CMAKE_INSTALL_PREFIX "/opt/tsg/stellar" CACHE PATH "default install path" FORCE)
|
||||
endif()
|
||||
|
||||
option(ENABLE_PIC "Generate position independent code (necessary for shared libraries)" TRUE)
|
||||
option(ENABLE_WARNING_ALL "Enable all optional warnings which are desirable for normal code" TRUE)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lelf")
|
||||
|
||||
add_custom_target("install-program" COMMAND ${CMAKE_COMMAND} ARGS -DCOMPONENT=Program -P cmake_install.cmake)
|
||||
add_custom_target("install-profile" COMMAND ${CMAKE_COMMAND} ARGS -DCOMPONENT=Profile -P cmake_install.cmake)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/sdk/include)
|
||||
|
||||
#add vendor and source directory
|
||||
add_subdirectory(conf)
|
||||
add_subdirectory(vendor)
|
||||
add_subdirectory(deps/toml)
|
||||
add_subdirectory(deps/sds)
|
||||
@@ -23,11 +37,5 @@ add_subdirectory(deps/timeout)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(sdk/example)
|
||||
|
||||
|
||||
#add gtest
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
|
||||
|
||||
|
||||
|
||||
add_subdirectory(test)
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
# Usage message.
|
||||
arUsage() {
|
||||
cat > "/dev/stderr" << EOF
|
||||
cat >"/dev/stderr" <<EOF
|
||||
usage: autorevision {-t output-type | -s symbol} [-o cache-file [-f] ] [-V]
|
||||
Options include:
|
||||
-t output-type = specify output type
|
||||
@@ -69,28 +69,28 @@ ARVERSION="&&ARVERSION&&"
|
||||
TARGETFILE="/dev/stdout"
|
||||
while getopts ":t:o:s:VfU" OPTION; do
|
||||
case "${OPTION}" in
|
||||
t)
|
||||
AFILETYPE="${OPTARG}"
|
||||
t)
|
||||
AFILETYPE="${OPTARG}"
|
||||
;;
|
||||
o)
|
||||
CACHEFILE="${OPTARG}"
|
||||
o)
|
||||
CACHEFILE="${OPTARG}"
|
||||
;;
|
||||
f)
|
||||
CACHEFORCE="1"
|
||||
f)
|
||||
CACHEFORCE="1"
|
||||
;;
|
||||
s)
|
||||
VAROUT="${OPTARG}"
|
||||
s)
|
||||
VAROUT="${OPTARG}"
|
||||
;;
|
||||
U)
|
||||
UNTRACKEDFILES="1"
|
||||
U)
|
||||
UNTRACKEDFILES="1"
|
||||
;;
|
||||
V)
|
||||
echo "autorevision ${ARVERSION}"
|
||||
exit 0
|
||||
V)
|
||||
echo "autorevision ${ARVERSION}"
|
||||
exit 0
|
||||
;;
|
||||
?)
|
||||
# If an unknown flag is used (or -?):
|
||||
arUsage
|
||||
?)
|
||||
# If an unknown flag is used (or -?):
|
||||
arUsage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -305,7 +305,7 @@ svnRepo() {
|
||||
VCS_TYPE="svn"
|
||||
|
||||
case "${PWD}" in
|
||||
/*trunk*|/*branches*|/*tags*)
|
||||
/*trunk* | /*branches* | /*tags*)
|
||||
local fn="${PWD}"
|
||||
while [ "$(basename "${fn}")" != 'trunk' ] && [ "$(basename "${fn}")" != 'branches' ] && [ "$(basename "${fn}")" != 'tags' ] && [ "$(basename "${fn}")" != '/' ]; do
|
||||
local fn="$(dirname "${fn}")"
|
||||
@@ -328,20 +328,20 @@ svnRepo() {
|
||||
# Is the working copy clean?
|
||||
echo "${SVNVERSION}" | grep -q "M"
|
||||
case "${?}" in
|
||||
0)
|
||||
VCS_WC_MODIFIED="1"
|
||||
0)
|
||||
VCS_WC_MODIFIED="1"
|
||||
;;
|
||||
1)
|
||||
if [ ! -z "${UNTRACKEDFILES}" ]; then
|
||||
1)
|
||||
if [ ! -z "${UNTRACKEDFILES}" ]; then
|
||||
# `svnversion` does not detect untracked files and `svn status` is really slow, so only run it if we really have to.
|
||||
if [ -z "$(svn status)" ]; then
|
||||
VCS_WC_MODIFIED="0"
|
||||
else
|
||||
VCS_WC_MODIFIED="1"
|
||||
fi
|
||||
else
|
||||
if [ -z "$(svn status)" ]; then
|
||||
VCS_WC_MODIFIED="0"
|
||||
else
|
||||
VCS_WC_MODIFIED="1"
|
||||
fi
|
||||
else
|
||||
VCS_WC_MODIFIED="0"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -356,11 +356,10 @@ svnRepo() {
|
||||
|
||||
# Current branch
|
||||
case "${PWD}" in
|
||||
/*trunk*|/*branches*|/*tags*)
|
||||
/*trunk* | /*branches* | /*tags*)
|
||||
local lastbase=""
|
||||
local fn="${PWD}"
|
||||
while :
|
||||
do
|
||||
while :; do
|
||||
base="$(basename "${fn}")"
|
||||
if [ "${base}" = 'trunk' ]; then
|
||||
VCS_BRANCH='trunk'
|
||||
@@ -394,11 +393,10 @@ svnRepo() {
|
||||
cd "${oldPath}"
|
||||
}
|
||||
|
||||
|
||||
# Functions to output data in different formats.
|
||||
# For bash output
|
||||
shOutput() {
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
# ${GENERATED_HEADER}
|
||||
|
||||
VCS_TYPE="${VCS_TYPE}"
|
||||
@@ -423,7 +421,7 @@ EOF
|
||||
|
||||
# For source C output
|
||||
cOutput() {
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
/* ${GENERATED_HEADER} */
|
||||
|
||||
const char *VCS_TYPE = "${VCS_TYPE}";
|
||||
@@ -448,7 +446,7 @@ EOF
|
||||
|
||||
# For header output
|
||||
hOutput() {
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
/* ${GENERATED_HEADER} */
|
||||
#ifndef AUTOREVISION_H
|
||||
#define AUTOREVISION_H
|
||||
@@ -477,7 +475,7 @@ EOF
|
||||
|
||||
# A header output for use with xcode to populate info.plist strings
|
||||
xcodeOutput() {
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
/* ${GENERATED_HEADER} */
|
||||
#ifndef AUTOREVISION_H
|
||||
#define AUTOREVISION_H
|
||||
@@ -507,8 +505,8 @@ EOF
|
||||
# For Swift output
|
||||
swiftOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
esac
|
||||
# For values that may not exist depending on the type of repo we
|
||||
# have read from, set them to `nil` when they are empty.
|
||||
@@ -533,7 +531,7 @@ swiftOutput() {
|
||||
else
|
||||
VCS_ACTION_STAMP="\"${VCS_ACTION_STAMP}\""
|
||||
fi
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
/* ${GENERATED_HEADER} */
|
||||
|
||||
let VCS_TYPE = "${VCS_TYPE}"
|
||||
@@ -559,10 +557,10 @@ EOF
|
||||
# For Python output
|
||||
pyOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
0) VCS_WC_MODIFIED="False" ;;
|
||||
1) VCS_WC_MODIFIED="True" ;;
|
||||
0) VCS_WC_MODIFIED="False" ;;
|
||||
1) VCS_WC_MODIFIED="True" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
# ${GENERATED_HEADER}
|
||||
|
||||
VCS_TYPE = "${VCS_TYPE}"
|
||||
@@ -587,7 +585,7 @@ EOF
|
||||
|
||||
# For Perl output
|
||||
plOutput() {
|
||||
cat << EOF
|
||||
cat <<EOF
|
||||
# ${GENERATED_HEADER}
|
||||
|
||||
\$VCS_TYPE = '${VCS_TYPE}';
|
||||
@@ -614,10 +612,10 @@ EOF
|
||||
# For lua output
|
||||
luaOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
-- ${GENERATED_HEADER}
|
||||
|
||||
VCS_TYPE = "${VCS_TYPE}"
|
||||
@@ -643,10 +641,10 @@ EOF
|
||||
# For php output
|
||||
phpOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
<?php
|
||||
# ${GENERATED_HEADER}
|
||||
|
||||
@@ -674,10 +672,10 @@ EOF
|
||||
# For ini output
|
||||
iniOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
; ${GENERATED_HEADER}
|
||||
[VCS]
|
||||
VCS_TYPE = "${VCS_TYPE}"
|
||||
@@ -700,10 +698,10 @@ EOF
|
||||
# For javascript output
|
||||
jsOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
/** ${GENERATED_HEADER} */
|
||||
|
||||
var autorevision = {
|
||||
@@ -736,10 +734,10 @@ EOF
|
||||
# For JSON output
|
||||
jsonOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
{
|
||||
"_comment": "${GENERATED_HEADER}",
|
||||
"VCS_TYPE": "${VCS_TYPE}",
|
||||
@@ -764,10 +762,10 @@ EOF
|
||||
# For Java output
|
||||
javaOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
/* ${GENERATED_HEADER} */
|
||||
|
||||
public class autorevision {
|
||||
@@ -793,10 +791,10 @@ EOF
|
||||
# For Java properties output
|
||||
javapropOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
# ${GENERATED_HEADER}
|
||||
|
||||
VCS_TYPE=${VCS_TYPE}
|
||||
@@ -819,7 +817,7 @@ EOF
|
||||
|
||||
# For m4 output
|
||||
m4Output() {
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
dnl ${GENERATED_HEADER}
|
||||
define(\`VCS_TYPE', \`${VCS_TYPE}')dnl
|
||||
define(\`VCS_BASENAME', \`${VCS_BASENAME}')dnl
|
||||
@@ -840,10 +838,10 @@ EOF
|
||||
# For (La)TeX output
|
||||
texOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
% ${GENERATED_HEADER}
|
||||
\def \vcsType {${VCS_TYPE}}
|
||||
\def \vcsBasename {${VCS_BASENAME}}
|
||||
@@ -865,10 +863,10 @@ EOF
|
||||
# For scheme output
|
||||
schemeOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
0) VCS_WC_MODIFIED="#f" ;;
|
||||
1) VCS_WC_MODIFIED="#t" ;;
|
||||
0) VCS_WC_MODIFIED="#f" ;;
|
||||
1) VCS_WC_MODIFIED="#t" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
;; ${GENERATED_HEADER}
|
||||
(define VCS_TYPE "${VCS_TYPE}")
|
||||
(define VCS_BASENAME "${VCS_BASENAME}")
|
||||
@@ -892,10 +890,10 @@ EOF
|
||||
# For clojure output
|
||||
clojureOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
0) VCS_WC_MODIFIED="false" ;;
|
||||
1) VCS_WC_MODIFIED="true" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
;; ${GENERATED_HEADER}
|
||||
(def VCS_TYPE "${VCS_TYPE}")
|
||||
(def VCS_BASENAME "${VCS_BASENAME}")
|
||||
@@ -918,7 +916,7 @@ EOF
|
||||
|
||||
# For rpm spec file output
|
||||
rpmOutput() {
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
# ${GENERATED_HEADER}
|
||||
$([ "${VCS_TYPE}" ] && echo "%define vcs_type ${VCS_TYPE}")
|
||||
$([ "${VCS_BASENAME}" ] && echo "%define vcs_basename ${VCS_BASENAME}")
|
||||
@@ -942,7 +940,7 @@ EOF
|
||||
# shellcheck disable=SC2155,SC2039
|
||||
hppOutput() {
|
||||
local NAMESPACE="$(echo "${VCS_BASENAME}" | sed -e 's:_::g' | tr '[:lower:]' '[:upper:]')"
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
/* ${GENERATED_HEADER} */
|
||||
|
||||
#ifndef ${NAMESPACE}_AUTOREVISION_H
|
||||
@@ -977,10 +975,10 @@ EOF
|
||||
|
||||
matlabOutput() {
|
||||
case "${VCS_WC_MODIFIED}" in
|
||||
0) VCS_WC_MODIFIED="FALSE" ;;
|
||||
1) VCS_WC_MODIFIED="TRUE" ;;
|
||||
0) VCS_WC_MODIFIED="FALSE" ;;
|
||||
1) VCS_WC_MODIFIED="TRUE" ;;
|
||||
esac
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
% ${GENERATED_HEADER}
|
||||
|
||||
VCS_TYPE = '${VCS_TYPE}';
|
||||
@@ -1004,7 +1002,7 @@ EOF
|
||||
}
|
||||
|
||||
octaveOutput() {
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
% ${GENERATED_HEADER}
|
||||
|
||||
VCS_TYPE = '${VCS_TYPE}';
|
||||
@@ -1028,7 +1026,7 @@ EOF
|
||||
}
|
||||
|
||||
cmakeOutput() {
|
||||
cat > "${TARGETFILE}" << EOF
|
||||
cat >"${TARGETFILE}" <<EOF
|
||||
# ${GENERATED_HEADER}
|
||||
|
||||
set(VCS_TYPE ${VCS_TYPE})
|
||||
@@ -1051,7 +1049,6 @@ set(VCS_WC_MODIFIED ${VCS_WC_MODIFIED})
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
# Helper functions
|
||||
# Count path segments
|
||||
# shellcheck disable=SC2039
|
||||
@@ -1063,7 +1060,7 @@ pathSegment() {
|
||||
# Continue until we are at / or there are no path separators left.
|
||||
while [ ! "${pathz}" = "/" ] && [ ! "${pathz}" = "$(echo "${pathz}" | sed -e 's:/::')" ]; do
|
||||
pathz="$(dirname "${pathz}")"
|
||||
depth="$((depth+1))"
|
||||
depth="$((depth + 1))"
|
||||
done
|
||||
fi
|
||||
echo "${depth}"
|
||||
@@ -1090,21 +1087,21 @@ repoTest() {
|
||||
if [ ! -z "$(git rev-parse HEAD 2>/dev/null)" ]; then
|
||||
local gitPath="$(git rev-parse --show-toplevel)"
|
||||
local gitDepth="$(pathSegment "${gitPath}")"
|
||||
REPONUM="$((REPONUM+1))"
|
||||
REPONUM="$((REPONUM + 1))"
|
||||
else
|
||||
local gitDepth="0"
|
||||
fi
|
||||
if [ ! -z "$(hg root 2>/dev/null)" ]; then
|
||||
local hgPath="$(hg root 2>/dev/null)"
|
||||
local hgDepth="$(pathSegment "${hgPath}")"
|
||||
REPONUM="$((REPONUM+1))"
|
||||
REPONUM="$((REPONUM + 1))"
|
||||
else
|
||||
local hgDepth="0"
|
||||
fi
|
||||
if [ ! -z "$(bzr root 2>/dev/null)" ]; then
|
||||
local bzrPath="$(bzr root 2>/dev/null)"
|
||||
local bzrDepth="$(pathSegment "${bzrPath}")"
|
||||
REPONUM="$((REPONUM+1))"
|
||||
REPONUM="$((REPONUM + 1))"
|
||||
else
|
||||
local bzrDepth="0"
|
||||
fi
|
||||
@@ -1114,12 +1111,12 @@ repoTest() {
|
||||
local svnPath="$(svn info --xml | sed -n -e "s:${stringz}::" -e "s:${stringx}::p")"
|
||||
# An old enough svn will not be able give us a path; default
|
||||
# to 1 for that case.
|
||||
if [ -z "${svnPath}" ]; then
|
||||
if [ -z "${svnPath}" ]; then
|
||||
local svnDepth="1"
|
||||
else
|
||||
local svnDepth="$(pathSegment "${svnPath}")"
|
||||
fi
|
||||
REPONUM="$((REPONUM+1))"
|
||||
REPONUM="$((REPONUM + 1))"
|
||||
else
|
||||
local svnDepth="0"
|
||||
fi
|
||||
@@ -1142,8 +1139,6 @@ repoTest() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Detect which repos we are in and gather data.
|
||||
# shellcheck source=/dev/null
|
||||
if [ -f "${CACHEFILE}" ] && [ "${CACHEFORCE}" = "1" ]; then
|
||||
@@ -1165,7 +1160,6 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# -s output is handled here.
|
||||
if [ ! -z "${VAROUT}" ]; then
|
||||
if [ "${VAROUT}" = "VCS_TYPE" ]; then
|
||||
@@ -1196,7 +1190,6 @@ if [ ! -z "${VAROUT}" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Detect requested output type and use it.
|
||||
if [ ! -z "${AFILETYPE}" ]; then
|
||||
if [ "${AFILETYPE}" = "c" ]; then
|
||||
@@ -1251,7 +1244,6 @@ if [ ! -z "${AFILETYPE}" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# If requested, make a cache file.
|
||||
if [ ! -z "${CACHEFILE}" ] && [ ! "${CACHEFORCE}" = "1" ]; then
|
||||
TARGETFILE="${CACHEFILE}.tmp"
|
||||
12
ci/envelope_rpm.sh
Normal file
12
ci/envelope_rpm.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
ls $CI_PROJECT_DIR/build/*.rpm
|
||||
|
||||
BIN_TO_PROTECT_IN_RPM="${INSTALL_PREFIX}/bin/stellar"
|
||||
RPMS_FULL_PATH=$(ls $CI_PROJECT_DIR/build/*.rpm | grep -v debug | grep -v devel)
|
||||
echo "RPMS_TO_BE_ENVELOPE: " $RPMS_FULL_PATH
|
||||
|
||||
for RPM in ${RPMS_FULL_PATH[@]}; do
|
||||
echo "ENVELOPE: " $RPM
|
||||
/root/rebuildrpm_and_envelope.sh $RPM $BIN_TO_PROTECT_IN_RPM $FEATURE_ID $APP_NAME_IN_RPM_SPEC
|
||||
done
|
||||
48
ci/get-nprocessors.sh
Normal file
48
ci/get-nprocessors.sh
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2017 Google Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# This file is typically sourced by another script.
|
||||
# if possible, ask for the precise number of processors,
|
||||
# otherwise take 2 processors as reasonable default; see
|
||||
# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
|
||||
if [ -x /usr/bin/getconf ]; then
|
||||
NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
|
||||
else
|
||||
NPROCESSORS=2
|
||||
fi
|
||||
|
||||
# as of 2017-09-04 Travis CI reports 32 processors, but GCC build
|
||||
# crashes if parallelized too much (maybe memory consumption problem),
|
||||
# so limit to 4 processors for the time being.
|
||||
if [ $NPROCESSORS -gt 4 ]; then
|
||||
echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
|
||||
NPROCESSORS=4
|
||||
fi
|
||||
3
ci/perpare_pulp3_netrc.sh
Normal file
3
ci/perpare_pulp3_netrc.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env sh
|
||||
set -evx
|
||||
echo "machine ${PULP3_SERVER_URL}\nlogin ${PULP3_SERVER_LOGIN}\npassword ${PULP3_SERVER_PASSWORD}\n" >~/.netrc
|
||||
66
ci/travis.sh
Normal file
66
ci/travis.sh
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env sh
|
||||
set -evx
|
||||
|
||||
chmod +x ci/get-nprocessors.sh
|
||||
. ci/get-nprocessors.sh
|
||||
|
||||
# if possible, ask for the precise number of processors,
|
||||
# otherwise take 2 processors as reasonable default; see
|
||||
# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
|
||||
if [ -x /usr/bin/getconf ]; then
|
||||
NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
|
||||
else
|
||||
NPROCESSORS=2
|
||||
fi
|
||||
|
||||
# as of 2017-09-04 Travis CI reports 32 processors, but GCC build
|
||||
# crashes if parallelized too much (maybe memory consumption problem),
|
||||
# so limit to 4 processors for the time being.
|
||||
if [ $NPROCESSORS -gt 4 ]; then
|
||||
echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
|
||||
NPROCESSORS=4
|
||||
fi
|
||||
|
||||
# Tell make to use the processors. No preceding '-' required.
|
||||
MAKEFLAGS="j${NPROCESSORS}"
|
||||
export MAKEFLAGS
|
||||
|
||||
env | sort
|
||||
|
||||
# Set default values to OFF for these variables if not specified.
|
||||
: "${NO_EXCEPTION:=OFF}"
|
||||
: "${NO_RTTI:=OFF}"
|
||||
: "${COMPILER_IS_GNUCXX:=OFF}"
|
||||
|
||||
# Install dependency from YUM
|
||||
yum install -y libpcap-devel
|
||||
|
||||
if [ $ASAN_OPTION ]; then
|
||||
source /opt/rh/devtoolset-7/enable
|
||||
fi
|
||||
|
||||
mkdir build || true
|
||||
cd build
|
||||
|
||||
cmake3 -DCMAKE_CXX_FLAGS=$CXX_FLAGS \
|
||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-DASAN_OPTION=$ASAN_OPTION \
|
||||
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
|
||||
-DTFE_VERSION_DAILY_BUILD=$TESTING_VERSION_BUILD \
|
||||
..
|
||||
|
||||
make
|
||||
make test
|
||||
|
||||
if [ -n "${PACKAGE}" ]; then
|
||||
make package
|
||||
cp ~/rpm_upload_tools.py ./
|
||||
python3 rpm_upload_tools.py ${PULP3_REPO_NAME} ${PULP3_DIST_NAME} *.rpm
|
||||
fi
|
||||
|
||||
if [ -n "${UPLOAD_SYMBOL_FILES}" ]; then
|
||||
rpm -i stellar*debuginfo*.rpm
|
||||
ls -ahl /usr/lib/debug/opt/tsg/stellar/bin/
|
||||
cp /usr/lib/debug/opt/tsg/stellar/bin/stellar*debug /tmp/stellar.debuginfo.${CI_COMMIT_SHORT_SHA}
|
||||
sentry-cli upload-dif -t elf /tmp/stellar.debuginfo.${CI_COMMIT_SHORT_SHA}
|
||||
fi
|
||||
21
ci/upload_enveloped_rpm.sh
Normal file
21
ci/upload_enveloped_rpm.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
cd $CI_PROJECT_DIR/build/
|
||||
cp ~/rpm_upload_tools.py ./
|
||||
|
||||
ls -ahl *.rpm
|
||||
|
||||
RPM_IS_EL7=$(ls -ahl *-pr-*.rpm | grep el7 | wc -l)
|
||||
RPM_IS_EL8=$(ls -ahl *-pr-*.rpm | grep el8 | wc -l)
|
||||
|
||||
if [ $RPM_IS_EL7 -eq 1 ]; then
|
||||
echo "====== Upload the packed RPM package for CentOS7 ======"
|
||||
python3 rpm_upload_tools.py ${PULP3_REPO_NAME_EL7} ${PULP3_DIST_NAME_EL7} *-pr-*el7*.rpm
|
||||
fi
|
||||
|
||||
if [ $RPM_IS_EL8 -eq 1 ]; then
|
||||
echo "====== Upload the packed RPM package for CentOS8 ======"
|
||||
python3 rpm_upload_tools.py ${PULP3_REPO_NAME_EL8} ${PULP3_DIST_NAME_EL8} *-pr-*el8*.rpm
|
||||
fi
|
||||
|
||||
rm -rf *.rpm
|
||||
39
cmake/FindSYSTEMD.cmake
Normal file
39
cmake/FindSYSTEMD.cmake
Normal file
@@ -0,0 +1,39 @@
|
||||
# - Find SystemdDaemon
|
||||
# Find the systemd daemon library
|
||||
#
|
||||
# This module defines the following variables:
|
||||
# SYSTEMD_FOUND - True if library and include directory are found
|
||||
# If set to TRUE, the following are also defined:
|
||||
# SYSTEMD_INCLUDE_DIRS - The directory where to find the header file
|
||||
# SYSTEMD_LIBRARIES - Where to find the library file
|
||||
#
|
||||
# For conveniance, these variables are also set. They have the same values
|
||||
# than the variables above. The user can thus choose his/her prefered way
|
||||
# to write them.
|
||||
# SYSTEMD_LIBRARY
|
||||
# SYSTEMD_INCLUDE_DIR
|
||||
#
|
||||
# This file is in the public domain
|
||||
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(SYSTEMD libsystemd)
|
||||
|
||||
if(NOT SYSTEMD_FOUND)
|
||||
find_path(SYSTEMD_INCLUDE_DIRS NAMES systemd/sd-daemon.h
|
||||
DOC "The Systemd include directory")
|
||||
|
||||
find_library(SYSTEMD_LIBRARIES NAMES systemd
|
||||
DOC "The Systemd library")
|
||||
|
||||
# Use some standard module to handle the QUIETLY and REQUIRED arguments, and
|
||||
# set SYSTEMD_FOUND to TRUE if these two variables are set.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SYSTEMD REQUIRED_VARS SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS)
|
||||
|
||||
if(SYSTEMD_FOUND)
|
||||
set(SYSTEMD_LIBRARY ${SYSTEMD_LIBRARIES})
|
||||
set(SYSTEMD_INCLUDE_DIR ${SYSTEMD_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES)
|
||||
35
cmake/Package.cmake
Normal file
35
cmake/Package.cmake
Normal file
@@ -0,0 +1,35 @@
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CPACK_PACKAGE_NAME "stellar-debug")
|
||||
else()
|
||||
set(CPACK_PACKAGE_NAME "stellar")
|
||||
endif()
|
||||
|
||||
message(STATUS "Package: ${CPACK_PACKAGE_NAME}")
|
||||
|
||||
set(CPACK_PACKAGE_VENDOR "TSG")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${STELLAR_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${STELLAR_VERSION_MINOR}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${STELLAR_VERSION_PATCH}.${STELLAR_DESCRIBE}")
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
# RPM Build
|
||||
set(CPACK_GENERATOR "RPM")
|
||||
set(CPACK_RPM_AUTO_GENERATED_FILE_NAME ON)
|
||||
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQPROV "no")
|
||||
set(CPACK_RPM_PACKAGE_RELEASE_DIST on)
|
||||
set(CPACK_RPM_DEBUGINFO_PACKAGE on)
|
||||
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PostInstall.in)
|
||||
set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PostUninstall.in)
|
||||
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PreUninstall.in)
|
||||
|
||||
# Must uninstall the debug package before install release package
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CPACK_RPM_PACKAGE_CONFLICTS "stellar")
|
||||
else()
|
||||
set(CPACK_RPM_PACKAGE_CONFLICTS "stellar-debug")
|
||||
endif()
|
||||
|
||||
# Setup %config(noreplace)
|
||||
set(CPACK_RPM_USER_FILELIST "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/conf/stellar/stellar.conf")
|
||||
include(CPack)
|
||||
@@ -1,58 +1,47 @@
|
||||
|
||||
# Using autorevision.sh to generate version information
|
||||
|
||||
set(__SOURCE_AUTORESIVISION ${CMAKE_SOURCE_DIR}/cmake/autorevision.sh)
|
||||
set(__SOURCE_AUTORESIVISION ${CMAKE_SOURCE_DIR}/autorevision.sh)
|
||||
set(__AUTORESIVISION ${CMAKE_BINARY_DIR}/autorevision.sh)
|
||||
set(__VERSION_CACHE ${CMAKE_BINARY_DIR}/version.txt)
|
||||
set(__VERSION_CACHE ${CMAKE_SOURCE_DIR}/version.txt)
|
||||
set(__VERSION_CONFIG ${CMAKE_BINARY_DIR}/version.cmake)
|
||||
|
||||
file(COPY ${__SOURCE_AUTORESIVISION} DESTINATION ${CMAKE_BINARY_DIR}
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
# execute autorevision.sh to generate version information
|
||||
execute_process(COMMAND ${__AUTORESIVISION} -t cmake -o ${__VERSION_CACHE}
|
||||
OUTPUT_FILE ${__VERSION_CONFIG} ERROR_QUIET)
|
||||
# Execute autorevision.sh to generate version information
|
||||
execute_process(COMMAND ${__AUTORESIVISION} -t cmake -o ${__VERSION_CACHE} OUTPUT_FILE ${__VERSION_CONFIG})
|
||||
include(${__VERSION_CONFIG})
|
||||
|
||||
# extract major, minor, patch version from git tag
|
||||
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VCS_TAG}")
|
||||
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VCS_TAG}")
|
||||
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${VCS_TAG}")
|
||||
# Extract major, minor, patch version from git tag
|
||||
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" STELLAR_VERSION_MAJOR "${VCS_TAG}")
|
||||
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" STELLAR_VERSION_MINOR "${VCS_TAG}")
|
||||
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" STELLAR_VERSION_PATCH "${VCS_TAG}")
|
||||
string(REGEX REPLACE "[T\\:\\+\\-]" "" STELLAR_VERSION_DATE "${VCS_DATE}")
|
||||
|
||||
string(REGEX REPLACE "[T\\:\\+\\-]" "" VERSION_DATE "${VCS_DATE}")
|
||||
|
||||
if(VERSION_DAILY_BUILD)
|
||||
set(VERSION_PATCH ${VERSION_PATCH}.${VERSION_DATE})
|
||||
if(STELLAR_VERSION_DAILY_BUILD)
|
||||
set(STELLAR_VERSION_PATCH ${STELLAR_VERSION_PATCH}.${STELLAR_VERSION_DATE})
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT VERSION_MAJOR)
|
||||
set(VERSION_MAJOR 1)
|
||||
if(NOT STELLAR_VERSION_MAJOR)
|
||||
set(STELLAR_VERSION_MAJOR 3)
|
||||
endif()
|
||||
|
||||
if(NOT VERSION_MINOR)
|
||||
set(VERSION_MINOR 0)
|
||||
if(NOT STELLAR_VERSION_MINOR)
|
||||
set(STELLAR_VERSION_MINOR 0)
|
||||
endif()
|
||||
|
||||
if(NOT VERSION_PATCH)
|
||||
set(VERSION_PATCH 0)
|
||||
if(NOT STELLAR_VERSION_PATCH)
|
||||
set(STELLAR_VERSION_PATCH 0)
|
||||
endif()
|
||||
|
||||
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
set(VERSION_BUILD "${VCS_SHORT_HASH}")
|
||||
set(STELLAR_DESCRIBE "${VCS_SHORT_HASH}")
|
||||
set(STELLAR_VERSION "${STELLAR_VERSION_MAJOR}.${STELLAR_VERSION_MINOR}.${STELLAR_VERSION_PATCH}")
|
||||
set(STELLAR_GIT_VERSION "${STELLAR_VERSION_MAJOR}.${STELLAR_VERSION_MINOR}.${STELLAR_VERSION_PATCH}-${STELLAR_DESCRIBE}")
|
||||
|
||||
# print information
|
||||
message(STATUS "Version: ${VERSION}-${VERSION_BUILD}")
|
||||
# Replace .- with _
|
||||
string(REGEX REPLACE "[\\.\\-]" "_" STELLAR_VAR_VERSION "${STELLAR_GIT_VERSION}")
|
||||
|
||||
option(DEFINE_GIT_VERSION "Set DEFINE_GIT_VERSION to TRUE or FALSE" TRUE)
|
||||
|
||||
if(DEFINE_GIT_VERSION)
|
||||
|
||||
set(GIT_VERSION "${VERSION}-${CMAKE_BUILD_TYPE}-${VERSION_BUILD}-${VCS_BRANCH}-${VCS_DATE}")
|
||||
message(STATUS "GIT_VERSION: ${GIT_VERSION}")
|
||||
string(REGEX REPLACE "[-:+/\\.]" "_" GIT_VERSION ${GIT_VERSION})
|
||||
|
||||
add_definitions(-DGIT_VERSION=\"${GIT_VERSION}\")
|
||||
|
||||
endif()
|
||||
# Print information
|
||||
message(STATUS "Welcome to stateful network function development platform, Version: ${STELLAR_GIT_VERSION}")
|
||||
add_definitions(-DSTELLAR_GIT_VERSION=\"${STELLAR_GIT_VERSION}\")
|
||||
add_definitions(-DSTELLAR_VAR_VERSION=${STELLAR_VAR_VERSION})
|
||||
1
conf/CMakeLists.txt
Normal file
1
conf/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
install(DIRECTORY stellar DESTINATION conf COMPONENT Profile)
|
||||
0
conf/stellar/stellar.conf
Normal file
0
conf/stellar/stellar.conf
Normal file
@@ -84,7 +84,7 @@ extern "C" void custom_event_plugin_tcp_entry(const struct stellar_session *sess
|
||||
if (*per_tcp_session_pme == NULL)
|
||||
{
|
||||
struct tcp_session_pme *cur_ctx = tcp_session_pme_create();
|
||||
snprintf(cur_ctx->data, 6, "tcp******");
|
||||
memcpy(cur_ctx->data, "custom_event_plugin_tcp_entry", strlen("custom_event_plugin_tcp_entry"));
|
||||
*per_tcp_session_pme = *&cur_ctx;
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ extern "C" void custom_event_plugin_custom_entry(const struct stellar_session *s
|
||||
if (*per_custom_session_pme == NULL)
|
||||
{
|
||||
struct custom_session_pme *cur_ctx = custom_session_pme_create();
|
||||
snprintf(cur_ctx->data, 6, "custom******");
|
||||
memcpy(cur_ctx->data, "custom_event_plugin_custom_entry", strlen("custom_event_plugin_custom_entry"));
|
||||
*per_custom_session_pme = *&cur_ctx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ extern "C" void http_event_plugin_entry(const struct stellar_session *session, e
|
||||
if (*per_http_session_pme == NULL)
|
||||
{
|
||||
struct http_session_pme *cur_ctx = http_session_pme_create();
|
||||
snprintf(cur_ctx->data, 6, "http******");
|
||||
memcpy(cur_ctx->data, "http_event_plugin_entry", strlen("http_event_plugin_entry"));
|
||||
*per_http_session_pme = *&cur_ctx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ add_executable(gtest_packet_io
|
||||
|
||||
target_link_libraries(
|
||||
gtest_packet_io
|
||||
gtest_main
|
||||
gtest
|
||||
packet_io
|
||||
)
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ static int plugin_manager_init_plugins(struct plugin_manager *plug_mgr)
|
||||
return -1;
|
||||
}
|
||||
double percentage = ((double)(i + 1)) / ((double)plug_mgr->used_module_num) * ((double)100);
|
||||
plugin_manager_log(INFO, "Plugin initialization progress: [%.2f%]", percentage);
|
||||
plugin_manager_log(INFO, "Plugin initialization progress: [%.2f%%]", percentage);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -419,7 +419,7 @@ void plugin_manager_dispatch(struct plugin_manager *plug_mgr, struct stellar_eve
|
||||
plug_ctx = plugin_manager_create_plugin_ctx(plug_mgr, session_name);
|
||||
if (plug_ctx == NULL)
|
||||
{
|
||||
plugin_manager_log(ERROR, "can't create runtime plugin ctx for session '%s', Please check whether the callback is registered in the current session");
|
||||
plugin_manager_log(ERROR, "can't create runtime plugin ctx for session '%s', Please check whether the callback is registered in the current session", session_name);
|
||||
return;
|
||||
}
|
||||
stellar_event_set_plugin_ctx(event, plug_ctx);
|
||||
|
||||
@@ -139,7 +139,7 @@ int plugin_manager_module_init(struct plugin_manager_module *module)
|
||||
return -1;
|
||||
}
|
||||
|
||||
long elapsed = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_nsec - start.tv_nsec) / 1000;
|
||||
long long elapsed = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_nsec - start.tv_nsec) / 1000;
|
||||
plugin_manager_log(INFO, "plugin dynamic library '%s' init success, using '%lld' us", module->lib_path, elapsed);
|
||||
|
||||
return 0;
|
||||
@@ -157,7 +157,7 @@ void plugin_manager_module_exit(struct plugin_manager_module *module)
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
module->exit_cb_ptr = NULL;
|
||||
|
||||
long elapsed = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_nsec - start.tv_nsec) / 1000;
|
||||
long long elapsed = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_nsec - start.tv_nsec) / 1000;
|
||||
plugin_manager_log(INFO, "plugin dynamic library '%s' exit success, using '%lld' us", module->lib_path, elapsed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ add_executable(gtest_plugin_manager
|
||||
|
||||
target_link_libraries(
|
||||
gtest_plugin_manager
|
||||
gtest_main
|
||||
gtest
|
||||
plugin_manager
|
||||
session_manager
|
||||
toml
|
||||
|
||||
@@ -184,7 +184,7 @@ TEST(PLUGIN_MANAGER_TEST, plugin_mangager_config_CUSTOM)
|
||||
|
||||
EXPECT_STREQ(config->session_section[2].session_name, "CUSTOM");
|
||||
EXPECT_STREQ(config->session_section[2].cb_func_name, "custom_event_plugin_custom_entry");
|
||||
EXPECT_TRUE(config->session_section[2].event == (0x01 << 1) | (0x01 << 3) | (0x01 << 5));
|
||||
EXPECT_TRUE(config->session_section[2].event == (enum session_event_type)((0x01 << 1) | (0x01 << 3) | (0x01 << 5)));
|
||||
|
||||
plugin_mangager_config_dump(config);
|
||||
plugin_mangager_config_destory(config);
|
||||
@@ -377,28 +377,28 @@ TEST(PLUGIN_MANAGER_TEST, plugin_manager_dispatch_TCP)
|
||||
plugin_manager_dispatch(plug_mgr, &event);
|
||||
pme = (struct tcp_session_pme *)pm_session_get_plugin_pme(&session);
|
||||
EXPECT_TRUE(pme->flags == SESSION_EVENT_OPENING);
|
||||
EXPECT_STREQ(pme->data, "tcp***");
|
||||
EXPECT_STREQ(pme->data, "custom_event_plugin_tcp_entry");
|
||||
|
||||
// run evencb
|
||||
event_data.type = SESSION_EVENT_RAWPKT;
|
||||
plugin_manager_dispatch(plug_mgr, &event);
|
||||
pme = (struct tcp_session_pme *)pm_session_get_plugin_pme(&session);
|
||||
EXPECT_TRUE(pme->flags == SESSION_EVENT_RAWPKT);
|
||||
EXPECT_STREQ(pme->data, "tcp***");
|
||||
EXPECT_STREQ(pme->data, "custom_event_plugin_tcp_entry");
|
||||
|
||||
// run evencb
|
||||
event_data.type = SESSION_EVENT_ORDPKT;
|
||||
plugin_manager_dispatch(plug_mgr, &event);
|
||||
pme = (struct tcp_session_pme *)pm_session_get_plugin_pme(&session);
|
||||
EXPECT_TRUE(pme->flags == SESSION_EVENT_ORDPKT);
|
||||
EXPECT_STREQ(pme->data, "tcp***");
|
||||
EXPECT_STREQ(pme->data, "custom_event_plugin_tcp_entry");
|
||||
|
||||
// run evencb
|
||||
event_data.type = SESSION_EVENT_META;
|
||||
plugin_manager_dispatch(plug_mgr, &event);
|
||||
pme = (struct tcp_session_pme *)pm_session_get_plugin_pme(&session);
|
||||
EXPECT_TRUE(pme->flags == SESSION_EVENT_META);
|
||||
EXPECT_STREQ(pme->data, "tcp***");
|
||||
EXPECT_STREQ(pme->data, "custom_event_plugin_tcp_entry");
|
||||
|
||||
// run evencb
|
||||
event_data.type = SESSION_EVENT_CLOSING;
|
||||
|
||||
@@ -112,7 +112,7 @@ extern "C" void custom_event_plugin_tcp_entry(const struct stellar_session *sess
|
||||
if (*per_tcp_session_pme == NULL)
|
||||
{
|
||||
struct tcp_session_pme *cur_ctx = tcp_session_pme_create();
|
||||
memcpy(cur_ctx->data, "tcp***", 6);
|
||||
memcpy(cur_ctx->data, "custom_event_plugin_tcp_entry", strlen("custom_event_plugin_tcp_entry"));
|
||||
cur_ctx->flags = SESSION_EVENT_OPENING;
|
||||
*per_tcp_session_pme = *&cur_ctx;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include "sdk/include/session.h"
|
||||
|
||||
void http_decoder(const struct stellar_session *s, enum session_event_type event, struct stellar_packet *p, const char *payload, uint16_t len, void **pme)
|
||||
{
|
||||
struct stellar_session_event_extras *info;
|
||||
struct stellar_session_event_extras *info = NULL;
|
||||
struct stellar_session *new_session = session_manager_session_derive(s, "HTTP");
|
||||
|
||||
session_manager_trigger_event(new_session, SESSION_EVENT_OPENING, info);
|
||||
|
||||
@@ -7,7 +7,7 @@ add_executable(gtest_stellar
|
||||
|
||||
target_link_libraries(
|
||||
gtest_stellar
|
||||
gtest_main
|
||||
gtest
|
||||
)
|
||||
|
||||
include(GoogleTest)
|
||||
|
||||
31
vendor/CMakeLists.txt
vendored
31
vendor/CMakeLists.txt
vendored
@@ -1,10 +1,21 @@
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
#URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
|
||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/googletest-release-1.8.0.tar.gz
|
||||
URL_MD5 16877098823401d1bf2ed7891d7dce36
|
||||
)
|
||||
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
include(ExternalProject)
|
||||
|
||||
# GoogleTest
|
||||
ExternalProject_Add(googletest PREFIX googletest
|
||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/googletest-release-1.8.0.tar.gz
|
||||
URL_MD5 16877098823401d1bf2ed7891d7dce36
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
||||
|
||||
ExternalProject_Get_Property(googletest INSTALL_DIR)
|
||||
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
|
||||
|
||||
add_library(gtest STATIC IMPORTED GLOBAL)
|
||||
add_dependencies(gtest googletest)
|
||||
set_property(TARGET gtest PROPERTY IMPORTED_LOCATION ${INSTALL_DIR}/lib/libgtest.a)
|
||||
set_property(TARGET gtest PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
|
||||
set_property(TARGET gtest PROPERTY INTERFACE_LINK_LIBRARIES pthread)
|
||||
|
||||
add_library(gmock STATIC IMPORTED GLOBAL)
|
||||
add_dependencies(gmock googletest)
|
||||
set_property(TARGET gmock PROPERTY IMPORTED_LOCATION ${INSTALL_DIR}/lib/libgmock.a)
|
||||
set_property(TARGET gmock PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
|
||||
Reference in New Issue
Block a user