Commit 3de22ee2 authored by Ciarán Ó Rourke's avatar Ciarán Ó Rourke
Browse files

* improve scripts for updating subtrees

* pull latest fiphoboserver:devel
parent 11318986
......@@ -16,7 +16,7 @@ WarningsAsErrors: '*'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
User: ExSeisDat
User: FiPhoboServer
CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
......@@ -74,6 +74,6 @@ CheckOptions:
- key: readability-identifier-naming.MacroDefinitionCase
value: UPPER_CASE
- key: readability-identifier-naming.MacroDefinitionPrefix
value: EXSEISDAT_
value: FIPHOBOSERVER_
...
image: ciaranorourke/fiphoboserver:debian
.snippets:
- &start_phobos
/home/superfiphoboserver/tools/build_phobos.sh -r
- &configure
mkdir build
&& pushd build
&& (
set -x;
cmake
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_C_COMPILER=${CC}
-DCMAKE_CXX_COMPILER=${CXX}
-DFIPHOBOSERVER_BUILD_TESTS="${FIPHOBOSERVER_BUILD_TESTS}"
-DCMAKE_PREFIX_PATH="${DEPS_DIR}"
-DCUSTOM_DOCU_PATH="${FIPHOBOSERVER_DOC_DIR}"
..
)
&& popd
- &build
make -C build
- &unit_test
make -C build test ARGS=-V
- &integration_test
cd test/integration_tests
&& python3 -m unittest client
.cmake_variables:
default_cmake_variables: &default_cmake_variables
DEPS_DIR: /home/superfiphoboserver/build/install
FIPHOBOSERVER_DOC_DIR: ""
FIPHOBOSERVER_BUILD_TESTS: "ON"
.default_job: &default_job
tags:
- docker
image: ciaranorourke/fiphoboserver:debian
before_script:
- apt-get update
- apt-get install -y
cmake
clang clang-tidy
script:
- *configure
- *build
- *unit_test
- *integration_test
stages:
- static analysis
- build
- test
Format:
<<: *default_job
stage: static analysis
variables:
CC: clang
CXX: clang++
before_script:
- apt-get update
- apt-get install -y
git
clang-format
- pip3 install yapf
script:
- ./tools/run_format.sh
&& git status
&& git diff-index --quiet HEAD
|| { echo "This commit contains unformatted files! Run tools/run_format.sh on the project to format them correctly."; false; }
Lint:
<<: *default_job
stage: static analysis
variables:
<<: *default_cmake_variables
FIPHOBOSERVER_BUILD_TESTS: "ON"
CC: clang
CXX: clang++
script:
- *configure
- *build
- ./tools/run_lint.sh build
Doxygen:
<<: *default_job
stage: build
variables:
<<: *default_cmake_variables
FIPHOBOSERVER_DOC_DIR: /home/superfiphoboserver/external/doxygen-xml-parser/src
CC: clang
CXX: clang++
before_script:
- apt-get update
- apt-get install -y
cmake
doxygen
graphviz
clang
script:
- *configure
- make -C build/doc
Unit Tests:
<<: *default_job
stage: test
variables:
<<: *default_cmake_variables
FIPHOBOSERVER_BUILD_TESTS: "ON"
CC: gcc
CXX: g++
script:
- *start_phobos
- *configure
- *build
- *unit_test
Integration Tests:
<<: *default_job
stage: test
variables:
<<: *default_cmake_variables
CC: gcc
CXX: g++
script:
- *start_phobos
- *configure
- *build
- *integration_test
......@@ -6,4 +6,24 @@ set(CUSTOM_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
find_package(proxygen REQUIRED)
#
# Provide options to build or skip building the
# programs/libraries in the given subdirectories
#
option(
FIPHOBOSERVER_BUILD_TESTS
"build FiPhoboServer tests. Depends on Catch2."
OFF
)
add_subdirectory(src)
if(CUSTOM_DOCU_PATH)
add_subdirectory(doc)
endif(CUSTOM_DOCU_PATH)
# Build tests
if(FIPHOBOSERVER_BUILD_TESTS)
add_subdirectory(test/unit_tests)
enable_testing()
endif(FIPHOBOSERVER_BUILD_TESTS)
# FIPhoboServer
Build with
## Dependencies Installation Instructions
FIPhoboServer has many dependencies that require much patience to build. It may be simpler to invoke a prebuilt Docker image using a Dockerfile such as;
```
FROM ciaranorourke/fiphoboserver:debian
RUN apt-get -y update && apt-get -y upgrade
RUN apt-get -y install \
[personal installation preferences]
CMD /home/superfiphoboserver/tools/build_phobos.sh -r && [favourite shell]
```
Alternatively, see [SuperFIPhoboServer](oilgas/ltfs/superfiphoboserver) for instructions on how to create your own build environment.
It is recommended to run this Docker image by mounting your local branch of the FIPhoboServer project with `docker run -it -v /path/to/fiphoboserver:/destination [name]:[tag]`
To use the Phobos raid1 layout which is compatible with FIFOs, the following environment variables must be set;
```
cmake -DDEBUG=ON -DCMAKE_PREFIX_PATH=/path/to/proxygen /path/to/CMakeLists/file/
export PHOBOS_STORE_layout=raid1
export PHOBOS_LAYOUT_RAID1_repl_count={1,2,3,...}
```
## Build Instructions
To configure and build FIPhoboServer, a C++14 compatible compiler is required, and CMake >= 3.0.
```
# Make a directory to hold the temporary build files
mkdir -p build
# Change directory to the build directory
cd build
# Configure the FIPhoboServer build using CMake
cmake \
-DCMAKE_PREFIX_PATH=/path/to/proxygen \
[more options below] \
/path/to/fiphoboserver/project
# Build the FIPhoboServer project
make
```
from any directory you want and hope for the best! ;)
### Useful Options
#### Setting Compile/Link Flags
Option | Effect
------ | ------
`-DCMAKE_CXX_COMPILER=...` | Set the C++ compiler.
`-DCMAKE_CXX_FLAGS=...` | Set the flags to pass to the C++ compiler. Overrides the default flags.
#### Enabling / Disabling Sections of FIPhoboServer
Option | Effect
------ | ------
`-DFIPHOBOSERVER_BUILD_TESTS=...` | Set to `ON` to build FIPhoboServer tests and enable the `make test` target, or `OFF` to skip (Default `OFF`).
`-DCUSTOM_DOCU_PATH=...` | Set to `doc/` to build FIPhoboServer documentation or don't set to skip (Default `not set`).
## Testing
Units test can be run with `make -C build tests`, given `FIPHOBOSERVER_BUILD_TESTS` was set to `ON` during the build process.
Integration tests can be run from the `test/integration_tests/` directory with `python -m unittest client`.
Oh, make sure Phobos include directories are under `../phobos/src/include` from the main `CMakeLists.txt`, or change that path in there
## Documentation
The Doxygen documentation can be found [here](doc/Markdown/fiphoboserver).
find_package(Doxygen REQUIRED)
# Write a Doxyfile including the main doc/Doxyfile.
# This sets the @INCLUDE_PATH variable to the project root.
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
@ONLY
)
set(INCLUDE_DOXYFILE "@INCLUDE = ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
# Custom command to run doxygen on build/doc/Doxyfile in the build/doc dir.
# Running doxygen is tied to the html/index.html file.
# TODO: The main dependency is currently doc/Doxyfile, but there should be
# a depencency on *every* file being documented!
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xml/index.xml
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile"
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building the documentation..."
)
if(CUSTOM_DOCU_PATH)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/docu.json
COMMAND python3
ARGS "${CUSTOM_DOCU_PATH}/xml_to_json_parser/xml_to_json_parser.py" "${CMAKE_CURRENT_BINARY_DIR}/xml" docu.json
MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/xml/index.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Parsing the documentation XML..."
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/Markdown/index.md
COMMAND python3
ARGS "${CUSTOM_DOCU_PATH}/json_to_Markdown_converter/json_to_Markdown_converter.py" docu.json "${CMAKE_CURRENT_SOURCE_DIR}/Markdown"
MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/docu.json
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Creating the Markdown documentation..."
)
endif(CUSTOM_DOCU_PATH)
# Target to wire up building the documentation to the ALL target.
add_custom_target(
doc ALL
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/Markdown/index.md
)
# Doxyfile 1.8.13
#
# This is a template file used for configuration in doc/CMakeLists.txt.
#
PROJECT_NAME = FiPhoboServer
# Extraction options
EXTRACT_PRIVATE = NO
EXTRACT_PACKAGE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = YES
EXCLUDE_SYMBOLS = detail
# Generate case sensitive filenames
CASE_SENSE_NAMES = YES
# Warning options
# Warn on everything possible, and fail on warning
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = YES
WARN_AS_ERROR = YES
# Input directories
INPUT = @CMAKE_SOURCE_DIR@/src
EXCLUDE = @CMAKE_SOURCE_DIR@/src/main.cc
EXCLUDE_PATTERNS = */phobos_cpp_wrapper/*
RECURSIVE = YES
# HTML output options
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
GENERATE_TREEVIEW = YES
# Latex font size
FORMULA_FONTSIZE = 10
# Macro options
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
PREDEFINED = __cplusplus
SEARCH_INCLUDES = YES
GENERATE_XML = YES
# <a name='fiphoboserver-FIPhoboServerException' /> public fiphoboserver::FIPhoboServerException
exception class for all user defined exceptions in FiPhboServer
## Inheritance:
Is inherited by [fiphoboserver::IOException][fiphoboserver-IOException], [fiphoboserver::storage::PhobosException][fiphoboserver-storage-PhobosException].
## Protected Attributes
| Name | Description |
| ---- | ---- |
| [m_message](#fiphoboserver-FIPhoboServerException-m_message) | the internal message |
## Public Functions
| Name | Description |
| ---- | ---- |
| [FIPhoboServerException](#fiphoboserver-FIPhoboServerException-FIPhoboServerException) | default constructor |
| [FIPhoboServerException](#fiphoboserver-FIPhoboServerException-FIPhoboServerException-1) | constructor for a message with information on the exception |
| [what](#fiphoboserver-FIPhoboServerException-what) | get information on this exception |
| [get_inner_error](#fiphoboserver-FIPhoboServerException-get_inner_error) | return the inner error value that caused this exception |
## Protected Attributes
### <a name='fiphoboserver-FIPhoboServerException-m_message' /> protected fiphoboserver::FIPhoboServerException::m_message
the internal message
[Go to Top](#fiphoboserver-FIPhoboServerException)
## Public Functions
### <a name='fiphoboserver-FIPhoboServerException-FIPhoboServerException' /> public fiphoboserver::FIPhoboServerException::FIPhoboServerException ()
default constructor
#### Qualifiers:
* inline
[Go to Top](#fiphoboserver-FIPhoboServerException)
### <a name='fiphoboserver-FIPhoboServerException-FIPhoboServerException-1' /> public fiphoboserver::FIPhoboServerException::FIPhoboServerException (const char *message)
constructor for a message with information on the exception
#### Parameters:
| Type | Name | Description |
| ---- | ---- | ---- |
| const char * | message | message explaining what went wrong such that this exception was thrown. |
#### Qualifiers:
* inline
[Go to Top](#fiphoboserver-FIPhoboServerException)
### <a name='fiphoboserver-FIPhoboServerException-what' /> public const char * fiphoboserver::FIPhoboServerException::what () const noexcept override
get information on this exception
#### Returns:
| Type | Description |
| ---- | ---- |
| const char * | A message explaining what this exception is about |
#### Qualifiers:
* const
* inline
* virtual
[Go to Top](#fiphoboserver-FIPhoboServerException)
### <a name='fiphoboserver-FIPhoboServerException-get_inner_error' /> public int fiphoboserver::FIPhoboServerException::get_inner_error () const noexcept
return the inner error value that caused this exception
#### Returns:
| Type | Description |
| ---- | ---- |
| int | |
#### Qualifiers:
* const
* inline
* virtual
[Go to Top](#fiphoboserver-FIPhoboServerException)
[fiphoboserver-IOException]:./IOException.md
[fiphoboserver-storage-PhobosException]:./storage/PhobosException.md
# <a name='fiphoboserver-GetRequestHandler' /> public fiphoboserver::GetRequestHandler
proxygen class implementation for handling GET requests
## Inheritance:
Inherits from RequestHandler.
## Public Functions
| Name | Description |
| ---- | ---- |
| [onRequest](#fiphoboserver-GetRequestHandler-onRequest) | first function to be called when a new request comes in |
| [onBody](#fiphoboserver-GetRequestHandler-onBody) | function called on every body chunk belonging to this message |
| [onEOM](#fiphoboserver-GetRequestHandler-onEOM) | function called when the incoming message is finished |
| [onUpgrade](#fiphoboserver-GetRequestHandler-onUpgrade) | function called on upgrade |
| [requestComplete](#fiphoboserver-GetRequestHandler-requestComplete) | function ... |
| [onError](#fiphoboserver-GetRequestHandler-onError) | function called when an error occurred |
| [onEgressPaused](#fiphoboserver-GetRequestHandler-onEgressPaused) | called when the queue is full. |
| [onEgressResumed](#fiphoboserver-GetRequestHandler-onEgressResumed) | called when the queue is not longer full. |
| [GetRequestHandler](#fiphoboserver-GetRequestHandler-GetRequestHandler) | Constructor for stream class initialization. |
## Public Functions
### <a name='fiphoboserver-GetRequestHandler-onRequest' /> public void fiphoboserver::GetRequestHandler::onRequest (std::unique_ptr< proxygen::HTTPMessage > headers) noexcept override
first function to be called when a new request comes in
#### Parameters:
| Type | Name | Description |
| ---- | ---- | ---- |
| std::unique_ptr< proxygen::HTTPMessage > | headers | headers of the HTTP message this handler was created for |
[Go to Top](#fiphoboserver-GetRequestHandler)
### <a name='fiphoboserver-GetRequestHandler-onBody' /> public void fiphoboserver::GetRequestHandler::onBody (std::unique_ptr< folly::IOBuf > body) noexcept override
function called on every body chunk belonging to this message
#### Parameters:
| Type | Name | Description |
| ---- | ---- | ---- |
| std::unique_ptr< folly::IOBuf > | body | buffer for the body |
This is not used in this case because GET requests don't usually have a body
[Go to Top](#fiphoboserver-GetRequestHandler)
### <a name='fiphoboserver-GetRequestHandler-onEOM' /> public void fiphoboserver::GetRequestHandler::onEOM () noexcept override
function called when the incoming message is finished
[Go to Top](#fiphoboserver-GetRequestHandler)
### <a name='fiphoboserver-GetRequestHandler-onUpgrade' /> public void fiphoboserver::GetRequestHandler::onUpgrade (proxygen::UpgradeProtocol proto) noexcept override
function called on upgrade
#### Parameters:
| Type | Name | Description |
| ---- | ---- | ---- |
| proxygen::UpgradeProtocol | proto | the new protocol |
Not supported in our case!
[Go to Top](#fiphoboserver-GetRequestHandler)