Commit 4557e4d4 authored by Ciarán Ó Rourke's avatar Ciarán Ó Rourke
Browse files

Get CI running on CentOS8

Change log:
* get unit tests and integration tests working for default job
* get format job working
* satisfy clang-format
* get Documentation job working
* use custom target_link_system_libraries command to force system
includes
* statements inside braces to satisfy clang-tidy
* remove clang-tidy macro checks
parent 3847d8d1
Pipeline #2213 passed with stages
in 14 minutes and 18 seconds
......@@ -70,9 +70,5 @@ CheckOptions:
value: lower_case
- key: readability-identifier-naming.TemplateParameterCase
value: CamelCase
- key: readability-identifier-naming.MacroDefinitionCase
value: UPPER_CASE
- key: readability-identifier-naming.MacroDefinitionPrefix
value: DEIMOS_
...
image: ciaranorourke/fiphoboserver:debian
image: ciaranorourke/deimos:centos8
.snippets:
- &start_phobos
/home/superfiphoboserver/tools/build_phobos.sh -r
/home/superdeimos/start-db.sh
- &configure
mkdir build
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DEPS_DIR}/phobos/lib"
&& mkdir build
&& pushd build
&& (
set -x;
cmake
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_C_COMPILER=${CC}
-DCMAKE_CXX_COMPILER=${CXX}
-DDEIMOS_BUILD_TESTS="${DEIMOS_BUILD_TESTS}"
-DCMAKE_PREFIX_PATH="${DEPS_DIR}"
-DCUSTOM_DOCU_PATH="${DEIMOS_DOC_DIR}"
-DDEIMOS_BUILD_DOCUMENTATION="${DEIMOS_BUILD_DOCUMENTATION}"
-DDEIMOS_AUTHORISATION="${DEIMOS_AUTHORISATION}"
..
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_C_COMPILER=${CC}
-DCMAKE_CXX_COMPILER=${CXX}
-DCMAKE_C_FLAGS="$(pkg-config glib-2.0 --cflags) -isystem ${DEPS_DIR}/phobos/include"
-DCMAKE_CXX_FLAGS="$(pkg-config glib-2.0 --cflags) -isystem ${DEPS_DIR}/phobos/include -isystem ${DEPS_DIR}/spdlog/include"
-DCMAKE_EXE_LINKER_FLAGS="-L ${DEPS_DIR}/phobos/lib"
-DDEIMOS_BUILD_TESTS="${DEIMOS_BUILD_TESTS}"
-DCMAKE_PREFIX_PATH="${DEPS_DIR}/phobos;${DEPS_DIR}/proxygen;${DEPS_DIR}/folly;${DEPS_DIR}/fmt;${DEPS_DIR}/fizz;${DEPS_DIR}/wangle;${DEPS_DIR}/gflags"
-DCMAKE_INSTALL_PREFIX="${DEPS_DIR}" \
-DCUSTOM_DOCU_PATH="${DEIMOS_DOC_DIR}"
-DDEIMOS_BUILD_DOCUMENTATION="${DEIMOS_BUILD_DOCUMENTATION}"
-DDEIMOS_AUTHORISATION="${DEIMOS_AUTHORISATION}"
..
)
&& popd
- &build
make -C build
- &unit_test
make -C build test ARGS=-V
&& pushd build/test/unit_tests
&& ../tests
&& popd
- &integration_test
pushd build/test/integration_tests
&& python3 -m unittest client
......@@ -37,10 +39,11 @@ image: ciaranorourke/fiphoboserver:debian
default_cmake_variables: &default_cmake_variables
CC: gcc
CXX: g++
DEPS_DIR: /home/superfiphoboserver/build/install
DEPS_DIR: /home/superdeimos/build/install
DEIMOS_DOC_DIR: ""
DEIMOS_BUILD_TESTS: "ON"
DEIMOS_AUTHORISATION: "ON"
DEIMOS_BUILD_DOCUMENTATION: "OFF"
.default_job: &default_job
tags:
......@@ -48,11 +51,11 @@ image: ciaranorourke/fiphoboserver:debian
variables:
<<: *default_cmake_variables
before_script:
- apt-get update
- apt-get install -y
- dnf update
- dnf install -y
cmake
clang clang-tidy
libspdlog-dev
clang clang-tools-extra
- pip3 install boto3
script:
- *start_phobos
- *configure
......@@ -72,10 +75,11 @@ Format:
CC: clang
CXX: clang++
before_script:
- apt-get update
- apt-get install -y
- dnf update
- dnf install -y
git
clang-format
clang
diffutils
- pip3 install yapf
script:
- ./tools/run_format.sh
......@@ -105,13 +109,14 @@ Documentation:
CC: clang
CXX: clang++
before_script:
- apt-get update
- apt-get install -y
- dnf update
- dnf install -y
cmake
git
doxygen
graphviz
clang
libspdlog-dev
texlive texlive-epstopdf
script:
- *configure
- make -C build/doc
......
......@@ -73,6 +73,7 @@ option(
#
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
include(target_link_system_libraries)
# set(Boost_DEBUG 1)
......
#
# target_link_system_libraries(<target>
# <PRIVATE|PUBLIC|INTERFACE> <item>...
# [<PRIVATE|PUBLIC|INTERFACE> <item>...]...)
#
# This has the same behaviour as `target_link_libraries`, except any
# INTERFACE_INCLUDE_DIRECTORIES are re-included as
# INTERFACE_SYSTEM_INCLUDE_DIRECTORIES and any INTERFACE_LINK_LIBRARIES are
# explicitly linked to the target using this function, which will recursively
# add any INTERFACE_INCLUDE_DIRECTORIES as INTERFACE_SYSTEM_INCLUDE_DIRECTORIES.
#
function(target_link_system_libraries target visibility item)
set(options)
set(one_value_keywords)
set(multi_value_keywords PUBLIC PRIVATE INTERFACE)
cmake_parse_arguments(
PARSE_ARGV 1 "_link"
"${options}" "${one_value_keywords}" "${multi_value_keywords}"
)
# Pass arguments to target_link_libraries as usual
target_link_libraries(${ARGV})
# For each library, get the INTERFACE_INCLUDE_DIRECTORIES property,
# and re-include them as target_include_directories(... SYSTEM ...)
foreach(linkage PUBLIC;PRIVATE;INTERFACE)
foreach(lib ${_link_${linkage}})
message("lib: ${lib}")
get_target_property(
_interface_includes ${lib} INTERFACE_INCLUDE_DIRECTORIES
)
get_target_property(
_interface_system_includes ${lib} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
)
get_target_property(
_interface_links ${lib} INTERFACE_LINK_LIBRARIES
)
if(_interface_includes)
target_include_directories(
${target} SYSTEM ${linkage} ${_interface_includes}
)
endif()
endforeach()
endforeach()
endfunction(target_link_system_libraries)
......@@ -18,8 +18,8 @@ add_executable(
target_compile_features(deimos PUBLIC cxx_std_14)
target_link_libraries(deimos PUBLIC proxygen::proxygen)
target_link_libraries(deimos PUBLIC proxygen::proxygenhttpserver)
target_link_system_libraries(deimos PUBLIC proxygen::proxygen)
target_link_system_libraries(deimos PUBLIC proxygen::proxygenhttpserver)
target_link_libraries(deimos PUBLIC server)
......
......@@ -21,6 +21,6 @@ if(NOT DEIMOS_AUTHORISATION)
endif(NOT DEIMOS_AUTHORISATION)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -O1")
target_link_libraries(server PUBLIC proxygen::proxygen)
target_link_system_libraries(server PUBLIC proxygen::proxygen)
target_link_libraries(server PUBLIC stream)
target_link_libraries(server PUBLIC s3_utilities)
......@@ -7,6 +7,6 @@ add_library(
s3_authorisation.cc
)
target_link_libraries(s3_utilities PUBLIC proxygen::proxygen)
target_link_libraries(s3_utilities PUBLIC OpenSSL::Crypto)
target_link_system_libraries(s3_utilities PUBLIC proxygen::proxygen)
target_link_system_libraries(s3_utilities PUBLIC OpenSSL::Crypto)
......@@ -6,7 +6,6 @@ add_library(
)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -O1")
target_include_directories(storage PUBLIC /usr/include/glib-2.0)
target_include_directories(
storage SYSTEM PUBLIC
......@@ -14,4 +13,4 @@ target_include_directories(
${PHOBOS_INCLUDE_DIR}
)
target_link_libraries(storage PUBLIC phobos_cpp_wrapper)
target_link_system_libraries(storage PUBLIC phobos_cpp_wrapper)
......@@ -21,33 +21,36 @@
*/
enum rsc_family {
PHO_RSC_INVAL = -1,
PHO_RSC_DISK = 0, /**< Not supported yet */
PHO_RSC_TAPE = 1, /**< Tape, drive tape or tape library */
PHO_RSC_DIR = 2, /**< Directory */
PHO_RSC_DISK = 0, /**< Not supported yet */
PHO_RSC_TAPE = 1, /**< Tape, drive tape or tape library */
PHO_RSC_DIR = 2, /**< Directory */
PHO_RSC_LAST,
PHO_RSC_UNSPEC = PHO_RSC_LAST,
};
static const char * const rsc_family_names[] = {
static const char* const rsc_family_names[] = {
[PHO_RSC_DISK] = "disk",
[PHO_RSC_TAPE] = "tape",
[PHO_RSC_DIR] = "dir",
};
static inline const char *rsc_family2str(enum rsc_family family)
static inline const char* rsc_family2str(enum rsc_family family)
{
if (family >= PHO_RSC_LAST || family < 0)
if (family >= PHO_RSC_LAST || family < 0) {
return NULL;
}
return rsc_family_names[family];
}
static inline enum rsc_family str2rsc_family(const char *str)
static inline enum rsc_family str2rsc_family(const char* str)
{
int i;
for (i = 0; i < PHO_RSC_LAST; i++)
if (!strcmp(str, rsc_family_names[i]))
for (i = 0; i < PHO_RSC_LAST; i++) {
if (strcmp(str, rsc_family_names[i]) == 0) {
return (rsc_family)i;
}
}
return PHO_RSC_INVAL;
}
......@@ -55,8 +58,8 @@ static inline enum rsc_family str2rsc_family(const char *str)
* A simple array of tags (strings)
*/
struct tags {
char **tags; /**< The array of tags */
size_t n_tags; /**< Number of tags */
char** tags; /**< The array of tags */
size_t n_tags; /**< Number of tags */
};
/**
......@@ -66,7 +69,7 @@ struct tags {
enum pho_xfer_flags {
/* put: replace the object if it already exists (_not supported_)
* get: replace the target file if it already exists */
PHO_XFER_OBJ_REPLACE = (1 << 0),
PHO_XFER_OBJ_REPLACE = (1 << 0),
};
/**
......@@ -76,25 +79,25 @@ enum pho_xfer_flags {
* - the operation descriptor
* - the return code for this operation: 0 on success, neg. errno on failure
*/
typedef void (*pho_completion_cb_t)(void *u, const struct pho_xfer_desc *, int);
typedef void (*pho_completion_cb_t)(void* u, const struct pho_xfer_desc*, int);
/**
* Phobos XFer operations.
*/
enum pho_xfer_op {
PHO_XFER_OP_PUT, /**< PUT operation. */
PHO_XFER_OP_GET, /**< GET operation. */
PHO_XFER_OP_GETMD /**< GET metadata operation. */
PHO_XFER_OP_PUT, /**< PUT operation. */
PHO_XFER_OP_GET, /**< GET operation. */
PHO_XFER_OP_GETMD /**< GET metadata operation. */
};
/**
* PUT parameters.
*/
struct pho_xfer_put_params {
ssize_t size; /**< Amount of data to write. */
enum rsc_family family; /**< Targeted resource family. */
const char *layout_name; /**< Name of the layout module to use. */
struct tags tags; /**< Tags to select a media to write. */
ssize_t size; /**< Amount of data to write. */
enum rsc_family family; /**< Targeted resource family. */
const char* layout_name; /**< Name of the layout module to use. */
struct tags tags; /**< Tags to select a media to write. */
};
/**
......@@ -114,13 +117,13 @@ union pho_xfer_params {
* - phobos_put()
*/
struct pho_xfer_desc {
char *xd_objid; /**< Object ID to read or write. */
enum pho_xfer_op xd_op; /**< Operation to perform. */
int xd_fd; /**< FD of the source/destination. */
struct pho_attrs xd_attrs; /**< User defined attributes. */
union pho_xfer_params xd_params; /**< Operation parameters. */
enum pho_xfer_flags xd_flags; /**< See enum pho_xfer_flags doc. */
int xd_rc; /**< Outcome of this xfer. */
char* xd_objid; /**< Object ID to read or write. */
enum pho_xfer_op xd_op; /**< Operation to perform. */
int xd_fd; /**< FD of the source/destination. */
struct pho_attrs xd_attrs; /**< User defined attributes. */
union pho_xfer_params xd_params; /**< Operation parameters. */
enum pho_xfer_flags xd_flags; /**< See enum pho_xfer_flags doc. */
int xd_rc; /**< Outcome of this xfer. */
};
/**
......
......@@ -56,7 +56,7 @@ ssize_t Phobos_file::db_put(size_t size)
m_descriptor.xd_params.put.size = size;
/* TODO: don't hardcode dir */
m_descriptor.xd_params.put.family = str2rsc_family("dir");
ssize_t rc = phobos_put_cpp(&m_descriptor, 1, NULL, NULL);
ssize_t rc = phobos_put_cpp(&m_descriptor, 1, NULL, NULL);
close_file();
if (rc != 0) {
......
......@@ -24,7 +24,7 @@ endif(DEIMOS_AUTHORISATION)
target_compile_features(tests PUBLIC cxx_std_14)
target_link_libraries(tests PUBLIC Catch2::Catch2)
target_link_system_libraries(tests PUBLIC Catch2::Catch2)
target_link_libraries(tests PUBLIC server)
add_custom_command(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment