Redesign cmake

Tune the makefile according to new principles, which adds a few bells
and whistles and for clarity.

Synopsis:

* The dependency on opm-common is completely gone. This is reflected in
  travis and appveyor as well. No non-kitware cmake modules are used.
* Directories are flattened, quite a bit - source code is located in the
  lib/ directory if it belongs to opm-parser, and external/ if third
  party.
* The sibling build feature is implemented through cmake's
  export(PACKAGE) rather than implicitly looking through source files.
* Targets explicitly set required public and private include
  directories, compile options and definitions, which cmake will handle
  and propagate
* opm-parser-config.cmake for downstream users is now provided.
* Dependencies are set up using targets. In the future, when cmake 3.x+
  can be used, these should be either targets from newer Find modules,
  or interface libraries.
* Fewer system specific assumptions are coded in, instead we assume
  cmake or users set up system specific details.
* All module wide configuration and looking up libraries is handled in
  the root makefile - all sub directories only set up libraries and
  compile options for the module in question.
* Targets are defined and links handled transitively because cmake now
  is told about them. ${module_LIBRARIES} variables are gone.

This is largely guided by the principles outlined in
https://rix0r.nl/blog/2015/08/13/cmake-guide/

Most source files are just moved - if they have some content change then
it's nothing more than include fixes or similar in order to make them
compile.
This commit is contained in:
Jørgen Kvalsvik 2017-05-23 12:03:08 +02:00
parent 430b216027
commit e884b0664c
796 changed files with 631 additions and 615 deletions

View File

@ -0,0 +1,5 @@
project(opm-parser-applications CXX)
add_executable(opmi opmi.cpp)
target_link_libraries(opmi opmparser)
install(TARGETS opmi DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -8,6 +8,9 @@ configuration:
os: Visual Studio 2015
image: Visual Studio 2015
matrix:
fast_finish: true
platform:
- x64
@ -15,9 +18,8 @@ environment:
BOOST_ROOT: C:/Libraries/boost_1_59_0/boost
BOOST_INCLUDEDIR: C:/Libraries/boost_1_59_0
BOOST_LIBRARYDIR: C:/Libraries/boost_1_59_0/lib64-msvc-14.0
BOOST_FLAGS: -DBoost_USE_MULTITHREAD=ON -DBUILD_SHARED_LIBS=OFF -DBoost_USE_STATIC_LIBS=TRUE -DBOOST_ALL_DYN_LINK=OFF
BOOST_FLAGS: -DBoost_USE_MULTITHREAD=ON -DBUILD_SHARED_LIBS=OFF
BOOST_OPTIONS: -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% -DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% %BOOST_FLAGS%
COMMON_ROOT: "C:/projects/opm-parser/opm-common"
DATA_ROOT: "C:/projects/opm-parser/opm-data/"
GEN: "Visual Studio 14 2015 Win64"
@ -25,13 +27,16 @@ cache:
- opm-data
build_script:
- git clone https://github.com/OPM/opm-common.git
- git -C opm-data pull || git clone https://github.com/OPM/opm-data.git
- git clone https://github.com/statoil/libecl
- cd libecl
- ps: mkdir -p libecl/build
- ps: pushd libecl/build
- cmake C:\projects\opm-parser\libecl -G"%GEN%" -DCMAKE_BUILD_TYPE=%configuration% -DERT_BUILD_CXX=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_PYTHON=OFF
- cmake --build . --config %configuration%
- cd ..
- cmake C:\projects\opm-parser -G"%GEN%" %BOOST_OPTIONS% -DOPM_DATA_ROOT=%DATA_ROOT% -DOPM_COMMON_ROOT="%COMMON_ROOT%" -DCMAKE_BUILD_TYPE=%configuration%
- ps: popd
- mkdir build
- ps: pushd build
- cmake C:\projects\opm-parser -G"%GEN%" %BOOST_OPTIONS% -DOPM_DATA_ROOT=%DATA_ROOT% -DCMAKE_BUILD_TYPE=%configuration%
- cmake --build . --config %configuration%
- ctest -C %configuration% --output-on-failure
- ps: popd

8
external/cjson/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,8 @@
project(opm-cjson C)
add_library(cjson OBJECT cJSON.c)
set_target_properties(cjson PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
target_include_directories(cjson
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
$<INSTALL_INTERFACE:include>
)

View File

@ -1,19 +0,0 @@
set( json_source JsonObject.cpp )
set( json_headers JsonObject.hpp )
if (NOT HAVE_CJSON)
list(APPEND json_source ${PROJECT_SOURCE_DIR}/external/cjson/cJSON.c)
set( CJSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/external )
include_directories(${CJSON_INCLUDE_DIR})
set(CJSON_LIBRARY "")
endif()
add_library(opmjson ${json_source})
target_link_libraries( opmjson ${CJSON_LIBRARY} ${Boost_LIBRARIES} )
set_target_properties(opmjson PROPERTIES VERSION ${opm-parser_VERSION_MAJOR}.${opm-parser_VERSION_MINOR}
SOVERSION ${opm-parser_VERSION_MAJOR})
install( TARGETS opmjson DESTINATION ${CMAKE_INSTALL_LIBDIR} )
foreach ( header ${json_headers} )
install( FILES ${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/opm/json RENAME ${header})
endforeach()
add_subdirectory( tests )

View File

@ -1,5 +0,0 @@
opm_add_test(runjsonTests SOURCES jsonTests.cpp
LIBRARIES opmjson ${Boost_LIBRARIES})
if (NOT MSVC)
set_source_files_properties( jsonTests.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-variable")
endif()

View File

@ -1,2 +0,0 @@
add_subdirectory( share )
add_subdirectory( eclipse )

View File

@ -1,4 +0,0 @@
add_executable(opmi opmi.cpp)
target_link_libraries(opmi opmparser)
install(TARGETS opmi DESTINATION "bin")

View File

@ -1,354 +0,0 @@
include_directories(BEFORE ${PROJECT_BINARY_DIR}/generated-source/include)
add_subdirectory(Parser/tests)
add_subdirectory(Generator/tests)
add_subdirectory(RawDeck/tests)
add_subdirectory(Deck/tests)
add_subdirectory(Units/tests)
add_subdirectory(EclipseState/tests)
add_subdirectory(EclipseState/Schedule/tests)
add_subdirectory(EclipseState/SimulationConfig/tests)
add_subdirectory(EclipseState/Tables/tests)
add_subdirectory(EclipseState/Grid/tests)
add_subdirectory(EclipseState/Util/tests)
add_subdirectory(EclipseState/IOConfig/tests)
add_subdirectory(EclipseState/InitConfig/tests)
add_subdirectory(EclipseState/SummaryConfig/tests)
add_subdirectory(Utility/tests)
add_subdirectory(Applications)
add_subdirectory(IntegrationTests)
set( rawdeck_source
RawDeck/StarToken.cpp
RawDeck/RawKeyword.cpp
RawDeck/RawRecord.cpp )
set( unit_source
Units/UnitSystem.cpp
Units/Dimension.cpp)
set( deck_source
Deck/Deck.cpp
Deck/DeckKeyword.cpp
Deck/DeckRecord.cpp
Deck/DeckItem.cpp
Deck/Section.cpp
)
set( parser_source
Parser/ParseContext.cpp
Parser/MessageContainer.cpp
Parser/ParserEnums.cpp
Parser/ParserKeyword.cpp
Parser/Parser.cpp
Parser/ParserRecord.cpp
Parser/ParserItem.cpp
)
set( generator_source
Generator/KeywordGenerator.cpp
Generator/KeywordLoader.cpp )
set( utility_source
Utility/Functional.cpp
Utility/Stringview.cpp
)
set( build_parser_source
Deck/Deck.cpp
Deck/DeckItem.cpp
Deck/DeckKeyword.cpp
Deck/DeckRecord.cpp
Parser/MessageContainer.cpp
Parser/ParseContext.cpp
Parser/ParserItem.cpp
Parser/ParserKeyword.cpp
Parser/ParserRecord.cpp
Parser/ParserEnums.cpp
RawDeck/RawKeyword.cpp
RawDeck/RawRecord.cpp
RawDeck/StarToken.cpp
Units/Dimension.cpp
Units/UnitSystem.cpp
${generator_source}
${utility_source}
)
set (state_source
EclipseState/EclipseState.cpp
EclipseState/EclipseConfig.cpp
EclipseState/Eclipse3DProperties.cpp
EclipseState/Runspec.cpp
EclipseState/EndpointScaling.cpp
#
EclipseState/checkDeck.cpp
#
EclipseState/Schedule/MessageLimits.cpp
EclipseState/Schedule/OilVaporizationProperties.cpp
EclipseState/Schedule/TimeMap.cpp
EclipseState/Schedule/Schedule.cpp
EclipseState/Schedule/Well.cpp
EclipseState/Schedule/WellProductionProperties.cpp
EclipseState/Schedule/WellInjectionProperties.cpp
EclipseState/Schedule/WellPolymerProperties.cpp
EclipseState/Schedule/WellEconProductionLimits.cpp
EclipseState/Schedule/MSW/Segment.cpp
EclipseState/Schedule/MSW/SegmentSet.cpp
EclipseState/Schedule/MSW/Compsegs.cpp
EclipseState/Schedule/Group.cpp
EclipseState/Schedule/Completion.cpp
EclipseState/Schedule/CompletionSet.cpp
EclipseState/Schedule/ScheduleEnums.cpp
EclipseState/Schedule/GroupTree.cpp
EclipseState/Schedule/Tuning.cpp
EclipseState/Schedule/Events.cpp
#
EclipseState/Tables/JFunc.cpp
EclipseState/Tables/SimpleTable.cpp
EclipseState/Tables/VFPProdTable.cpp
EclipseState/Tables/VFPInjTable.cpp
EclipseState/Tables/TableManager.cpp
EclipseState/Tables/TableContainer.cpp
EclipseState/Tables/TableColumn.cpp
EclipseState/Tables/ColumnSchema.cpp
EclipseState/Tables/TableSchema.cpp
EclipseState/Tables/TableIndex.cpp
EclipseState/Tables/PvtxTable.cpp
EclipseState/Tables/Tables.cpp
#
EclipseState/Grid/SatfuncPropertyInitializers.cpp
EclipseState/Grid/GridDims.cpp
EclipseState/Grid/GridProperty.cpp
EclipseState/Grid/GridProperties.cpp
EclipseState/Grid/Box.cpp
EclipseState/Grid/BoxManager.cpp
EclipseState/Grid/FaceDir.cpp
EclipseState/Grid/TransMult.cpp
EclipseState/Grid/MULTREGTScanner.cpp
EclipseState/Grid/EclipseGrid.cpp
EclipseState/Grid/FaultFace.cpp
EclipseState/Grid/Fault.cpp
EclipseState/Grid/FaultCollection.cpp
EclipseState/Grid/NNC.cpp
EclipseState/Grid/PinchMode.cpp
#
EclipseState/InitConfig/InitConfig.cpp
EclipseState/InitConfig/Equil.cpp
EclipseState/SimulationConfig/SimulationConfig.cpp
EclipseState/SimulationConfig/ThresholdPressure.cpp
EclipseState/SummaryConfig/SummaryConfig.cpp
EclipseState/IOConfig/RestartConfig.cpp
EclipseState/IOConfig/IOConfig.cpp)
#
set( HEADER_FILES
RawDeck/RawConsts.hpp
RawDeck/RawKeyword.hpp
RawDeck/RawRecord.hpp
RawDeck/StarToken.hpp
RawDeck/RawEnums.hpp
#
Deck/Deck.hpp
Deck/DeckKeyword.hpp
Deck/DeckRecord.hpp
Deck/DeckItem.hpp
Deck/Section.hpp
#
Parser/ParserEnums.hpp
Parser/ParserKeyword.hpp
Parser/Parser.hpp
Parser/ParserRecord.hpp
Parser/ParserItem.hpp
Parser/InputErrorAction.hpp
Parser/ParseContext.hpp
Parser/MessageContainer.hpp
#
Generator/KeywordLoader.hpp
Generator/KeywordGenerator.hpp
#
Units/UnitSystem.hpp
Units/Dimension.hpp
Units/Units.hpp
#
EclipseState/EclipseState.hpp
EclipseState/EclipseConfig.hpp
EclipseState/Eclipse3DProperties.hpp
EclipseState/Runspec.hpp
EclipseState/EndpointScaling.hpp
#
EclipseState/checkDeck.hpp
#
EclipseState/Schedule/MessageLimits.hpp
EclipseState/Schedule/OilVaporizationProperties.hpp
EclipseState/Schedule/TimeMap.hpp
EclipseState/Schedule/Schedule.hpp
EclipseState/Schedule/Well.hpp
EclipseState/Schedule/WellProductionProperties.hpp
EclipseState/Schedule/WellInjectionProperties.hpp
EclipseState/Schedule/WellPolymerProperties.hpp
EclipseState/Schedule/WellEconProductionLimits.hpp
EclipseState/Schedule/MSW/Segment.hpp
EclipseState/Schedule/MSW/SegmentSet.hpp
EclipseState/Schedule/MSW/Compsegs.hpp
EclipseState/Schedule/Group.hpp
EclipseState/Schedule/DynamicState.hpp
EclipseState/Schedule/DynamicVector.hpp
EclipseState/Schedule/Completion.hpp
EclipseState/Schedule/CompletionSet.hpp
EclipseState/Schedule/ScheduleEnums.hpp
EclipseState/Schedule/GroupTree.hpp
EclipseState/Schedule/Tuning.hpp
EclipseState/Schedule/Events.hpp
#
EclipseState/Util/OrderedMap.hpp
EclipseState/Util/Value.hpp
#
EclipseState/Grid/Box.hpp
EclipseState/Grid/BoxManager.hpp
EclipseState/Grid/EclipseGrid.hpp
EclipseState/Grid/FaceDir.hpp
EclipseState/Grid/FaultCollection.hpp
EclipseState/Grid/FaultFace.hpp
EclipseState/Grid/Fault.hpp
EclipseState/Grid/GridDims.hpp
EclipseState/Grid/GridProperties.hpp
EclipseState/Grid/GridProperty.hpp
EclipseState/Grid/MinpvMode.hpp
EclipseState/Grid/MULTREGTScanner.hpp
EclipseState/Grid/NNC.hpp
EclipseState/Grid/PinchMode.hpp
EclipseState/Grid/SatfuncPropertyInitializers.hpp
EclipseState/Grid/TransMult.hpp
#
EclipseState/InitConfig/InitConfig.hpp
EclipseState/InitConfig/Equil.hpp
EclipseState/SimulationConfig/SimulationConfig.hpp
EclipseState/SimulationConfig/ThresholdPressure.hpp
EclipseState/SummaryConfig/SummaryConfig.hpp
EclipseState/IOConfig/RestartConfig.hpp
EclipseState/IOConfig/IOConfig.hpp
#
EclipseState/Tables/FlatTable.hpp
EclipseState/Tables/JFunc.hpp
EclipseState/Tables/Tabdims.hpp
EclipseState/Tables/Eqldims.hpp
EclipseState/Tables/Regdims.hpp
EclipseState/Tables/PlyadsTable.hpp
EclipseState/Tables/PvtoTable.hpp
EclipseState/Tables/RocktabTable.hpp
EclipseState/Tables/PvdoTable.hpp
EclipseState/Tables/PvdgTable.hpp
EclipseState/Tables/PvdsTable.hpp
EclipseState/Tables/SimpleTable.hpp
EclipseState/Tables/PlymaxTable.hpp
EclipseState/Tables/PlyrockTable.hpp
EclipseState/Tables/SwofTable.hpp
EclipseState/Tables/SgwfnTable.hpp
EclipseState/Tables/SwfnTable.hpp
EclipseState/Tables/SgfnTable.hpp
EclipseState/Tables/SsfnTable.hpp
EclipseState/Tables/Sof2Table.hpp
EclipseState/Tables/Sof3Table.hpp
EclipseState/Tables/EnptvdTable.hpp
EclipseState/Tables/PlyviscTable.hpp
EclipseState/Tables/PlydhflfTable.hpp
EclipseState/Tables/PlyshlogTable.hpp
EclipseState/Tables/EnkrvdTable.hpp
EclipseState/Tables/ImkrvdTable.hpp
EclipseState/Tables/SgofTable.hpp
EclipseState/Tables/SlgofTable.hpp
EclipseState/Tables/PvtxTable.hpp
EclipseState/Tables/ImptvdTable.hpp
EclipseState/Tables/RsvdTable.hpp
EclipseState/Tables/RvvdTable.hpp
EclipseState/Tables/RtempvdTable.hpp
EclipseState/Tables/OilvisctTable.hpp
EclipseState/Tables/GasvisctTable.hpp
EclipseState/Tables/WatvisctTable.hpp
EclipseState/Tables/PvtgTable.hpp
EclipseState/Tables/VFPProdTable.hpp
EclipseState/Tables/VFPInjTable.hpp
EclipseState/Tables/TableManager.hpp
EclipseState/Tables/TableContainer.hpp
EclipseState/Tables/SorwmisTable.hpp
EclipseState/Tables/SgcwmisTable.hpp
EclipseState/Tables/MiscTable.hpp
EclipseState/Tables/PmiscTable.hpp
EclipseState/Tables/TlpmixpaTable.hpp
EclipseState/Tables/MsfnTable.hpp
EclipseState/Tables/TableColumn.hpp
EclipseState/Tables/ColumnSchema.hpp
EclipseState/Tables/TableEnums.hpp
EclipseState/Tables/TableSchema.hpp
EclipseState/Tables/TableIndex.hpp
#
Utility/Functional.hpp
Utility/Stringview.hpp
Utility/Typetools.hpp)
#-----------------------------------------------------------------
# This section manages the generation of C++ code for the default keywords.
# 1. Create an executable 'createDefaultKeywordList'.
add_executable(createDefaultKeywordList Parser/createDefaultKeywordList.cpp ${build_parser_source})
target_link_libraries( createDefaultKeywordList opmjson ${Boost_LIBRARIES} ecl)
# 2. Run the generated application createDefaultKeywordlist - this
# application will recursively scan through all the json keyword
# files in the source tree. It will maintain a signature of these json files,
# and only update the generated files if the json files have changed.
#
# This target will always run - the dependency "management" is
# implicitly handled in the createDefaultKeywordList application.
set( generated_source ${PROJECT_BINARY_DIR}/generated-source/ParserKeywords.cpp)
# to tune the number of files addDefaultKeywords is split into, change
# generated_num_files. 4 is a very reasonable estimate.
# TODO: support from command line options?
set( generated_num_files 4 )
math( EXPR generated_num_files_end "${generated_num_files} - 1" )
foreach( n RANGE ${generated_num_files_end} )
list(APPEND generated_source ${PROJECT_BINARY_DIR}/generated-source/ParserKeywords${n}.cpp)
set_source_files_properties(${PROJECT_BINARY_DIR}/generated-source/ParserKeywords${n}.cpp PROPERTIES GENERATED TRUE)
endforeach( n )
set_source_files_properties(${PROJECT_BINARY_DIR}/generated-source/ParserKeywords.cpp PROPERTIES GENERATED TRUE)
set_source_files_properties(${PROJECT_BINARY_DIR}/generated-source/inlcude/opm/parser/eclipse/Parser/ParserKeywords.hpp PROPERTIES GENERATED TRUE)
set_source_files_properties(${PROJECT_BINARY_DIR}/generated-source/inlineKeywordTest.cpp PROPERTIES GENERATED TRUE)
add_custom_target( generatedCode ALL COMMAND createDefaultKeywordList
${PROJECT_SOURCE_DIR}/opm/parser/share/keywords
${PROJECT_BINARY_DIR}/generated-source/ParserKeywords.cpp
${PROJECT_BINARY_DIR}/generated-source/include/
opm/parser/eclipse/Parser/ParserKeywords
${PROJECT_BINARY_DIR}/generated-source/inlineKeywordTest.cpp
${generated_num_files}
)
opm_add_test( runInlineKeywordTest SOURCES ${PROJECT_BINARY_DIR}/generated-source/inlineKeywordTest.cpp
LIBRARIES opmparser ${opm-common_LIBRARIES} ${Boost_LIBRARIES}
ecl
DEPENDS generatedCode )
#-----------------------------------------------------------------
add_library(opmparser ${generated_source} ${state_source} ${rawdeck_source} ${parser_source} ${deck_source} ${unit_source} ${generator_source} ${utility_source})
add_dependencies( opmparser generatedCode )
target_link_libraries(opmparser opmjson ${opm-common_LIBRARIES} ${Boost_LIBRARIES} ecl)
set_target_properties(opmparser PROPERTIES VERSION ${opm-parser_VERSION_MAJOR}.${opm-parser_VERSION_MINOR}
SOVERSION ${opm-parser_VERSION_MAJOR})
include( ${PROJECT_SOURCE_DIR}/cmake/Modules/install_headers.cmake )
install_headers( "${HEADER_FILES}" "${CMAKE_INSTALL_PREFIX}" )
install( TARGETS opmparser DESTINATION ${CMAKE_INSTALL_LIBDIR} )
install(FILES ${PROJECT_BINARY_DIR}/generated-source/include/opm/parser/eclipse/Parser/ParserKeywords.hpp
DESTINATION include/opm/parser/eclipse/Parser)
install(DIRECTORY ${PROJECT_BINARY_DIR}/generated-source/include/opm/parser/eclipse/Parser/ParserKeywords
DESTINATION include/opm/parser/eclipse/Parser)
if (ENABLE_PYTHON)
add_subdirectory( python )
endif()

View File

@ -1,5 +0,0 @@
foreach(tapp DeckRecordTests DeckIntItemTests DeckDoubleItemTests
DeckStringItemTests DeckTests DeckKeywordTests SectionTests)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,8 +0,0 @@
foreach(tapp EclipseGridTests MULTREGTScannerTests GridPropertyTests
FaceDirTests GridPropertiesTests BoxTests PORVTests
BoxManagerTests TransMultTests FaultTests
EqualRegTests MultiRegTests ADDREGTests CopyRegTests
SatfuncPropertyInitializersTests)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,5 +0,0 @@
opm_add_test(runIOConfigTests SOURCES IOConfigTest.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
opm_add_test(runRestartConfigTests SOURCES RestartConfigTests.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})

View File

@ -1,2 +0,0 @@
opm_add_test(runInitConfigTests SOURCES InitConfigTest.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})

View File

@ -1,8 +0,0 @@
foreach(tapp TimeMapTest ScheduleTests WellTests WellPropertiesTests GroupTests
ScheduleEnumTests CompletionTests CompletionSetTests
DynamicStateTests GroupTreeTests TuningTests EventTests
WellSolventTests DynamicVectorTests GeomodifierTests
MessageLimitTests)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,4 +0,0 @@
foreach(tapp ThresholdPressureTest SimulationConfigTest)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,2 +0,0 @@
opm_add_test(runSummaryConfigTests SOURCES SummaryConfigTests.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})

View File

@ -1,13 +0,0 @@
foreach(tapp TableManagerTests
TabdimsTests
TableContainerTests
SimpleTableTests
ColumnSchemaTests
TableSchemaTests
TableColumnTests
PvtxTableTests)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,4 +0,0 @@
foreach(tapp OrderedMapTests ValueTests)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,7 +0,0 @@
foreach(tapp EclipseStateTests Eclipse3DPropertiesTests
RunspecTests)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,4 +0,0 @@
foreach(tapp KeywordLoaderTests)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,9 +0,0 @@
foreach(tapp ParserTests ParserKeywordTests ParserRecordTests
ParserItemTests ParserEnumTests ParserIncludeTests ParseContextTests MessageContainerTest)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()
if (NOT MSVC)
set_property(SOURCE ParserRecordTests.cpp PROPERTY COMPILE_FLAGS "-Wno-error")
endif()

View File

@ -1,4 +0,0 @@
foreach(tapp StarTokenTests RawRecordTests RawKeywordTests)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,3 +0,0 @@
foreach(tapp UnitTests COMPSEGUnits)
opm_add_test( run${tapp} SOURCES ${tapp}.cpp LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -1,6 +0,0 @@
foreach(tapp FunctionalTests StringviewTests StringTests )
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@ -27,7 +27,7 @@
#include <boost/filesystem/operations.hpp>
#include <opm/json/JsonObject.hpp>
#include "cjson/cJSON.h"
#include <cJSON.h>
namespace Json {

View File

@ -0,0 +1,351 @@
project(opm-parser-eclipse CXX)
add_executable(genkw Parser/createDefaultKeywordList.cpp
Deck/Deck.cpp
Deck/DeckItem.cpp
Deck/DeckKeyword.cpp
Deck/DeckRecord.cpp
Generator/KeywordGenerator.cpp
Generator/KeywordLoader.cpp
Parser/MessageContainer.cpp
Parser/ParseContext.cpp
Parser/ParserEnums.cpp
Parser/ParserItem.cpp
Parser/ParserKeyword.cpp
Parser/ParserRecord.cpp
RawDeck/RawKeyword.cpp
RawDeck/RawRecord.cpp
RawDeck/StarToken.cpp
Units/Dimension.cpp
Units/UnitSystem.cpp
Utility/Stringview.cpp
)
target_link_libraries(genkw opmjson ecl boost_regex)
target_include_directories(genkw PRIVATE include)
file(GLOB_RECURSE keyword_templates share/keywords/*)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords.cpp
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords0.cpp
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords1.cpp
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords2.cpp
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords3.cpp
${CMAKE_CURRENT_BINARY_DIR}/inlinekw.cpp
COMMAND genkw ${PROJECT_SOURCE_DIR}/share/keywords
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords.cpp
${CMAKE_CURRENT_BINARY_DIR}/include/
opm/parser/eclipse/Parser/ParserKeywords
${CMAKE_CURRENT_BINARY_DIR}/inlinekw.cpp
4
DEPENDS genkw
)
#-----------------------------------------------------------------
add_library(opmparser ${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords.cpp
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords0.cpp
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords1.cpp
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords2.cpp
${CMAKE_CURRENT_BINARY_DIR}/ParserKeywords3.cpp
Deck/Deck.cpp
Deck/DeckItem.cpp
Deck/DeckKeyword.cpp
Deck/DeckRecord.cpp
Deck/Section.cpp
EclipseState/checkDeck.cpp
EclipseState/Eclipse3DProperties.cpp
EclipseState/EclipseConfig.cpp
EclipseState/EclipseState.cpp
EclipseState/EndpointScaling.cpp
EclipseState/Grid/Box.cpp
EclipseState/Grid/BoxManager.cpp
EclipseState/Grid/EclipseGrid.cpp
EclipseState/Grid/FaceDir.cpp
EclipseState/Grid/FaultCollection.cpp
EclipseState/Grid/Fault.cpp
EclipseState/Grid/FaultFace.cpp
EclipseState/Grid/GridDims.cpp
EclipseState/Grid/GridProperties.cpp
EclipseState/Grid/GridProperty.cpp
EclipseState/Grid/MULTREGTScanner.cpp
EclipseState/Grid/NNC.cpp
EclipseState/Grid/PinchMode.cpp
EclipseState/Grid/SatfuncPropertyInitializers.cpp
EclipseState/Grid/TransMult.cpp
EclipseState/InitConfig/Equil.cpp
EclipseState/InitConfig/InitConfig.cpp
EclipseState/IOConfig/IOConfig.cpp
EclipseState/IOConfig/RestartConfig.cpp
EclipseState/Runspec.cpp
EclipseState/Schedule/Completion.cpp
EclipseState/Schedule/CompletionSet.cpp
EclipseState/Schedule/Events.cpp
EclipseState/Schedule/Group.cpp
EclipseState/Schedule/GroupTree.cpp
EclipseState/Schedule/MessageLimits.cpp
EclipseState/Schedule/MSW/Compsegs.cpp
EclipseState/Schedule/MSW/Segment.cpp
EclipseState/Schedule/MSW/SegmentSet.cpp
EclipseState/Schedule/OilVaporizationProperties.cpp
EclipseState/Schedule/Schedule.cpp
EclipseState/Schedule/ScheduleEnums.cpp
EclipseState/Schedule/TimeMap.cpp
EclipseState/Schedule/Tuning.cpp
EclipseState/Schedule/Well.cpp
EclipseState/Schedule/WellEconProductionLimits.cpp
EclipseState/Schedule/WellInjectionProperties.cpp
EclipseState/Schedule/WellPolymerProperties.cpp
EclipseState/Schedule/WellProductionProperties.cpp
EclipseState/SimulationConfig/SimulationConfig.cpp
EclipseState/SimulationConfig/ThresholdPressure.cpp
EclipseState/SummaryConfig/SummaryConfig.cpp
EclipseState/Tables/ColumnSchema.cpp
EclipseState/Tables/JFunc.cpp
EclipseState/Tables/PvtxTable.cpp
EclipseState/Tables/SimpleTable.cpp
EclipseState/Tables/TableColumn.cpp
EclipseState/Tables/TableContainer.cpp
EclipseState/Tables/TableIndex.cpp
EclipseState/Tables/TableManager.cpp
EclipseState/Tables/TableSchema.cpp
EclipseState/Tables/Tables.cpp
EclipseState/Tables/VFPInjTable.cpp
EclipseState/Tables/VFPProdTable.cpp
Parser/MessageContainer.cpp
Parser/ParseContext.cpp
Parser/Parser.cpp
Parser/ParserEnums.cpp
Parser/ParserItem.cpp
Parser/ParserKeyword.cpp
Parser/ParserRecord.cpp
RawDeck/RawKeyword.cpp
RawDeck/RawRecord.cpp
RawDeck/StarToken.cpp
Units/Dimension.cpp
Units/UnitSystem.cpp
Utility/Functional.cpp
Utility/Stringview.cpp
)
target_link_libraries(opmparser PUBLIC opmjson
ecl
boost_filesystem
boost_system
boost_regex
boost_date_time)
target_compile_definitions(opmparser PRIVATE -DOPM_PARSER_DECK_API=1)
target_include_directories(opmparser
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
)
install(TARGETS opmparser
EXPORT opm-parser-config
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY include/ DESTINATION include)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
DESTINATION include
PATTERN *.hpp
)
set_target_properties(opmparser PROPERTIES
VERSION ${opm-parser_VERSION_MAJOR}.${opm-parser_VERSION_MINOR}
SOVERSION ${opm-parser_VERSION_MAJOR}
)
if (NOT BUILD_TESTING)
return ()
endif ()
set(_testdir ${CMAKE_CURRENT_SOURCE_DIR}/tests/data)
add_executable(inlinekw ${CMAKE_CURRENT_BINARY_DIR}/inlinekw.cpp)
target_link_libraries(inlinekw opmparser boost_test)
add_test(NAME InlineKeywordTest COMMAND inlinekw)
add_executable(LoaderTest tests/KeywordLoaderTests.cpp Generator/KeywordLoader.cpp)
target_link_libraries(LoaderTest opmparser boost_test)
add_test(NAME LoaderTest
COMMAND LoaderTest ${_testdir}/parser/keyword-generator/)
add_executable(ParserTests tests/ParserTests.cpp)
target_link_libraries(ParserTests opmparser boost_test)
add_test(NAME ParserTests COMMAND ParserTests ${_testdir}/)
add_executable(ParserIncludeTests tests/ParserIncludeTests.cpp)
target_compile_definitions(ParserIncludeTests PRIVATE
-DHAVE_CASE_SENSITIVE_FILESYSTEM=${HAVE_CASE_SENSITIVE_FILESYSTEM}
)
target_link_libraries(ParserIncludeTests opmparser boost_test)
add_test(NAME ParserIncludeTests COMMAND ParserIncludeTests ${_testdir}/parser/)
add_executable(PvtxTableTests tests/PvtxTableTests.cpp)
target_link_libraries(PvtxTableTests opmparser boost_test)
add_test(NAME PvtxTableTests
COMMAND PvtxTableTests ${_testdir}/integration_tests/)
add_executable(EclipseStateTests tests/EclipseStateTests.cpp)
target_link_libraries(EclipseStateTests opmparser boost_test)
add_test(NAME EclipseStateTests
COMMAND EclipseStateTests ${_testdir}/integration_tests/)
foreach(test ADDREGTests
BoxManagerTests
BoxTests
ColumnSchemaTests
CompletionSetTests
CompletionTests
COMPSEGUnits
CopyRegTests
DeckDoubleItemTests
DeckIntItemTests
DeckKeywordTests
DeckRecordTests
DeckStringItemTests
DeckTests
DynamicStateTests
DynamicVectorTests
Eclipse3DPropertiesTests
EclipseGridTests
EqualRegTests
EventTests
FaceDirTests
FaultTests
FunctionalTests
GeomodifierTests
GridPropertiesTests
GridPropertyTests
GroupTests
GroupTreeTests
InitConfigTest
IOConfigTests
MessageContainerTest
MessageLimitTests
MultiRegTests
MULTREGTScannerTests
OrderedMapTests
ParseContextTests
ParserEnumTests
ParserItemTests
ParserKeywordTests
ParserRecordTests
PORVTests
RawKeywordTests
RawRecordTests
RestartConfigTests
RunspecTests
SatfuncPropertyInitializersTests
ScheduleEnumTests
ScheduleTests
SectionTests
SimpleTableTests
SimulationConfigTest
StarTokenTests
StringTests
StringviewTests
SummaryConfigTests
TabdimsTests
TableColumnTests
TableContainerTests
TableManagerTests
TableSchemaTests
ThresholdPressureTest
TimeMapTest
TransMultTests
TuningTests
UnitTests
ValueTests
WellPropertiesTests
WellSolventTests
WellTests
)
add_executable(${test} tests/${test}.cpp)
target_link_libraries(${test} opmparser boost_test)
add_test(NAME ${test} COMMAND ${test})
endforeach ()
foreach (test BoxTest
CheckDeckValidity
CompletionsFromDeck
EclipseGridCreateFromDeck
IncludeTest
IntegrationTests
IOConfigIntegrationTest
NNCTests
ParseCECON
ParseCOORDSYS
ParseDATAWithDefault
ParseDEBUG
ParseDENSITY
ParseEND
ParseEQUIL
ParseGRUPRIG
ParseLGR
ParseMiscible
ParseMULTREGT
ParseMULTSEGWELL
ParsePLYADSS
ParsePLYDHFLF
ParsePLYSHLOG
ParsePLYVISC
ParsePORO
ParsePRORDER
ParsePVTG
ParsePVTO
ParseRSVD
ParseSGOF
ParseSLGOF
ParseSWOF
ParseTITLE
ParseTOPS
ParseTRACERS
ParseTUNINGDP
ParseTVDP
ParseVFPPROD
ParseWCONHIST
ParseWDFACCOR
ParseWEFAC
ParseWellProbe
ParseWellWithWildcards
ParseWORKLIM
Polymer
ResinsightTest
ScheduleCreateFromDeck
TransMultIntegrationTests
)
add_executable(${test} IntegrationTests/${test}.cpp)
target_link_libraries(${test} opmparser boost_test)
add_test(NAME ${test} COMMAND ${test} ${_testdir}/integration_tests/)
endforeach ()
if (NOT HAVE_OPM_DATA)
return ()
endif ()
foreach (deck ${OPM_DATA_ROOT}/norne/NORNE_ATW2013.DATA
${OPM_DATA_ROOT}/solvent_test_suite/SPE1CASE2_SOLVENT.DATA
${OPM_DATA_ROOT}/solvent_test_suite/SPE9_CP_SOLVENT_CO2.DATA
${OPM_DATA_ROOT}/solvent_test_suite/SPE5CASE1.DATA
${OPM_DATA_ROOT}/polymer_test_suite/simple2D/2D_THREEPHASE_POLY_HETER.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE1.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2_FAMII.DATA
${OPM_DATA_ROOT}/spe1/SPE1CASE2_SLGOF.DATA
${OPM_DATA_ROOT}/spe3/SPE3CASE1.DATA
${OPM_DATA_ROOT}/spe3/SPE3CASE2.DATA
${OPM_DATA_ROOT}/spe9/SPE9_CP.DATA
${OPM_DATA_ROOT}/spe9/SPE9_CP_GROUP.DATA
${OPM_DATA_ROOT}/spe9/SPE9.DATA
${OPM_DATA_ROOT}/spe10model1/SPE10_MODEL1.DATA
${OPM_DATA_ROOT}/spe10model2/SPE10_MODEL2.DATA
${OPM_DATA_ROOT}/msw_2d_h/2D_H__.DATA )
get_filename_component(test_name ${deck} NAME_WE)
add_test(NAME ${test_name} COMMAND opmi ${deck})
endforeach()
set_property(TEST NORNE_ATW2013
PROPERTY ENVIRONMENT "OPM_ERRORS_IGNORE=PARSE_RANDOM_SLASH")

View File

@ -17,9 +17,9 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "DeckKeyword.hpp"
#include "DeckRecord.hpp"
#include "DeckItem.hpp"
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
namespace Opm {

View File

@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "checkDeck.hpp"
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/Section.hpp>

View File

@ -35,6 +35,10 @@
using namespace Opm;
inline std::string prefix() {
return boost::unit_test::framework::master_test_suite().argv[1];
}
inline EclipseState makeState(const std::string& fileName) {
Parser parser;
boost::filesystem::path boxFile(fileName);
@ -42,10 +46,8 @@ inline EclipseState makeState(const std::string& fileName) {
return EclipseState( deck, ParseContext() );
}
BOOST_AUTO_TEST_CASE( PERMX ) {
EclipseState state = makeState( "testdata/integration_tests/BOX/BOXTEST1" );
EclipseState state = makeState( prefix() + "BOX/BOXTEST1" );
const auto& permx = state.get3DProperties().getDoubleGridProperty( "PERMX" );
const auto& permy = state.get3DProperties().getDoubleGridProperty( "PERMY" );
const auto& permz = state.get3DProperties().getDoubleGridProperty( "PERMZ" );
@ -67,7 +69,7 @@ BOOST_AUTO_TEST_CASE( PERMX ) {
BOOST_AUTO_TEST_CASE( PARSE_BOX_OK ) {
EclipseState state = makeState( "testdata/integration_tests/BOX/BOXTEST1" );
EclipseState state = makeState( prefix() + "BOX/BOXTEST1" );
const auto& satnum = state.get3DProperties().getIntGridProperty( "SATNUM" );
{
size_t i, j, k;
@ -89,7 +91,7 @@ BOOST_AUTO_TEST_CASE( PARSE_BOX_OK ) {
}
BOOST_AUTO_TEST_CASE( PARSE_MULTIPLY_COPY ) {
EclipseState state = makeState( "testdata/integration_tests/BOX/BOXTEST1" );
EclipseState state = makeState( prefix() + "BOX/BOXTEST1" );
const auto& satnum = state.get3DProperties().getIntGridProperty( "SATNUM" );
const auto& fipnum = state.get3DProperties().getIntGridProperty( "FIPNUM" );
size_t i, j, k;
@ -114,11 +116,11 @@ BOOST_AUTO_TEST_CASE( PARSE_MULTIPLY_COPY ) {
BOOST_AUTO_TEST_CASE( KEYWORD_BOX_TOO_SMALL) {
BOOST_CHECK_THROW( makeState("testdata/integration_tests/BOX/BOXTEST3") , std::invalid_argument);
BOOST_CHECK_THROW( makeState(prefix() + "BOX/BOXTEST3") , std::invalid_argument);
}
BOOST_AUTO_TEST_CASE( EQUALS ) {
EclipseState state = makeState( "testdata/integration_tests/BOX/BOXTEST1" );
EclipseState state = makeState( prefix() + "BOX/BOXTEST1" );
const auto& pvtnum = state.get3DProperties().getIntGridProperty( "PVTNUM" );
const auto& eqlnum = state.get3DProperties().getIntGridProperty( "EQLNUM" );
const auto& poro = state.get3DProperties().getDoubleGridProperty( "PORO" );
@ -140,7 +142,7 @@ BOOST_AUTO_TEST_CASE( EQUALS ) {
BOOST_AUTO_TEST_CASE( OPERATE ) {
EclipseState state = makeState( "testdata/integration_tests/BOX/BOXTEST1" );
EclipseState state = makeState( prefix() + "BOX/BOXTEST1" );
const auto& ntg = state.get3DProperties().getDoubleGridProperty( "NTG" );
BOOST_CHECK_EQUAL( ntg.iget( 0,0,0) , 8.50 ); // MULTA

View File

@ -32,10 +32,14 @@
using namespace Opm;
inline std::string prefix() {
return boost::unit_test::framework::master_test_suite().argv[1];
}
BOOST_AUTO_TEST_CASE( CreateCompletionsFromKeyword ) {
Parser parser;
const auto scheduleFile = "testdata/integration_tests/SCHEDULE/SCHEDULE_COMPDAT1";
const auto scheduleFile = prefix() + "SCHEDULE/SCHEDULE_COMPDAT1";
auto deck = parser.parseFile(scheduleFile, ParseContext());
EclipseGrid grid(10,10,10);
TableManager table ( deck );

View File

@ -35,10 +35,13 @@
using namespace Opm;
inline std::string prefix() {
return boost::unit_test::framework::master_test_suite().argv[1];
}
BOOST_AUTO_TEST_CASE(CreateCPGrid) {
Parser parser;
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT.DATA");
boost::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA");
auto deck = parser.parseFile(scheduleFile.string(), ParseContext());
EclipseState es(deck, ParseContext());
const auto& grid = es.getInputGrid();
@ -52,7 +55,7 @@ BOOST_AUTO_TEST_CASE(CreateCPGrid) {
BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) {
Parser parser;
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT_ACTNUM.DATA");
boost::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA");
auto deck = parser.parseFile(scheduleFile.string(), ParseContext());
EclipseState es(deck, ParseContext());
const auto& grid = es.getInputGrid();
@ -66,7 +69,7 @@ BOOST_AUTO_TEST_CASE(CreateCPActnumGrid) {
BOOST_AUTO_TEST_CASE(ExportFromCPGridAllActive) {
Parser parser;
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT.DATA");
boost::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT.DATA");
auto deck = parser.parseFile(scheduleFile.string(), ParseContext());
EclipseState es(deck, ParseContext());
const auto& grid = es.getInputGrid();
@ -83,7 +86,7 @@ BOOST_AUTO_TEST_CASE(ExportFromCPGridAllActive) {
BOOST_AUTO_TEST_CASE(ExportFromCPGridACTNUM) {
Parser parser;
boost::filesystem::path scheduleFile("testdata/integration_tests/GRID/CORNERPOINT_ACTNUM.DATA");
boost::filesystem::path scheduleFile(prefix() + "GRID/CORNERPOINT_ACTNUM.DATA");
auto deck = parser.parseFile(scheduleFile.string(), ParseContext());
EclipseState es(deck, ParseContext());
auto& grid = es.getInputGrid();

View File

@ -36,6 +36,10 @@
using namespace Opm;
inline std::string prefix() {
return boost::unit_test::framework::master_test_suite().argv[1];
}
inline void verifyRestartConfig( const RestartConfig& rst, std::vector<std::tuple<int , bool, boost::gregorian::date>>& rptConfig) {
for (auto rptrst : rptConfig) {
@ -296,7 +300,7 @@ BOOST_AUTO_TEST_CASE( NorneRestartConfig ) {
rptConfig.push_back( std::make_tuple(241 , true , boost::gregorian::date( 2006,10,10)) );
auto state = Parser::parse("testdata/integration_tests/IOConfig/RPTRST_DECK.DATA");
auto state = Parser::parse(prefix() + "IOConfig/RPTRST_DECK.DATA");
verifyRestartConfig(state.cfg().restart(), rptConfig);
}
@ -337,7 +341,7 @@ BOOST_AUTO_TEST_CASE( RestartConfig2 ) {
ParseContext parseContext;
Parser parser;
auto deck = parser.parseFile("testdata/integration_tests/IOConfig/RPT_TEST2.DATA", parseContext);
auto deck = parser.parseFile(prefix() + "IOConfig/RPT_TEST2.DATA", parseContext);
EclipseState state( deck , parseContext );
const auto& rstConfig = state.cfg().restart();
verifyRestartConfig( rstConfig, rptConfig );
@ -350,6 +354,6 @@ BOOST_AUTO_TEST_CASE( RestartConfig2 ) {
BOOST_AUTO_TEST_CASE( SPE9END ) {
ParseContext parseContext;
Parser parser;
auto deck = parser.parseFile("testdata/integration_tests/IOConfig/SPE9_END.DATA", parseContext);
auto deck = parser.parseFile(prefix() + "IOConfig/SPE9_END.DATA", parseContext);
BOOST_CHECK_NO_THROW( EclipseState state( deck , parseContext ) );
}

View File

@ -35,6 +35,10 @@
using namespace Opm;
inline std::string pathprefix() {
return boost::unit_test::framework::master_test_suite().argv[1];
}
namespace {
std::unique_ptr< ParserKeyword > createFixedSized(const std::string& kw , size_t size) {
@ -67,7 +71,7 @@ Parser createWWCTParser() {
}
BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckReturned) {
boost::filesystem::path singleKeywordFile("testdata/integration_tests/wwct.data");
boost::filesystem::path singleKeywordFile(pathprefix() + "wwct.data");
auto parser = createWWCTParser();
BOOST_CHECK( parser.isRecognizedKeyword("WWCT"));
BOOST_CHECK( parser.isRecognizedKeyword("SUMMARY"));
@ -103,7 +107,7 @@ BOOST_AUTO_TEST_CASE(parse_streamWithWWCTKeyword_deckReturned) {
}
BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckHasWWCT) {
boost::filesystem::path singleKeywordFile("testdata/integration_tests/wwct.data");
boost::filesystem::path singleKeywordFile(pathprefix() + "wwct.data");
auto parser = createWWCTParser();
auto deck = parser.parseFile(singleKeywordFile.string(), ParseContext());
BOOST_CHECK(deck.hasKeyword("SUMMARY"));
@ -111,7 +115,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_deckHasWWCT) {
}
BOOST_AUTO_TEST_CASE(parse_fileWithWWCTKeyword_dataIsCorrect) {
boost::filesystem::path singleKeywordFile("testdata/integration_tests/wwct.data");
boost::filesystem::path singleKeywordFile(pathprefix() + "wwct.data");
auto parser = createWWCTParser();
auto deck = parser.parseFile(singleKeywordFile.string(), ParseContext());
BOOST_CHECK_EQUAL("WELL-1", deck.getKeyword("WWCT" , 0).getRecord(0).getItem(0).get< std::string >(0));
@ -152,14 +156,14 @@ static Parser createBPRParser() {
}
BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_deckReturned) {
boost::filesystem::path singleKeywordFile("testdata/integration_tests/bpr.data");
boost::filesystem::path singleKeywordFile(pathprefix() + "bpr.data");
auto parser = createBPRParser();
BOOST_CHECK_NO_THROW(parser.parseFile(singleKeywordFile.string(), ParseContext()));
}
BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_DeckhasBRP) {
boost::filesystem::path singleKeywordFile("testdata/integration_tests/bpr.data");
boost::filesystem::path singleKeywordFile(pathprefix() + "bpr.data");
auto parser = createBPRParser();
auto deck = parser.parseFile(singleKeywordFile.string(), ParseContext());
@ -168,7 +172,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_DeckhasBRP) {
}
BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_dataiscorrect) {
boost::filesystem::path singleKeywordFile("testdata/integration_tests/bpr.data");
boost::filesystem::path singleKeywordFile(pathprefix() + "bpr.data");
auto parser = createBPRParser();
auto deck = parser.parseFile(singleKeywordFile.string(), ParseContext());
@ -193,7 +197,7 @@ BOOST_AUTO_TEST_CASE(parse_fileWithBPRKeyword_dataiscorrect) {
/***************** Testing non-recognized keywords ********************/
BOOST_AUTO_TEST_CASE(parse_unknownkeyword_exceptionthrown) {
Parser parser;
BOOST_CHECK_THROW( parser.parseFile("testdata/integration_tests/someobscureelements.data", ParseContext()), std::invalid_argument);
BOOST_CHECK_THROW( parser.parseFile(pathprefix() + "someobscureelements.data", ParseContext()), std::invalid_argument);
}
/*********************Testing truncated (default) records ***************************/
@ -202,7 +206,7 @@ BOOST_AUTO_TEST_CASE(parse_unknownkeyword_exceptionthrown) {
// Datafile contains 3 RADFIN4 keywords. One fully specified, one with 2 out of 11 items, and one with no items.
BOOST_AUTO_TEST_CASE(parse_truncatedrecords_deckFilledWithDefaults) {
Parser parser;
auto deck = parser.parseFile("testdata/integration_tests/truncated_records.data", ParseContext());
auto deck = parser.parseFile(pathprefix() + "truncated_records.data", ParseContext());
BOOST_CHECK_EQUAL(3U, deck.size());
const auto& radfin4_0_full= deck.getKeyword("RADFIN4", 0);
const auto& radfin4_1_partial= deck.getKeyword("RADFIN4", 1);

Some files were not shown because too many files have changed in this diff Show More