From a7aa78b7e9cc5f31ba9f1335b64c7a15557d6032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B8rn=20Skille?= Date: Mon, 1 Jul 2019 18:02:53 +0200 Subject: [PATCH] Update of compareECL. Checks that at least one output file (EGRID, INIT, SMSPEC, RFT or UNRST) present for reference case. Throws if not the case --- test_util/compareECL.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test_util/compareECL.cpp b/test_util/compareECL.cpp index f562b107a..86aa532db 100644 --- a/test_util/compareECL.cpp +++ b/test_util/compareECL.cpp @@ -23,6 +23,7 @@ #include #include #include +#include static void printHelp() { std::cout << "\ncompareECL compares ECLIPSE files (restart (.RST), unified restart (.UNRST), initial (.INIT), summary (.SMRY), unified summary (.UNSMRY) or .RFT) and gridsizes (from .EGRID or .GRID file) from two simulations.\n" @@ -62,6 +63,20 @@ static void printHelp() { +static bool has_result_files(const std::string& rootName) +{ + std::vector extList = { "EGRID", "INIT", "UNRST", "SMSPEC", "RFT" }; + + for (const auto& ext : extList) { + std::ifstream is(rootName + '.' + ext); + if (is) { + return true; + } + } + + return false; +} + //------------------------------------------------// int main(int argc, char** argv) { @@ -155,6 +170,11 @@ int main(int argc, char** argv) { std::cout << "Comparing '" << basename1 << "' to '" << basename2 << "'." << std::endl; + if (!has_result_files(basename1)){ + std::cerr << "No files found for reference case." << std::endl; + return EXIT_FAILURE; + } + try { ECLRegressionTest comparator(basename1, basename2, absTolerance, relTolerance);