Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cmakelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linelength=100
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ env:


jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install checkers/linters
run: |
python3 -m pip install cmakelint
- name: Run cmakelint
run: |
mapfile -t names < <(find -name 'CMakeLists.txt' -o -name '*.cmake')
cmakelint "${names[@]}"

build1:
if: |
( github.repository_owner == 'MetOffice' && github.event.pull_request.draft == false )
Expand Down
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ find_package(atlas 0.20.2 REQUIRED)
find_package(oops 1.0.0 REQUIRED)

## Export package info
set(MONIO_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/src
${oops_SOURCE_DIR}/src)
set(MONIO_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/src
${oops_SOURCE_DIR}/src)

set(MONIO_LIBRARIES monio)
get_directory_property(MONIO_DEFINITIONS COMPILE_DEFINITIONS)
Expand Down
3 changes: 1 addition & 2 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
set noparent
linelength=100
filter=+build,-build/c++14,+legal,+readability,+runtime,+whitespace,-runtime/references,-runtime/printf

filter=+build,-build/include,+legal,+readability,+runtime,-runtime/references,+whitespace,-whitespace/indent_namespace
4 changes: 4 additions & 0 deletions src/monio/AtlasReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
******************************************************************************/
#include "AtlasReader.h"

#include <memory>
#include <string>
#include <vector>

#include "oops/util/Logger.h"

#include "Utils.h"
Expand Down
4 changes: 4 additions & 0 deletions src/monio/AtlasWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
******************************************************************************/
#include "AtlasWriter.h"

#include <memory>
#include <string>
#include <vector>

#include "atlas/grid/Iterator.h"
#include "oops/util/Logger.h"

Expand Down
2 changes: 2 additions & 0 deletions src/monio/AttributeBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
******************************************************************************/
#include "AttributeBase.h"

#include <string>

monio::AttributeBase::AttributeBase(
const std::string& name,
const int type):
Expand Down
2 changes: 2 additions & 0 deletions src/monio/AttributeDouble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
******************************************************************************/
#include "AttributeDouble.h"

#include <string>

#include "Constants.h"

monio::AttributeDouble::AttributeDouble(const std::string& name, const double value) :
Expand Down
2 changes: 2 additions & 0 deletions src/monio/AttributeInt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
******************************************************************************/
#include "AttributeInt.h"

#include <string>

#include "Constants.h"

monio::AttributeInt::AttributeInt(const std::string& name, const int value) :
Expand Down
2 changes: 2 additions & 0 deletions src/monio/AttributeString.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
******************************************************************************/
#include "AttributeString.h"

#include <string>

#include "Constants.h"

monio::AttributeString::AttributeString(const std::string& name,
Expand Down
3 changes: 3 additions & 0 deletions src/monio/Data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
******************************************************************************/
#include "Data.h"

#include <map>
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>

#include "oops/util/Logger.h"
Expand Down
3 changes: 3 additions & 0 deletions src/monio/DataContainerBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
******************************************************************************/
#include "DataContainerBase.h"

#include <string>
#include <vector>

monio::DataContainerBase::DataContainerBase(
const std::string& name,
const int type) :
Expand Down
2 changes: 2 additions & 0 deletions src/monio/DataContainerDouble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "DataContainerDouble.h"

#include <stdexcept>
#include <string>
#include <vector>

#include "Constants.h"
#include "Monio.h"
Expand Down
2 changes: 2 additions & 0 deletions src/monio/DataContainerFloat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "DataContainerFloat.h"

#include <stdexcept>
#include <string>
#include <vector>

#include "Constants.h"
#include "Monio.h"
Expand Down
2 changes: 2 additions & 0 deletions src/monio/DataContainerInt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "DataContainerInt.h"

#include <stdexcept>
#include <string>
#include <vector>

#include "Constants.h"
#include "Monio.h"
Expand Down
2 changes: 2 additions & 0 deletions src/monio/File.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <map>
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>

#include "oops/util/Logger.h"

Expand Down
2 changes: 2 additions & 0 deletions src/monio/FileData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
******************************************************************************/
#include "FileData.h"

#include <vector>

monio::FileData::FileData() :
data_(),
metadata_() {}
Expand Down
2 changes: 2 additions & 0 deletions src/monio/Metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <algorithm>
#include <iomanip>
#include <map>
#include <memory>
#include <stdexcept>
#include <string>
#include <utility>
Expand Down
3 changes: 3 additions & 0 deletions src/monio/Monio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
******************************************************************************/
#include "Monio.h"

#include <iostream>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "atlas/parallel/mpi/mpi.h"
Expand Down
3 changes: 3 additions & 0 deletions src/monio/Reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

#include <netcdf>
#include <map>
#include <memory>
#include <sstream>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>

#include "Constants.h"
#include "DataContainerDouble.h"
Expand Down
3 changes: 3 additions & 0 deletions src/monio/Utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
#include <algorithm>
#include <array>
#include <fstream>
#include <map>
#include <memory>
#include <string>
#include <vector>

#include "AttributeBase.h"
#include "DataContainerBase.h"
Expand Down
3 changes: 3 additions & 0 deletions src/monio/UtilsAtlas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
#include "UtilsAtlas.h"

#include <algorithm>
#include <memory>
#include <numeric>
#include <string>
#include <vector>

#include "atlas/functionspace.h"
#include "atlas/grid/Iterator.h"
Expand Down
4 changes: 4 additions & 0 deletions src/monio/Variable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
#include "Variable.h"

#include <algorithm>
#include <map>
#include <memory>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>

#include "AttributeInt.h"
#include "AttributeString.h"
Expand Down
2 changes: 2 additions & 0 deletions src/monio/Writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

#include <netcdf>
#include <map>
#include <memory>
#include <stdexcept>
#include <string>

#include "Constants.h"
#include "DataContainerDouble.h"
Expand Down
75 changes: 43 additions & 32 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ message(STATUS "PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}")
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")

execute_process(COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_SOURCE_DIR}/test/utils/cpplint.py
${CMAKE_BINARY_DIR}/bin/monio_cpplint.py)

ecbuild_add_resources(TARGET monio_test_scripts
SOURCES_PACK ${monio_test_input}
${PROJECT_SOURCE_DIR}/test/utils/cpplint.py)
ecbuild_add_resources(TARGET monio_test_scripts SOURCES_PACK ${monio_test_input})

if(NOT DEFINED MONIO_TESTFILES_DIR)
if(DEFINED ENV{MONIO_TESTFILES_DIR})
Expand Down Expand Up @@ -62,17 +56,31 @@ list(APPEND monio_testinput
)

foreach(FILENAME ${monio_testinput})
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}
${CMAKE_CURRENT_BINARY_DIR}/${FILENAME})
endforeach(FILENAME)
file(
CREATE_LINK
${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}
${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}
SYMBOLIC
)
endforeach()

ecbuild_add_test(TARGET monio_coding_norms
TYPE SCRIPT
COMMAND ${CMAKE_BINARY_DIR}/bin/monio_cpplint.py
ARGS --quiet --recursive
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/test)
# We can make use of CMake's native support of cpplint in future. If we set
# `CMAKE_<LANG>_CPPLINT` (where `<LANG>` is either `C` or `CXX`) to point to
# the `cpplint` executable, it will run `cpplint` as part of the build.
find_program(
CPPLINT_EXECUTABLE
NAMES cpplint
DOC "Path to the cpplint executable"
)
if(CPPLINT_EXECUTABLE)
ecbuild_add_test(
TARGET "${PROJECT_NAME}_coding_norms"
LABELS lint
TYPE SCRIPT
COMMAND "${CPPLINT_EXECUTABLE}"
ARGS --quiet --recursive "${PROJECT_SOURCE_DIR}"
)
endif()

if(NOT IS_DIRECTORY "${MONIO_TESTFILES_DIR}")
message(WARNING
Expand All @@ -81,20 +89,23 @@ if(NOT IS_DIRECTORY "${MONIO_TESTFILES_DIR}")
return()
endif()

ecbuild_add_test(TARGET test_monio_fieldset_write
SOURCES mains/TestFieldSetWrite.cc
ARGS "testinput/fieldset_write.yaml"
LIBS monio
MPI 4)
ecbuild_add_test(
TARGET test_monio_fieldset_write
SOURCES mains/TestFieldSetWrite.cc
ARGS "testinput/fieldset_write.yaml"
LIBS monio
MPI 4)

ecbuild_add_test(TARGET test_monio_state_basic
SOURCES mains/TestStateBasic.cc
ARGS "testinput/state_basic.yaml"
LIBS monio
MPI 4)
ecbuild_add_test(
TARGET test_monio_state_basic
SOURCES mains/TestStateBasic.cc
ARGS "testinput/state_basic.yaml"
LIBS monio
MPI 4)

ecbuild_add_test(TARGET test_monio_state_full
SOURCES mains/TestStateFull.cc
ARGS "testinput/state_full.yaml"
LIBS monio
MPI 4)
ecbuild_add_test(
TARGET test_monio_state_full
SOURCES mains/TestStateFull.cc
ARGS "testinput/state_full.yaml"
LIBS monio
MPI 4)
Loading