From 3669a88e1f3fa4d09ddb458462b91c077e1a39c1 Mon Sep 17 00:00:00 2001 From: Emillio Mariscal Date: Tue, 7 Nov 2023 20:41:02 -0300 Subject: [PATCH] Big refactor, fixes for tests --- src/bootstrap/bootstrap.cc | 22 +- src/data/pq.cc | 21 +- src/osm/osmchange.cc | 50 +- src/osm/osmchange.hh | 2 + src/raw/queryraw.cc | 6 +- src/replicator/threads.cc | 2 +- src/testsuite/libunderpass.all/Makefile | 1084 ----------------- src/testsuite/libunderpass.all/Makefile.am | 9 +- src/testsuite/libunderpass.all/hotosm-test.cc | 157 --- src/testsuite/libunderpass.all/pq-test.cc | 2 +- src/testsuite/libunderpass.all/val-test.cc | 182 ++- .../libunderpass.all/val-unsquared-test.cc | 5 +- src/testsuite/testdata/stats/test_stats.yaml | 2 +- src/testsuite/testdata/validation/rect.osc | 223 +++- src/utils/yaml.cc | 3 +- src/validate/Makefile.am | 4 +- src/validate/defaultvalidation.cc | 85 ++ src/validate/defaultvalidation.hh | 75 ++ src/validate/geospatial.cc | 138 ++- src/validate/geospatial.hh | 51 +- src/validate/semantic.cc | 144 +-- src/validate/semantic.hh | 39 +- src/validate/validate.hh | 23 +- src/wrappers/python.cc | 64 +- 24 files changed, 689 insertions(+), 1704 deletions(-) delete mode 100644 src/testsuite/libunderpass.all/Makefile delete mode 100644 src/testsuite/libunderpass.all/hotosm-test.cc create mode 100644 src/validate/defaultvalidation.cc create mode 100644 src/validate/defaultvalidation.hh diff --git a/src/bootstrap/bootstrap.cc b/src/bootstrap/bootstrap.cc index 1a8f6e3d..0b8699df 100644 --- a/src/bootstrap/bootstrap.cc +++ b/src/bootstrap/bootstrap.cc @@ -60,7 +60,7 @@ void startProcessingWays(const underpassconfig::UnderpassConfig &config) { boost::function creator; try { creator = boost::dll::import_alias(lib_path / "libunderpass.so", "create_plugin", boost::dll::load_mode::append_decorations); - log_debug("Loaded plugin hotosm!"); + log_debug("Loaded plugin!"); } catch (std::exception &e) { log_debug("Couldn't load plugin! %1%", e.what()); exit(0); @@ -77,7 +77,7 @@ void startProcessingWays(const underpassconfig::UnderpassConfig &config) { for (auto table_it = tables.begin(); table_it != tables.end(); ++table_it) { std::cout << "Counting geometries ... " << std::endl; int total = queryraw->getWaysCount(*table_it); - std::cout << "Total ways:" << total << std::endl; + std::cout << "Total: " << total << std::endl; if (total > 0) { int count = 0; long lastid = 0; @@ -126,22 +126,10 @@ processWays(WayTask &wayTask, const std::string &tableName, const underpassconfi if (wayTask.processed > 0) { // Proccesing ways for (auto way = ways->begin(); way != ways->end(); ++way) { - // If it's closed polygon - if (way->isClosed()) { - log_debug("Way Id: %1%", way->id); - - // Bad geometry - if (way->containsKey("building") && (boost::geometry::num_points(way->linestring) - 1 < 4 || - plugin->unsquared(way->linestring)) - ) { - auto status = ValidateStatus(*way); - status.timestamp = boost::posix_time::microsec_clock::universal_time(); - status.source = "building"; - boost::geometry::centroid(way->linestring, status.center); - task->query += queryvalidate->applyChange(status, badgeom); - } + auto status = plugin->checkWay(*way, "building"); + for (auto status_it = status->status.begin(); status_it != status->status.end(); ++status_it) { + task->query += queryvalidate->applyChange(*status, *status_it); } - // Fill the way_refs table if (!config.norefs) { for (auto ref = way->refs.begin(); ref != way->refs.end(); ++ref) { diff --git a/src/data/pq.cc b/src/data/pq.cc index 678bcd8e..7018e815 100644 --- a/src/data/pq.cc +++ b/src/data/pq.cc @@ -25,7 +25,8 @@ #include "data/pq.hh" #include #include -#include +#include +#include #include #include #include @@ -152,11 +153,24 @@ Pq::query(const std::string &query) { std::scoped_lock write_lock{pqxx_mutex}; pqxx::work worker(*sdb); - pqxx::result result = worker.exec(query); + auto result = worker.exec(query); worker.commit(); return result; } +std::string Latin1ToUTF8(const std::string& latin1str) { + std::string utf8str; + for (char c : latin1str) { + if (static_cast(c) <= 0x7F) { + utf8str.push_back(c); + } else { + utf8str.push_back(0xC0 | static_cast(c) >> 6); + utf8str.push_back(0x80 | (static_cast(c) & 0x3F)); + } + } + return utf8str; +} + std::string Pq::escapedString(std::string text) { @@ -180,7 +194,8 @@ Pq::escapedString(std::string text) } i++; } - return sdb->esc(newstr); + + return sdb->esc(Latin1ToUTF8(newstr)); } } // namespace pq diff --git a/src/osm/osmchange.cc b/src/osm/osmchange.cc index 8f86593c..0a064878 100644 --- a/src/osm/osmchange.cc +++ b/src/osm/osmchange.cc @@ -130,6 +130,19 @@ OsmChangeFile::readChanges(const std::string &file) return true; } +void +OsmChangeFile::buildGeometriesFromNodeCache() { + for (auto it = std::begin(changes); it != std::end(changes); ++it) { + osmchange::OsmChange *change = it->get(); + for (auto wit = std::begin(change->ways); wit != std::end(change->ways); ++wit) { + osmobjects::OsmWay *way = wit->get(); + for (auto lit = std::begin(way->refs); lit != std::end(way->refs); ++lit) { + boost::geometry::append(way->linestring, nodecache[*lit]); + } + } + } +} + bool OsmChangeFile::readXML(std::istream &xml) { @@ -699,10 +712,7 @@ OsmChangeFile::validateNodes(const multipolygon_t &poly, std::shared_ptr node_tests = {"building", "natural", "place", "waterway"}; for (auto test_it = std::begin(node_tests); test_it != std::end(node_tests); ++test_it) { if (node->containsKey(*test_it)) { - auto status = plugin->checkPOI(*node, *test_it); - if (status->status.size() > 0) { - status->center = node->point; - } + auto status = plugin->checkNode(*node, *test_it); totals->push_back(status); } } @@ -725,38 +735,8 @@ OsmChangeFile::validateWays(const multipolygon_t &poly, std::shared_ptrpriority) { continue; } - - // Geometry checks - auto status = std::make_shared(*way); - if (way->containsKey("building")) { - // See if the way is a closed polygon - if (way->refs.front() == way->refs.back()) { - status->timestamp = boost::posix_time::microsec_clock::universal_time(); - status->uid = way->uid; - // Bad geometry - if (boost::geometry::num_points(way->linestring) - 1 < 4 || - plugin->unsquared(way->linestring) - ) { - status->status.insert(badgeom); - } - if (status->status.size() > 0) { - status->source = "building"; - boost::geometry::centroid(way->linestring, status->center); - } - } - } + auto status = plugin->checkWay(*way, "building"); totals->push_back(status); - - // Semantic checks - std::vector way_tests = {"building"}; - for (auto test_it = way_tests.begin(); test_it != way_tests.end(); ++test_it) { - if (way->containsKey(*test_it)) { - auto status = plugin->checkWay(*way, *test_it); - status->source = *test_it; - // boost::geometry::centroid(way->linestring, status->center); - totals->push_back(status); - } - } } } return totals; diff --git a/src/osm/osmchange.hh b/src/osm/osmchange.hh index e66c4984..d04defc8 100644 --- a/src/osm/osmchange.hh +++ b/src/osm/osmchange.hh @@ -245,6 +245,8 @@ class OsmChangeFile /// Delete any data not in the boundary polygon void areaFilter(const multipolygon_t &poly); + void buildGeometriesFromNodeCache(); + #ifdef LIBXML /// Called by libxml++ for each element of the XML file void on_start_element(const Glib::ustring &name, diff --git a/src/raw/queryraw.cc b/src/raw/queryraw.cc index 38bdd8a4..bd156173 100644 --- a/src/raw/queryraw.cc +++ b/src/raw/queryraw.cc @@ -368,13 +368,13 @@ QueryRaw::getNodeCacheFromWays(std::shared_ptr> ways, std::m } } -std::map parseTagsString(const std::string& input) { +std::map parseTagsString(std::string input) { + input.pop_back(); std::map result; std::stringstream ss(input); std::string token; while (std::getline(ss, token, ',')) { - // Find the position of the arrow - size_t arrowPos = token.find(":"); + size_t arrowPos = token.find_last_of(":"); if (arrowPos != std::string::npos) { std::string key = token.substr(1, arrowPos - 1); std::string value = token.substr(arrowPos + 2); diff --git a/src/replicator/threads.cc b/src/replicator/threads.cc index f0790845..f756caeb 100644 --- a/src/replicator/threads.cc +++ b/src/replicator/threads.cc @@ -248,7 +248,7 @@ startMonitorChanges(std::shared_ptr &remote, boost::function creator; try { creator = boost::dll::import_alias(lib_path / "libunderpass.so", "create_plugin", boost::dll::load_mode::append_decorations); - log_debug("Loaded plugin hotosm!"); + log_debug("Loaded plugin!"); } catch (std::exception &e) { log_debug("Couldn't load plugin! %1%", e.what()); exit(0); diff --git a/src/testsuite/libunderpass.all/Makefile b/src/testsuite/libunderpass.all/Makefile deleted file mode 100644 index 493f8d11..00000000 --- a/src/testsuite/libunderpass.all/Makefile +++ /dev/null @@ -1,1084 +0,0 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. -# src/testsuite/libunderpass.all/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994-2018 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - -# -# Copyright (c) 2020, 2021, 2022, 2023 Humanitarian OpenStreetMap Team -# -# This file is part of Underpass. -# -# Underpass is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Underpass is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Underpass. If not, see . -# - -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/underpass -pkgincludedir = $(includedir)/underpass -pkglibdir = $(libdir)/underpass -pkglibexecdir = $(libexecdir)/underpass -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = x86_64-pc-linux-gnu -host_triplet = x86_64-pc-linux-gnu -check_PROGRAMS = pq-test$(EXEEXT) change-test$(EXEEXT) \ - yaml-test$(EXEEXT) statsconfig-test$(EXEEXT) \ - planetreplicator-test$(EXEEXT) geo-test$(EXEEXT) \ - areafilter-test$(EXEEXT) hashtags-test$(EXEEXT) \ - stats-test$(EXEEXT) val-test$(EXEEXT) test-playground$(EXEEXT) -subdir = src/testsuite/libunderpass.all -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \ - $(top_srcdir)/m4/ax_boost_date_time.m4 \ - $(top_srcdir)/m4/ax_boost_filesystem.m4 \ - $(top_srcdir)/m4/ax_boost_iostreams.m4 \ - $(top_srcdir)/m4/ax_boost_locale.m4 \ - $(top_srcdir)/m4/ax_boost_log.m4 \ - $(top_srcdir)/m4/ax_boost_program_options.m4 \ - $(top_srcdir)/m4/ax_boost_python.m4 \ - $(top_srcdir)/m4/ax_boost_serialization.m4 \ - $(top_srcdir)/m4/ax_boost_system.m4 \ - $(top_srcdir)/m4/ax_boost_thread.m4 \ - $(top_srcdir)/m4/ax_boost_timer.m4 \ - $(top_srcdir)/m4/ax_python_devel.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/host-cpu-c-abi.m4 \ - $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/unconfig.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am_areafilter_test_OBJECTS = areafilter-test.$(OBJEXT) -areafilter_test_OBJECTS = $(am_areafilter_test_OBJECTS) -am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -areafilter_test_DEPENDENCIES = $(am__DEPENDENCIES_2) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) -am__v_lt_0 = --silent -am__v_lt_1 = -areafilter_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(areafilter_test_LDFLAGS) \ - $(LDFLAGS) -o $@ -am_change_test_OBJECTS = change_test-change-test.$(OBJEXT) -change_test_OBJECTS = $(am_change_test_OBJECTS) -change_test_DEPENDENCIES = $(am__DEPENDENCIES_2) -change_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(change_test_LDFLAGS) $(LDFLAGS) -o $@ -am_geo_test_OBJECTS = geo_test-geo-test.$(OBJEXT) -geo_test_OBJECTS = $(am_geo_test_OBJECTS) -geo_test_DEPENDENCIES = $(am__DEPENDENCIES_2) -geo_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(geo_test_LDFLAGS) $(LDFLAGS) -o $@ -am_hashtags_test_OBJECTS = hashtags-test.$(OBJEXT) -hashtags_test_OBJECTS = $(am_hashtags_test_OBJECTS) -hashtags_test_DEPENDENCIES = $(am__DEPENDENCIES_2) -hashtags_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(hashtags_test_LDFLAGS) $(LDFLAGS) \ - -o $@ -am_planetreplicator_test_OBJECTS = planetreplicator-test.$(OBJEXT) -planetreplicator_test_OBJECTS = $(am_planetreplicator_test_OBJECTS) -planetreplicator_test_DEPENDENCIES = $(am__DEPENDENCIES_2) -planetreplicator_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(planetreplicator_test_LDFLAGS) \ - $(LDFLAGS) -o $@ -am_pq_test_OBJECTS = pq_test-pq-test.$(OBJEXT) -pq_test_OBJECTS = $(am_pq_test_OBJECTS) -pq_test_DEPENDENCIES = $(am__DEPENDENCIES_2) -pq_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(pq_test_LDFLAGS) $(LDFLAGS) -o $@ -am_stats_test_OBJECTS = stats_test-stats-test.$(OBJEXT) -stats_test_OBJECTS = $(am_stats_test_OBJECTS) -stats_test_DEPENDENCIES = $(am__DEPENDENCIES_2) -stats_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(stats_test_LDFLAGS) $(LDFLAGS) -o $@ -am_statsconfig_test_OBJECTS = statsconfig-test.$(OBJEXT) -statsconfig_test_OBJECTS = $(am_statsconfig_test_OBJECTS) -statsconfig_test_DEPENDENCIES = $(am__DEPENDENCIES_2) -statsconfig_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(statsconfig_test_LDFLAGS) \ - $(LDFLAGS) -o $@ -am_test_playground_OBJECTS = test-playground.$(OBJEXT) -test_playground_OBJECTS = $(am_test_playground_OBJECTS) -test_playground_DEPENDENCIES = $(am__DEPENDENCIES_2) -test_playground_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(test_playground_LDFLAGS) \ - $(LDFLAGS) -o $@ -am_val_test_OBJECTS = val_test-val-test.$(OBJEXT) -val_test_OBJECTS = $(am_val_test_OBJECTS) -val_test_DEPENDENCIES = $(am__DEPENDENCIES_2) ../../validate/hotosm.lo -val_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(val_test_LDFLAGS) $(LDFLAGS) -o $@ -am_yaml_test_OBJECTS = yaml_test-yaml-test.$(OBJEXT) -yaml_test_OBJECTS = $(am_yaml_test_OBJECTS) -yaml_test_DEPENDENCIES = $(am__DEPENDENCIES_2) -yaml_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(yaml_test_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_P = $(am__v_P_$(V)) -am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I. -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/areafilter-test.Po \ - ./$(DEPDIR)/change_test-change-test.Po \ - ./$(DEPDIR)/geo_test-geo-test.Po ./$(DEPDIR)/hashtags-test.Po \ - ./$(DEPDIR)/planetreplicator-test.Po \ - ./$(DEPDIR)/pq_test-pq-test.Po \ - ./$(DEPDIR)/stats_test-stats-test.Po \ - ./$(DEPDIR)/statsconfig-test.Po ./$(DEPDIR)/test-playground.Po \ - ./$(DEPDIR)/val_test-val-test.Po \ - ./$(DEPDIR)/yaml_test-yaml-test.Po -am__mv = mv -f -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_$(V)) -am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_$(V)) -am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(areafilter_test_SOURCES) $(change_test_SOURCES) \ - $(geo_test_SOURCES) $(hashtags_test_SOURCES) \ - $(planetreplicator_test_SOURCES) $(pq_test_SOURCES) \ - $(stats_test_SOURCES) $(statsconfig_test_SOURCES) \ - $(test_playground_SOURCES) $(val_test_SOURCES) \ - $(yaml_test_SOURCES) -DIST_SOURCES = $(areafilter_test_SOURCES) $(change_test_SOURCES) \ - $(geo_test_SOURCES) $(hashtags_test_SOURCES) \ - $(planetreplicator_test_SOURCES) $(pq_test_SOURCES) \ - $(stats_test_SOURCES) $(statsconfig_test_SOURCES) \ - $(test_playground_SOURCES) $(val_test_SOURCES) \ - $(yaml_test_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DEJATOOL = $(PACKAGE) -RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir -EXPECT = expect -RUNTEST = runtest -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /code/missing aclocal-1.16 -AMTAR = $${TAR-tar} -AM_DEFAULT_VERBOSITY = 1 -AR = ar -ARCH = x86_64 -AUTOCONF = ${SHELL} /code/missing autoconf -AUTOHEADER = ${SHELL} /code/missing autoheader -AUTOMAKE = ${SHELL} /code/missing automake-1.16 -AWK = mawk -BOOST_CPPFLAGS = -pthread -I/usr/include -BOOST_DATE_TIME_LIB = -lboost_date_time -BOOST_FILESYSTEM_LIB = -lboost_filesystem -BOOST_IOSTREAMS_LIB = -lboost_iostreams -BOOST_LDFLAGS = -L/usr/lib/x86_64-linux-gnu -BOOST_LOCALE_LIB = -lboost_locale -BOOST_LOG_LIB = -lboost_log -BOOST_PROGRAM_OPTIONS_LIB = -lboost_program_options -BOOST_PYTHON_LIB = -BOOST_SERIALIZATION_LIB = -lboost_serialization -BOOST_SYSTEM_LIB = -lboost_system -BOOST_THREAD_LIB = -lboost_thread -lpthread -BOOST_TIMER_LIB = -lboost_timer -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPP = gcc -E -CPPFLAGS = -I/usr/local/include -I/usr/include/gdal -pthread -I/usr/lib/x86_64-linux-gnu/openmpi/include -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/include/python3.8 -I/usr/include/x86_64-linux-gnu/python3.8 -I/usr/include/libxml++-2.6 -I/usr/lib/x86_64-linux-gnu/libxml++-2.6/include -I/usr/include/libxml2 -I/usr/include/glibmm-2.4 -I/usr/lib/x86_64-linux-gnu/glibmm-2.4/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sigc++-2.0 -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include -I/usr/include/python3.8 -I/usr/include/python3.8 -Wno-unused-result -Wsign-compare -g -fdebug-prefix-map=/build/python3.8-4OrTnN/python3.8-3.8.10=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -CXX = g++ -CXXCPP = g++ -E -CXXDEPMODE = depmode=gcc3 -CXXFLAGS = -g -O2 -std=c++17 -CYGPATH_W = echo -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -DLLTOOL = false -DLOPEN = -dlopen -DLPREOPEN = -dlpreopen -DOXYGEN = -DSYMUTIL = -DUMPBIN = -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = /usr/bin/grep -E -EXEEXT = -FGREP = /usr/bin/grep -F -GETTEXT_MACRO_VERSION = 0.20 -GIT = /usr/bin/git -GMSGFMT = : -GMSGFMT_015 = : -GREP = /usr/bin/grep -INSTALL = /usr/bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = $(install_sh) -c -s -INTLLIBS = -INTL_MACOSX_LIBS = -LD = /usr/bin/ld -m elf_x86_64 -LDFLAGS = -LIBICONV = -LIBINTL = -LIBOBJS = -LIBS = -lexpat -lz -L/usr/lib64 -lbz2 -L/usr/local/lib -lpqxx -lssl -lcrypto -lgumbo -lz -lgdal -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lglib-2.0 -lsigc-2.0 -lpthread -ldl -lboost_regex -lcrypt -lpthread -ldl -lutil -lm -lm -lpython3.8 -LIBTOOL = $(SHELL) $(top_builddir)/libtool -LIPO = -LN_S = ln -s -LTLIBICONV = -LTLIBINTL = -LTLIBOBJS = -LT_SYS_LIBRARY_PATH = -MAKEINFO = ${SHELL} /code/missing makeinfo -MANIFEST_TOOL = : -MKDIR_P = /usr/bin/mkdir -p -MSGFMT = : -MSGMERGE = : -MSGMERGE_FOR_MSGFMT_OPTION = --no-location --quiet -NM = /usr/bin/nm -B -NMEDIT = -OBJDUMP = objdump -OBJEXT = o -OTOOL = -OTOOL64 = -PACKAGE = underpass -PACKAGE_BUGREPORT = -PACKAGE_NAME = underpass -PACKAGE_STRING = underpass 0.3_dev -PACKAGE_TARNAME = underpass -PACKAGE_URL = -PACKAGE_VERSION = 0.3_dev -PATH_SEPARATOR = : -PCH_FLAGS = -include all-includes.h -Winvalid-pch -POMAKEFILEDEPS = -POSUB = -PYTHON = /usr/bin/python -PYTHON_CPPFLAGS = -I/usr/include/python3.8 -PYTHON_EXEC_PREFIX = ${exec_prefix} -PYTHON_EXTRA_LDFLAGS = -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -PYTHON_EXTRA_LIBS = -lcrypt -lpthread -ldl -lutil -lm -lm -PYTHON_LIBS = -L/usr/lib -lpython3.8 -PYTHON_PLATFORM = linux -PYTHON_PLATFORM_SITE_PKG = -PYTHON_PREFIX = ${prefix} -PYTHON_SITE_PKG = /usr/lib/python3.8/site-packages -PYTHON_VERSION = 3.8 -RANLIB = ranlib -SED = /usr/bin/sed -SET_MAKE = -SHELL = /bin/bash -SRCDIR = . -STRIP = strip -USE_NLS = no -VERSION = 0.3_dev -XGETTEXT = : -XGETTEXT_015 = : -XGETTEXT_EXTRA_OPTIONS = -abs_builddir = /code/src/testsuite/libunderpass.all -abs_srcdir = /code/src/testsuite/libunderpass.all -abs_top_builddir = /code -abs_top_srcdir = /code -ac_ct_AR = ar -ac_ct_CC = gcc -ac_ct_CXX = g++ -ac_ct_DUMPBIN = -am__include = include -am__leading_dot = . -am__quote = -am__tar = $${TAR-tar} chof - "$$tardir" -am__untar = $${TAR-tar} xf - -bindir = ${exec_prefix}/bin -build = x86_64-pc-linux-gnu -build_alias = -build_cpu = x86_64 -build_os = linux-gnu -build_vendor = pc -builddir = . -datadir = ${datarootdir} -datarootdir = ${prefix}/share -docdir = ${datarootdir}/docs/${PACKAGE_TARNAME} -dvidir = ${docdir} -exec_prefix = ${prefix} -host = x86_64-pc-linux-gnu -host_alias = -host_cpu = x86_64 -host_os = linux-gnu -host_vendor = pc -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${datarootdir}/info -install_sh = ${SHELL} /code/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localedir = ${datarootdir}/locale -localstatedir = ${prefix}/var -mandir = ${datarootdir}/man -mkdir_p = $(MKDIR_P) -oldincludedir = /usr/include -pdfdir = ${docdir} -pkgpyexecdir = ${pyexecdir}/underpass -pkgpythondir = ${pythondir}/underpass -prefix = /usr/local -program_transform_name = s,x,x, -psdir = ${docdir} -pyexecdir = ${exec_prefix}/lib/python3.8/site-packages -pythondir = ${prefix}/lib/python3.8/site-packages -runstatedir = ${localstatedir}/run -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -srcdir = . -sysconfdir = ${prefix}/etc -target_alias = -top_build_prefix = ../../../ -top_builddir = ../../.. -top_srcdir = ../../.. -AUTOMAKE_OPTIONS = dejagnu -TOPSRC := $(shell cd $(top_srcdir) && pwd)/src -AM_CPPFLAGS = -I$(TOPSRC) -DDATADIR=\"$(TOPSRC)\" -AM_LDFLAGS = -L../.. -BOOST_LIBS = \ - $(BOOST_DATE_TIME_LIB) \ - $(BOOST_SYSTEM_LIB) \ - $(BOOST_FILESYSTEM_LIB) \ - $(BOOST_LOG_LIB) \ - $(BOOST_PROGRAM_OPTIONS_LIB) \ - $(BOOST_IOSTREAMS_LIB) \ - $(BOOST_THREAD_LIB) \ - $(BOOST_LOCALE_LIB) \ - $(BOOST_TIMER_LIB) \ - $(BOOST_PYTHON_LIB) - -AM_CXXFLAGS = \ - -fPIC \ - -DPKGLIBDIR=\"$(pkglibdir)\" \ - -DTOPSRCDIR=\"$(TOPSRC)\" \ - -DSRCDIR=\"$(srcdir)\" \ - -DBOOST_LOCALE_HIDE_AUTO_PTR \ - -Wno-deprecated-declarations - -yaml_test_SOURCES = yaml-test.cc -yaml_test_LDFLAGS = -L../.. -yaml_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) -yaml_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) -pq_test_SOURCES = pq-test.cc -pq_test_LDFLAGS = -L../.. -pq_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) -pq_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) -geo_test_SOURCES = geo-test.cc -geo_test_LDFLAGS = -L../.. -geo_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) -geo_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) -val_test_SOURCES = val-test.cc -val_test_LDFLAGS = -L../.. -val_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) -val_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) ../../validate/hotosm.lo - -# Test the replication classes -#replication_test_SOURCES = replication-test.cc -#replication_test_LDFLAGS = -L../.. -#rplication_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) -#replication_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) - -# Test the OSM DB classes -#hotosm_test_SOURCES = hotosm-test.cc -#hotosm_test_LDFLAGS = -L../.. -#hotosm_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) - -# Test the OSM Stats class -stats_test_SOURCES = stats-test.cc -stats_test_LDFLAGS = -L../.. -stats_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) -stats_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) - -# Test the OSM StatsConfig -statsconfig_test_SOURCES = statsconfig-test.cc -statsconfig_test_LDFLAGS = -L../.. -statsconfig_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) - -# Test the PlanetReplicator class -planetreplicator_test_SOURCES = planetreplicator-test.cc -planetreplicator_test_LDFLAGS = -L../.. -planetreplicator_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) - -# Test the Changeset class -change_test_SOURCES = change-test.cc -change_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) -change_test_LDFLAGS = -L../.. -change_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) - -# Test areaFilter -areafilter_test_SOURCES = areafilter-test.cc -areafilter_test_LDFLAGS = -L../.. -areafilter_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) - -# Hashtags test -hashtags_test_SOURCES = hashtags-test.cc -hashtags_test_LDFLAGS = -L../.. -hashtags_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) - -# Test playground -test_playground_SOURCES = test-playground.cc -test_playground_LDFLAGS = -L../.. -test_playground_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) -CLEANFILES = \ - underpass.log \ - pq-test.log \ - change-test.log \ - geo-test.log \ - stats-test.log \ - val-test.log \ - statsconfig-test.log \ - planetreplicator-test.log \ - areafilter-test.log \ - hashtags-test.log \ - replication-test.log - -RUNTESTFLAGS = -xml -all: all-am - -.SUFFIXES: -.SUFFIXES: .cc .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/testsuite/libunderpass.all/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/testsuite/libunderpass.all/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -areafilter-test$(EXEEXT): $(areafilter_test_OBJECTS) $(areafilter_test_DEPENDENCIES) $(EXTRA_areafilter_test_DEPENDENCIES) - @rm -f areafilter-test$(EXEEXT) - $(AM_V_CXXLD)$(areafilter_test_LINK) $(areafilter_test_OBJECTS) $(areafilter_test_LDADD) $(LIBS) - -change-test$(EXEEXT): $(change_test_OBJECTS) $(change_test_DEPENDENCIES) $(EXTRA_change_test_DEPENDENCIES) - @rm -f change-test$(EXEEXT) - $(AM_V_CXXLD)$(change_test_LINK) $(change_test_OBJECTS) $(change_test_LDADD) $(LIBS) - -geo-test$(EXEEXT): $(geo_test_OBJECTS) $(geo_test_DEPENDENCIES) $(EXTRA_geo_test_DEPENDENCIES) - @rm -f geo-test$(EXEEXT) - $(AM_V_CXXLD)$(geo_test_LINK) $(geo_test_OBJECTS) $(geo_test_LDADD) $(LIBS) - -hashtags-test$(EXEEXT): $(hashtags_test_OBJECTS) $(hashtags_test_DEPENDENCIES) $(EXTRA_hashtags_test_DEPENDENCIES) - @rm -f hashtags-test$(EXEEXT) - $(AM_V_CXXLD)$(hashtags_test_LINK) $(hashtags_test_OBJECTS) $(hashtags_test_LDADD) $(LIBS) - -planetreplicator-test$(EXEEXT): $(planetreplicator_test_OBJECTS) $(planetreplicator_test_DEPENDENCIES) $(EXTRA_planetreplicator_test_DEPENDENCIES) - @rm -f planetreplicator-test$(EXEEXT) - $(AM_V_CXXLD)$(planetreplicator_test_LINK) $(planetreplicator_test_OBJECTS) $(planetreplicator_test_LDADD) $(LIBS) - -pq-test$(EXEEXT): $(pq_test_OBJECTS) $(pq_test_DEPENDENCIES) $(EXTRA_pq_test_DEPENDENCIES) - @rm -f pq-test$(EXEEXT) - $(AM_V_CXXLD)$(pq_test_LINK) $(pq_test_OBJECTS) $(pq_test_LDADD) $(LIBS) - -stats-test$(EXEEXT): $(stats_test_OBJECTS) $(stats_test_DEPENDENCIES) $(EXTRA_stats_test_DEPENDENCIES) - @rm -f stats-test$(EXEEXT) - $(AM_V_CXXLD)$(stats_test_LINK) $(stats_test_OBJECTS) $(stats_test_LDADD) $(LIBS) - -statsconfig-test$(EXEEXT): $(statsconfig_test_OBJECTS) $(statsconfig_test_DEPENDENCIES) $(EXTRA_statsconfig_test_DEPENDENCIES) - @rm -f statsconfig-test$(EXEEXT) - $(AM_V_CXXLD)$(statsconfig_test_LINK) $(statsconfig_test_OBJECTS) $(statsconfig_test_LDADD) $(LIBS) - -test-playground$(EXEEXT): $(test_playground_OBJECTS) $(test_playground_DEPENDENCIES) $(EXTRA_test_playground_DEPENDENCIES) - @rm -f test-playground$(EXEEXT) - $(AM_V_CXXLD)$(test_playground_LINK) $(test_playground_OBJECTS) $(test_playground_LDADD) $(LIBS) - -val-test$(EXEEXT): $(val_test_OBJECTS) $(val_test_DEPENDENCIES) $(EXTRA_val_test_DEPENDENCIES) - @rm -f val-test$(EXEEXT) - $(AM_V_CXXLD)$(val_test_LINK) $(val_test_OBJECTS) $(val_test_LDADD) $(LIBS) - -yaml-test$(EXEEXT): $(yaml_test_OBJECTS) $(yaml_test_DEPENDENCIES) $(EXTRA_yaml_test_DEPENDENCIES) - @rm -f yaml-test$(EXEEXT) - $(AM_V_CXXLD)$(yaml_test_LINK) $(yaml_test_OBJECTS) $(yaml_test_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -include ./$(DEPDIR)/areafilter-test.Po # am--include-marker -include ./$(DEPDIR)/change_test-change-test.Po # am--include-marker -include ./$(DEPDIR)/geo_test-geo-test.Po # am--include-marker -include ./$(DEPDIR)/hashtags-test.Po # am--include-marker -include ./$(DEPDIR)/planetreplicator-test.Po # am--include-marker -include ./$(DEPDIR)/pq_test-pq-test.Po # am--include-marker -include ./$(DEPDIR)/stats_test-stats-test.Po # am--include-marker -include ./$(DEPDIR)/statsconfig-test.Po # am--include-marker -include ./$(DEPDIR)/test-playground.Po # am--include-marker -include ./$(DEPDIR)/val_test-val-test.Po # am--include-marker -include ./$(DEPDIR)/yaml_test-yaml-test.Po # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) - -.cc.o: - $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< - $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -# $(AM_V_CXX)source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: - $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` - $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -# $(AM_V_CXX)source='$<' object='$@' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cc.lo: - $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< - $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -# $(AM_V_CXX)source='$<' object='$@' libtool=yes \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(LTCXXCOMPILE) -c -o $@ $< - -change_test-change-test.o: change-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(change_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT change_test-change-test.o -MD -MP -MF $(DEPDIR)/change_test-change-test.Tpo -c -o change_test-change-test.o `test -f 'change-test.cc' || echo '$(srcdir)/'`change-test.cc - $(AM_V_at)$(am__mv) $(DEPDIR)/change_test-change-test.Tpo $(DEPDIR)/change_test-change-test.Po -# $(AM_V_CXX)source='change-test.cc' object='change_test-change-test.o' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(change_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o change_test-change-test.o `test -f 'change-test.cc' || echo '$(srcdir)/'`change-test.cc - -change_test-change-test.obj: change-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(change_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT change_test-change-test.obj -MD -MP -MF $(DEPDIR)/change_test-change-test.Tpo -c -o change_test-change-test.obj `if test -f 'change-test.cc'; then $(CYGPATH_W) 'change-test.cc'; else $(CYGPATH_W) '$(srcdir)/change-test.cc'; fi` - $(AM_V_at)$(am__mv) $(DEPDIR)/change_test-change-test.Tpo $(DEPDIR)/change_test-change-test.Po -# $(AM_V_CXX)source='change-test.cc' object='change_test-change-test.obj' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(change_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o change_test-change-test.obj `if test -f 'change-test.cc'; then $(CYGPATH_W) 'change-test.cc'; else $(CYGPATH_W) '$(srcdir)/change-test.cc'; fi` - -geo_test-geo-test.o: geo-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(geo_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT geo_test-geo-test.o -MD -MP -MF $(DEPDIR)/geo_test-geo-test.Tpo -c -o geo_test-geo-test.o `test -f 'geo-test.cc' || echo '$(srcdir)/'`geo-test.cc - $(AM_V_at)$(am__mv) $(DEPDIR)/geo_test-geo-test.Tpo $(DEPDIR)/geo_test-geo-test.Po -# $(AM_V_CXX)source='geo-test.cc' object='geo_test-geo-test.o' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(geo_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o geo_test-geo-test.o `test -f 'geo-test.cc' || echo '$(srcdir)/'`geo-test.cc - -geo_test-geo-test.obj: geo-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(geo_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT geo_test-geo-test.obj -MD -MP -MF $(DEPDIR)/geo_test-geo-test.Tpo -c -o geo_test-geo-test.obj `if test -f 'geo-test.cc'; then $(CYGPATH_W) 'geo-test.cc'; else $(CYGPATH_W) '$(srcdir)/geo-test.cc'; fi` - $(AM_V_at)$(am__mv) $(DEPDIR)/geo_test-geo-test.Tpo $(DEPDIR)/geo_test-geo-test.Po -# $(AM_V_CXX)source='geo-test.cc' object='geo_test-geo-test.obj' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(geo_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o geo_test-geo-test.obj `if test -f 'geo-test.cc'; then $(CYGPATH_W) 'geo-test.cc'; else $(CYGPATH_W) '$(srcdir)/geo-test.cc'; fi` - -pq_test-pq-test.o: pq-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pq_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pq_test-pq-test.o -MD -MP -MF $(DEPDIR)/pq_test-pq-test.Tpo -c -o pq_test-pq-test.o `test -f 'pq-test.cc' || echo '$(srcdir)/'`pq-test.cc - $(AM_V_at)$(am__mv) $(DEPDIR)/pq_test-pq-test.Tpo $(DEPDIR)/pq_test-pq-test.Po -# $(AM_V_CXX)source='pq-test.cc' object='pq_test-pq-test.o' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pq_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pq_test-pq-test.o `test -f 'pq-test.cc' || echo '$(srcdir)/'`pq-test.cc - -pq_test-pq-test.obj: pq-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pq_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pq_test-pq-test.obj -MD -MP -MF $(DEPDIR)/pq_test-pq-test.Tpo -c -o pq_test-pq-test.obj `if test -f 'pq-test.cc'; then $(CYGPATH_W) 'pq-test.cc'; else $(CYGPATH_W) '$(srcdir)/pq-test.cc'; fi` - $(AM_V_at)$(am__mv) $(DEPDIR)/pq_test-pq-test.Tpo $(DEPDIR)/pq_test-pq-test.Po -# $(AM_V_CXX)source='pq-test.cc' object='pq_test-pq-test.obj' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pq_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pq_test-pq-test.obj `if test -f 'pq-test.cc'; then $(CYGPATH_W) 'pq-test.cc'; else $(CYGPATH_W) '$(srcdir)/pq-test.cc'; fi` - -stats_test-stats-test.o: stats-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stats_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT stats_test-stats-test.o -MD -MP -MF $(DEPDIR)/stats_test-stats-test.Tpo -c -o stats_test-stats-test.o `test -f 'stats-test.cc' || echo '$(srcdir)/'`stats-test.cc - $(AM_V_at)$(am__mv) $(DEPDIR)/stats_test-stats-test.Tpo $(DEPDIR)/stats_test-stats-test.Po -# $(AM_V_CXX)source='stats-test.cc' object='stats_test-stats-test.o' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stats_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o stats_test-stats-test.o `test -f 'stats-test.cc' || echo '$(srcdir)/'`stats-test.cc - -stats_test-stats-test.obj: stats-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stats_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT stats_test-stats-test.obj -MD -MP -MF $(DEPDIR)/stats_test-stats-test.Tpo -c -o stats_test-stats-test.obj `if test -f 'stats-test.cc'; then $(CYGPATH_W) 'stats-test.cc'; else $(CYGPATH_W) '$(srcdir)/stats-test.cc'; fi` - $(AM_V_at)$(am__mv) $(DEPDIR)/stats_test-stats-test.Tpo $(DEPDIR)/stats_test-stats-test.Po -# $(AM_V_CXX)source='stats-test.cc' object='stats_test-stats-test.obj' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stats_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o stats_test-stats-test.obj `if test -f 'stats-test.cc'; then $(CYGPATH_W) 'stats-test.cc'; else $(CYGPATH_W) '$(srcdir)/stats-test.cc'; fi` - -val_test-val-test.o: val-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(val_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT val_test-val-test.o -MD -MP -MF $(DEPDIR)/val_test-val-test.Tpo -c -o val_test-val-test.o `test -f 'val-test.cc' || echo '$(srcdir)/'`val-test.cc - $(AM_V_at)$(am__mv) $(DEPDIR)/val_test-val-test.Tpo $(DEPDIR)/val_test-val-test.Po -# $(AM_V_CXX)source='val-test.cc' object='val_test-val-test.o' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(val_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o val_test-val-test.o `test -f 'val-test.cc' || echo '$(srcdir)/'`val-test.cc - -val_test-val-test.obj: val-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(val_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT val_test-val-test.obj -MD -MP -MF $(DEPDIR)/val_test-val-test.Tpo -c -o val_test-val-test.obj `if test -f 'val-test.cc'; then $(CYGPATH_W) 'val-test.cc'; else $(CYGPATH_W) '$(srcdir)/val-test.cc'; fi` - $(AM_V_at)$(am__mv) $(DEPDIR)/val_test-val-test.Tpo $(DEPDIR)/val_test-val-test.Po -# $(AM_V_CXX)source='val-test.cc' object='val_test-val-test.obj' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(val_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o val_test-val-test.obj `if test -f 'val-test.cc'; then $(CYGPATH_W) 'val-test.cc'; else $(CYGPATH_W) '$(srcdir)/val-test.cc'; fi` - -yaml_test-yaml-test.o: yaml-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yaml_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yaml_test-yaml-test.o -MD -MP -MF $(DEPDIR)/yaml_test-yaml-test.Tpo -c -o yaml_test-yaml-test.o `test -f 'yaml-test.cc' || echo '$(srcdir)/'`yaml-test.cc - $(AM_V_at)$(am__mv) $(DEPDIR)/yaml_test-yaml-test.Tpo $(DEPDIR)/yaml_test-yaml-test.Po -# $(AM_V_CXX)source='yaml-test.cc' object='yaml_test-yaml-test.o' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yaml_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yaml_test-yaml-test.o `test -f 'yaml-test.cc' || echo '$(srcdir)/'`yaml-test.cc - -yaml_test-yaml-test.obj: yaml-test.cc - $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yaml_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT yaml_test-yaml-test.obj -MD -MP -MF $(DEPDIR)/yaml_test-yaml-test.Tpo -c -o yaml_test-yaml-test.obj `if test -f 'yaml-test.cc'; then $(CYGPATH_W) 'yaml-test.cc'; else $(CYGPATH_W) '$(srcdir)/yaml-test.cc'; fi` - $(AM_V_at)$(am__mv) $(DEPDIR)/yaml_test-yaml-test.Tpo $(DEPDIR)/yaml_test-yaml-test.Po -# $(AM_V_CXX)source='yaml-test.cc' object='yaml_test-yaml-test.obj' libtool=no \ -# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ -# $(AM_V_CXX_no)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(yaml_test_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o yaml_test-yaml-test.obj `if test -f 'yaml-test.cc'; then $(CYGPATH_W) 'yaml-test.cc'; else $(CYGPATH_W) '$(srcdir)/yaml-test.cc'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -check-DEJAGNU: site.exp - srcdir='$(srcdir)'; export srcdir; \ - EXPECT=$(EXPECT); export EXPECT; \ - if $(SHELL) -c "$(RUNTEST) --version" > /dev/null 2>&1; then \ - exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \ - if $(RUNTEST) $(RUNTESTDEFAULTFLAGS) $(AM_RUNTESTFLAGS) $(RUNTESTFLAGS); \ - then :; else exit_status=1; fi; \ - done; \ - else echo "WARNING: could not find '$(RUNTEST)'" 1>&2; :;\ - fi; \ - exit $$exit_status -site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) - @echo 'Making a new site.exp file ...' - @echo '## these variables are automatically generated by make ##' >site.tmp - @echo '# Do not edit here. If you wish to override these values' >>site.tmp - @echo '# edit the last section' >>site.tmp - @echo 'set srcdir "$(srcdir)"' >>site.tmp - @echo "set objdir `pwd`" >>site.tmp - @echo 'set build_alias "$(build_alias)"' >>site.tmp - @echo 'set build_triplet $(build_triplet)' >>site.tmp - @echo 'set host_alias "$(host_alias)"' >>site.tmp - @echo 'set host_triplet $(host_triplet)' >>site.tmp - @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ - echo "## Begin content included from file $$f. Do not modify. ##" \ - && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ - && echo "## End content included from file $$f. ##" \ - || exit 1; \ - done >> site.tmp - @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp - @if test -f site.exp; then \ - sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \ - fi - @-rm -f site.bak - @test ! -f site.exp || mv site.exp site.bak - @mv site.tmp site.exp - -distclean-DEJAGNU: - -rm -f site.exp site.bak - -l='$(DEJATOOL)'; for tool in $$l; do \ - rm -f $$tool.sum $$tool.log; \ - done - -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/areafilter-test.Po - -rm -f ./$(DEPDIR)/change_test-change-test.Po - -rm -f ./$(DEPDIR)/geo_test-geo-test.Po - -rm -f ./$(DEPDIR)/hashtags-test.Po - -rm -f ./$(DEPDIR)/planetreplicator-test.Po - -rm -f ./$(DEPDIR)/pq_test-pq-test.Po - -rm -f ./$(DEPDIR)/stats_test-stats-test.Po - -rm -f ./$(DEPDIR)/statsconfig-test.Po - -rm -f ./$(DEPDIR)/test-playground.Po - -rm -f ./$(DEPDIR)/val_test-val-test.Po - -rm -f ./$(DEPDIR)/yaml_test-yaml-test.Po - -rm -f Makefile -distclean-am: clean-am distclean-DEJAGNU distclean-compile \ - distclean-generic distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/areafilter-test.Po - -rm -f ./$(DEPDIR)/change_test-change-test.Po - -rm -f ./$(DEPDIR)/geo_test-geo-test.Po - -rm -f ./$(DEPDIR)/hashtags-test.Po - -rm -f ./$(DEPDIR)/planetreplicator-test.Po - -rm -f ./$(DEPDIR)/pq_test-pq-test.Po - -rm -f ./$(DEPDIR)/stats_test-stats-test.Po - -rm -f ./$(DEPDIR)/statsconfig-test.Po - -rm -f ./$(DEPDIR)/test-playground.Po - -rm -f ./$(DEPDIR)/val_test-val-test.Po - -rm -f ./$(DEPDIR)/yaml_test-yaml-test.Po - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-DEJAGNU \ - check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ - cscopelist-am ctags ctags-am distclean distclean-DEJAGNU \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/testsuite/libunderpass.all/Makefile.am b/src/testsuite/libunderpass.all/Makefile.am index 5073142e..f52ee79e 100644 --- a/src/testsuite/libunderpass.all/Makefile.am +++ b/src/testsuite/libunderpass.all/Makefile.am @@ -75,12 +75,12 @@ geo_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) val_test_SOURCES = val-test.cc val_test_LDFLAGS = -L../.. val_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) -val_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) ../../validate/hotosm.lo +val_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) ../../validate/defaultvalidation.lo ../../validate/geospatial.lo ../../validate/semantic.lo val_unsquared_test_SOURCES = val-unsquared-test.cc val_unsquared_test_LDFLAGS = -L../.. val_unsquared_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) -val_unsquared_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) ../../validate/hotosm.lo +val_unsquared_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) ../../validate/defaultvalidation.lo ../../validate/geospatial.lo ../../validate/semantic.lo # Test the replication classes #replication_test_SOURCES = replication-test.cc @@ -88,11 +88,6 @@ val_unsquared_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) ../../validate/hotos #rplication_test_CPPFLAGS = -DDATADIR=\"$(TOPSRC)\" -I$(TOPSRC) #replication_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) -# Test the OSM DB classes -#hotosm_test_SOURCES = hotosm-test.cc -#hotosm_test_LDFLAGS = -L../.. -#hotosm_test_LDADD = -lpqxx -lunderpass $(BOOST_LIBS) - # Test the OSM Stats class stats_test_SOURCES = stats-test.cc stats_test_LDFLAGS = -L../.. diff --git a/src/testsuite/libunderpass.all/hotosm-test.cc b/src/testsuite/libunderpass.all/hotosm-test.cc deleted file mode 100644 index 4cd900de..00000000 --- a/src/testsuite/libunderpass.all/hotosm-test.cc +++ /dev/null @@ -1,157 +0,0 @@ -// -// Copyright (c) 2020, 2021, 2022, 2023 Humanitarian OpenStreetMap Team -// -// This file is part of Underpass. -// -// Underpass is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Underpass is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Underpass. If not, see . -// - -#include -#include -#include -#include "hotosm.hh" - -#include -#include "boost/date_time/posix_time/posix_time.hpp" -#include "boost/date_time/gregorian/gregorian.hpp" - -using namespace apidb; -using namespace boost::posix_time; -using namespace boost::gregorian; - -namespace hotosmtest { - -TestState runtest; - -class TestPG : public QueryStats -{ -public: - TestPG() { - uid = 760688; - }; -private: - long uid; -}; - -class TestTM : public QueryTM -{ -public: - TestTM() { - uid = 760688; - }; -private: - long uid; -}; - -void test_pgsnapshot(void); -void test_tm(void); -void test_leaderboard(void); - -int -main(int argc, char *argv[]) -{ - - test_pgsnapshot(); - test_tm(); - test_leaderboard(); -} - -void -test_pgsnapshot(void) -{ -// FIXME: database should be a command line argument - std::string database = "pgsnapshot"; - long uid = 7606880; - TestPG testpg; - - // These testpgs are for the base class, which handles - // the database connection. - if (testpg.connect(database)) { - runtest.pass("QueryDB::connect()"); - } else { - runtest.fail("QueryDB::connect()"); - } - std::string sql = "SELECT * FROM ways;"; - pqxx::result result = testpg.query(sql); - if (!result.empty()) { - runtest.pass("QueryDB::query()"); - } else { - runtest.fail("QueryDB::query()"); - } - - ptime start = time_from_string("2010-07-08 13:29:46"); - ptime end = second_clock::local_time(); - - // std::cout << to_simple_string(start) << std::endl; - // std::cout << to_simple_string(end) << std::endl; - - long ret = testpg.getCount(QueryStats::building, uid, - QueryStats::totals, start, end); - if (ret >= 0) { - runtest.pass("getCount(QueryStats::building)"); - } else { - runtest.fail("getCount(QueryStats::building)"); - } - ret = testpg.getCount(QueryStats::highway, uid, - QueryStats::totals, start, end); - if (ret >= 0) { - runtest.pass("getCount(QueryStats::highway)"); - } else { - runtest.fail("getCount(QueryStats::highway)"); - } - - ret = testpg.getCount(QueryStats::waterway, uid, - QueryStats::totals, start, end); - if (ret >= 0) { - runtest.pass("getCount(QueryStats::waterway)"); - } else { - runtest.fail("getCount(QueryStats::waterway)"); - } - - ret = testpg.getCount(QueryStats::highway, uid, - QueryStats::changesets, start, end); - if (ret >= 0) { - runtest.pass("getCount(QueryStats::highway,changesets)"); - } else { - runtest.fail("getCount(QueryStats::highway,changesets)"); - } - ret = testpg.getCount(QueryStats::building, uid, - QueryStats::changesets, start, end); - if (ret >= 0) { - runtest.pass("getCount(QueryStats::building,changesets)"); - } else { - runtest.fail("getCount(QueryStats::building,changesets)"); - } - ret = testpg.getCount(QueryStats::waterway, uid, - QueryStats::changesets, start, end); - if (ret >= 0) { - runtest.pass("getCount(QueryStats::waterway,changesets)"); - } else { - runtest.fail("getCount(QueryStats::waterway,changesets)"); - } - - ret = testpg.getLength(QueryStats::waterway, uid, start, end); - if (ret >= 0) { - runtest.pass("getCount(QueryStats::getLength(waterway))"); - } else { - runtest.fail("getCount(QueryStats::getLength(waterway)"); - } -} - -} - -// local Variables: -// mode: C++ -// indent-tabs-mode: nil -// End: diff --git a/src/testsuite/libunderpass.all/pq-test.cc b/src/testsuite/libunderpass.all/pq-test.cc index e6d14d2e..4f4ed3dc 100644 --- a/src/testsuite/libunderpass.all/pq-test.cc +++ b/src/testsuite/libunderpass.all/pq-test.cc @@ -58,7 +58,7 @@ main(int argc, char *argv[]) } ret = tp.parseURL("localhost/testdb"); //tp.dump(); - if (ret && tp.dbname == "dbname=testdb" && tp.host.empty()) { + if (ret && tp.dbname == "dbname=testdb" && tp.host == "host=localhost") { runtest.pass("PQ::parseURL(localhost/dbname)"); } else { runtest.fail("PQ::parseURL(localhost/dbname)"); diff --git a/src/testsuite/libunderpass.all/val-test.cc b/src/testsuite/libunderpass.all/val-test.cc index 8022e65d..0b0dfc9b 100644 --- a/src/testsuite/libunderpass.all/val-test.cc +++ b/src/testsuite/libunderpass.all/val-test.cc @@ -31,7 +31,7 @@ #include #include -#include "validate/hotosm.hh" +#include "validate/defaultvalidation.hh" #include "validate/validate.hh" #include "stats/querystats.hh" #include "osm/osmobjects.hh" @@ -48,9 +48,8 @@ class TestOsmChange : public osmchange::OsmChangeFile {}; typedef std::shared_ptr(plugin_t)(); -int test_semantic_building(std::shared_ptr &plugin); -// void test_semantic_highway(std::shared_ptr &plugin); -int test_geometry_building(std::shared_ptr &plugin); +int test_semantic(std::shared_ptr &plugin); +int test_geospatial(std::shared_ptr &plugin); int main(int argc, char *argv[]) @@ -68,7 +67,7 @@ main(int argc, char *argv[]) lib_path / "libunderpass.so", "create_plugin", boost::dll::load_mode::append_decorations ); - log_debug("Loaded plugin hotosm!"); + log_debug("Loaded plugin!"); } catch (std::exception& e) { log_debug("Couldn't load plugin! %1%", e.what()); exit(0); @@ -78,9 +77,8 @@ main(int argc, char *argv[]) auto plugin = creator(); plugin->loadConfig(testValidationConfig); - test_semantic_building(plugin); - // test_semantic_highway(plugin); - test_geometry_building(plugin); + test_semantic(plugin); + test_geospatial(plugin); } osmobjects::OsmWay readOsmWayFromFile(std::string filename) { @@ -96,79 +94,67 @@ osmobjects::OsmWay readOsmWayFromFile(std::string filename) { return *osmchange.changes.front().get()->ways.front().get(); } -void -test_semantic_highway(std::shared_ptr &plugin) { - // Way - checkWay() +int +test_semantic(std::shared_ptr &plugin) { - auto way = readOsmWayFromFile("/testsuite/testdata/validation/highway.osc"); + // Node - checkNode() - way.addTag("highway", "primary"); + osmobjects::OsmNode node; + node.id = 11111; + node.changeset = 22222; - // Has an invalid key=value - way.addTag("surface", "sponge"); - auto status = plugin->checkWay(way, "highway"); - if (status->hasStatus(badvalue)) { - runtest.pass("Validate::checkWay(bad value) [semantic highway]"); + // Node with no tags + auto status = plugin->checkNode(node, "building"); + if (status->osm_id == 11111 && status->hasStatus(notags)) { + runtest.pass("Validate::checkNode(no tags) [semantic building]"); } else { - runtest.fail("Validate::checkWay(bad value) [semantic highway]"); + runtest.fail("Validate::checkNode(no tags) [semantic building]"); + return 1; } - way.addTag("surface", "unpaved"); - way.addTag("smoothness", "very_horrible"); - way.addTag("highway", "unclassified"); - - // Has all valid tags - status = plugin->checkWay(way, "highway"); - if (!status->hasStatus(badvalue)) { - runtest.pass("Validate::checkWay(no bad values) [semantic highway]"); + // Node with tag with no value + node.addTag("building", ""); + status = plugin->checkNode(node, "building"); + if (status->hasStatus(badvalue)) { + runtest.pass("Validate::checkNode(no value) [semantic building]"); } else { - runtest.fail("Validate::checkWay(no bad values) [semantic highway]"); + runtest.fail("Validate::checkNode(no value) [semantic building]"); + return 1; } -} -int -test_semantic_building(std::shared_ptr &plugin) { - // checkTag() - - // Existence of key=value - auto status = plugin->checkTag("building", "yes"); - if (!status->hasStatus(badvalue)) { - runtest.pass("Validate::checkTag(good tag) [semantic building]"); + node.addTag("building", "\"yes\""); + status = plugin->checkNode(node, "building"); + if (status->hasStatus(badvalue)) { + runtest.pass("Validate::checkNode(double quotes) [semantic building]"); } else { - runtest.fail("Validate::checkTag(good tag) [semantic building]"); + runtest.fail("Validate::checkNode(double quotes) [semantic building]"); return 1; } - // Empty value - status = plugin->checkTag("building", ""); + node.addTag("building", "'yes'"); + status = plugin->checkNode(node, "building"); if (status->hasStatus(badvalue)) { - runtest.pass("Validate::checkTag(empty value) [semantic building]"); + runtest.pass("Validate::checkNode(single quotes) [semantic building]"); } else { - runtest.fail("Validate::checkTag(empty value) [semantic building]"); + runtest.fail("Validate::checkNode(single quotes) [semantic building]"); return 1; } - // Invalid tag, not listed into the config file (ex: foo bar=bar) - status = plugin->checkTag("foo bar", "bar"); + node.addTag("building", "yes "); + status = plugin->checkNode(node, "building"); if (status->hasStatus(badvalue)) { - runtest.pass("Validate::checkTag(space in key) [semantic building]"); + runtest.pass("Validate::checkNode(single quotes) [semantic building]"); } else { - runtest.fail("Validate::checkTag(space in key) [semantic building]"); + runtest.fail("Validate::checkNode(single quotes) [semantic building]"); return 1; } - // Node - checkPOI() - - osmobjects::OsmNode node; - node.id = 11111; - node.changeset = 22222; - - // Node with no tags - status = plugin->checkPOI(node, "building"); - if (status->osm_id == 11111 && status->hasStatus(notags)) { - runtest.pass("Validate::checkPOI(no tags) [semantic building]"); + node.addTag("building", "yes"); + status = plugin->checkNode(node, "building"); + if (!status->hasStatus(badvalue)) { + runtest.pass("Validate::checkNode(good value) [semantic building]"); } else { - runtest.fail("Validate::checkPOI(no tags) [semantic building]"); + runtest.fail("Validate::checkNode(good value) [semantic building]"); return 1; } @@ -178,20 +164,20 @@ test_semantic_building(std::shared_ptr &plugin) { // Has valid tags, but it's incomplete node_place.addTag("place", "city"); - status = plugin->checkPOI(node_place, "place"); + status = plugin->checkNode(node_place, "place"); if (!status->hasStatus(badvalue) && status->hasStatus(incomplete)) { - runtest.pass("Validate::checkPOI(incomplete but correct tagging) [semantic place]"); + runtest.pass("Validate::checkNode(incomplete but correct tagging) [semantic place]"); } else { - runtest.fail("Validate::checkPOI(incomplete but correct tagging) [semantic place]"); + runtest.fail("Validate::checkNode(incomplete but correct tagging) [semantic place]"); return 1; } node_place.addTag("name", "Electric City"); - status = plugin->checkPOI(node_place, "place"); + status = plugin->checkNode(node_place, "place"); if (!status->hasStatus(badvalue) && !status->hasStatus(incomplete)) { - runtest.pass("Validate::checkPOI(complete and correct tagging) [semantic place]"); + runtest.pass("Validate::checkNode(complete and correct tagging) [semantic place]"); } else { - runtest.fail("Validate::checkPOI(complete and correct tagging) [semantic place]"); + runtest.fail("Validate::checkNode(complete and correct tagging) [semantic place]"); return 1; } @@ -199,20 +185,20 @@ test_semantic_building(std::shared_ptr &plugin) { // Has an invalid key=value ... node.addTag("building:material", "sponge"); - status = plugin->checkPOI(node, "building"); + status = plugin->checkNode(node, "building"); if (status->hasStatus(badvalue)) { - runtest.pass("Validate::checkPOI(bad value) [semantic building]"); + runtest.pass("Validate::checkNode(bad value) [semantic building]"); } else { - runtest.fail("Validate::checkPOI(bad value) [semantic building]"); + runtest.fail("Validate::checkNode(bad value) [semantic building]"); return 1; } // But it's complete - status = plugin->checkPOI(node, "building"); + status = plugin->checkNode(node, "building"); if (status->hasStatus(complete)) { - runtest.pass("Validate::checkPOI(complete) [semantic building]"); + runtest.pass("Validate::checkNode(complete) [semantic building]"); } else { - runtest.fail("Validate::checkPOI(complete) [semantic building]"); + runtest.fail("Validate::checkNode(complete) [semantic building]"); return 1; } @@ -221,11 +207,11 @@ test_semantic_building(std::shared_ptr &plugin) { node.addTag("roof:material", "roof_tiles"); // Has all valid tags - status = plugin->checkPOI(node, "building"); + status = plugin->checkNode(node, "building"); if (!status->hasStatus(badvalue)) { - runtest.pass("Validate::checkPOI(no bad values) [semantic building]"); + runtest.pass("Validate::checkNode(no bad values) [semantic building]"); } else { - runtest.fail("Validate::checkPOI(no bad values) [semantic building]"); + runtest.fail("Validate::checkNode(no bad values) [semantic building]"); return 1; } @@ -287,17 +273,13 @@ test_semantic_building(std::shared_ptr &plugin) { return 1; } - + return 0; - // TODO: Has empty value - // TODO: Has single quote - // TODO: Has double quotes - // TODO: Has spaces } // Geometry tests for buildings int -test_geometry_building(std::shared_ptr &plugin) +test_geospatial(std::shared_ptr &plugin) { // Bad geometry @@ -307,11 +289,13 @@ test_geometry_building(std::shared_ptr &plugin) filespec += "/testsuite/testdata/validation/rect.osc"; if (boost::filesystem::exists(filespec)) { ocf.readChanges(filespec); + ocf.buildGeometriesFromNodeCache(); } for (auto it = std::begin(ocf.changes); it != std::end(ocf.changes); ++it) { osmchange::OsmChange *change = it->get(); for (auto wit = std::begin(change->ways); wit != std::end(change->ways); ++wit) { osmobjects::OsmWay *way = wit->get(); + auto status = plugin->checkWay(*way, "building"); // status->dump(); // std::cerr << way->tags["note"] << std::endl; @@ -409,29 +393,29 @@ test_geometry_building(std::shared_ptr &plugin) allways2.push_back(std::make_shared(way3)); // Overlapping (function) - if (plugin->overlaps(allways, way)) { - runtest.pass("Validate::overlaps() [geometry building]"); - } else { - runtest.fail("Validate::overlaps() [geometry building]"); - } - if (plugin->overlaps(allways, way3)) { - runtest.pass("Validate::overlaps(no) [geometry building]"); - } else { - runtest.fail("Validate::overlaps(no) [geometry building]"); - } + // if (plugin->overlaps(allways, way)) { + // runtest.pass("Validate::overlaps() [geometry building]"); + // } else { + // runtest.fail("Validate::overlaps() [geometry building]"); + // } + // if (plugin->overlaps(allways, way3)) { + // runtest.pass("Validate::overlaps(no) [geometry building]"); + // } else { + // runtest.fail("Validate::overlaps(no) [geometry building]"); + // } // Duplicate (function) - allways.push_back(std::make_shared(way)); - if (plugin->duplicate(allways, way2)) { - runtest.pass("Validate::duplicate() [geometry building]"); - } else { - runtest.fail("Validate::duplicate() [geometry building]"); - } - if (!plugin->duplicate(allways2, way2)) { - runtest.pass("Validate::duplicate(no) [geometry building]"); - } else { - runtest.fail("Validate::duplicate(no) [geometry building]"); - } + // allways.push_back(std::make_shared(way)); + // if (plugin->duplicate(allways, way2)) { + // runtest.pass("Validate::duplicate() [geometry building]"); + // } else { + // runtest.fail("Validate::duplicate() [geometry building]"); + // } + // if (!plugin->duplicate(allways2, way2)) { + // runtest.pass("Validate::duplicate(no) [geometry building]"); + // } else { + // runtest.fail("Validate::duplicate(no) [geometry building]"); + // } // Overlapping, duplicate osmchange::OsmChangeFile osmfoverlaping; diff --git a/src/testsuite/libunderpass.all/val-unsquared-test.cc b/src/testsuite/libunderpass.all/val-unsquared-test.cc index 0c2d8196..4b857eb5 100644 --- a/src/testsuite/libunderpass.all/val-unsquared-test.cc +++ b/src/testsuite/libunderpass.all/val-unsquared-test.cc @@ -20,7 +20,7 @@ #include #include #include "validate/validate.hh" -#include "validate/hotosm.hh" +#include "validate/defaultvalidation.hh" #include "osm/osmobjects.hh" #include "osm/osmchange.hh" #include "utils/log.hh" @@ -41,6 +41,7 @@ osmobjects::OsmWay readOsmWayFromFile(std::string filename) { } else { log_debug("Couldn't load ! %1%", filespec); }; + osmchange.buildGeometriesFromNodeCache(); return *osmchange.changes.front().get()->ways.front().get(); } @@ -52,7 +53,7 @@ main(int argc, char *argv[]) dbglogfile.setLogFilename("val-unsquared-test.log"); dbglogfile.setVerbosity(3); - auto plugin = std::make_shared(); + auto plugin = std::make_shared(); // Squared building 1 auto way = readOsmWayFromFile("/testsuite/testdata/validation/squared-building-1.osm"); diff --git a/src/testsuite/testdata/stats/test_stats.yaml b/src/testsuite/testdata/stats/test_stats.yaml index 6623d303..b150dc05 100644 --- a/src/testsuite/testdata/stats/test_stats.yaml +++ b/src/testsuite/testdata/stats/test_stats.yaml @@ -7,7 +7,7 @@ - modified_building: - 1 - added_building: - - 2 + - 1 - modified_waterway: - 1 - added_waterway: diff --git a/src/testsuite/testdata/validation/rect.osc b/src/testsuite/testdata/validation/rect.osc index 71a8e3ad..b5e1a13c 100644 --- a/src/testsuite/testdata/validation/rect.osc +++ b/src/testsuite/testdata/validation/rect.osc @@ -1,6 +1,22 @@ - + + + + + + + + + + + + + + + + + @@ -16,4 +32,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/utils/yaml.cc b/src/utils/yaml.cc index 615bed6a..c6c3e20e 100644 --- a/src/utils/yaml.cc +++ b/src/utils/yaml.cc @@ -95,7 +95,8 @@ std::pair Yaml::process_line(std::string line ) { } std::string Yaml::scan_ident(std::string line) { - const char *c = line.substr(0, 1).c_str(); + std::string firstChar = line.substr(0, 1); + const char *c = firstChar.c_str(); if (ident_char == '\0') { if (*c == idents[0]) { this->ident_char = idents[0]; diff --git a/src/validate/Makefile.am b/src/validate/Makefile.am index 3343d7cc..6e4631d7 100644 --- a/src/validate/Makefile.am +++ b/src/validate/Makefile.am @@ -32,7 +32,9 @@ BOOST_LIBS = $(BOOST_DATE_TIME_LIB) \ $(BOOST_LOCALE_LIB) libunderpass_la_SOURCES = \ - hotosm.cc hotosm.hh \ + geospatial.cc geospatial.hh \ + semantic.cc semantic.hh \ + defaultvalidation.cc defaultvalidation.hh \ validate.hh libunderpass_la_LDFLAGS = -module -avoid-version diff --git a/src/validate/defaultvalidation.cc b/src/validate/defaultvalidation.cc new file mode 100644 index 00000000..8655ee31 --- /dev/null +++ b/src/validate/defaultvalidation.cc @@ -0,0 +1,85 @@ +// +// Copyright (c) 2020, 2021, 2022, 2023 Humanitarian OpenStreetMap Team +// +// This file is part of Underpass. +// +// Underpass is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Underpass is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Underpass. If not, see . +// + +#ifndef __DEFAULTVALIDATION_H__ +#define __DEFAULTVALIDATION_H__ + +#include +#include "utils/yaml.hh" +#include "defaultvalidation.hh" +#include "geospatial.hh" +#include "semantic.hh" +#include "validate.hh" +#include "osm/osmchange.hh" +#include "utils/log.hh" + +using namespace logger; + +namespace defaultvalidation { + +LogFile &dbglogfile = LogFile::getDefaultInstance(); + +DefaultValidation::DefaultValidation(void) {} + +// Check a POI for tags. A node that is part of a way shouldn't have any +// tags, this is to check actual POIs, like a school. +std::shared_ptr +DefaultValidation::checkNode(const osmobjects::OsmNode &node, const std::string &type) +{ + auto status = std::make_shared(node); + status->timestamp = boost::posix_time::microsec_clock::universal_time(); + status->uid = node.uid; + if (yamls.size() == 0) { + log_error("No config files!"); + return status; + } + yaml::Yaml tests = yamls[type]; + semantic::Semantic::checkNode(node, type, tests, status); + + return status; +} + +// This checks a way. A way should always have some tags. Often a polygon +// with no tags is a building. +std::shared_ptr +DefaultValidation::checkWay(const osmobjects::OsmWay &way, const std::string &type) +{ + auto status = std::make_shared(way); + status->timestamp = boost::posix_time::microsec_clock::universal_time(); + status->uid = way.uid; + if (yamls.size() == 0) { + log_error("No config files!"); + return status; + } + yaml::Yaml tests = yamls[type]; + semantic::Semantic::checkWay(way, type, tests, status); + geospatial::Geospatial::checkWay(way, type, tests, status); + boost::geometry::centroid(way.linestring, status->center); + status->source = type; + return status; +} + +}; // namespace defaultvalidation + +#endif // EOF __DEFAULTVALIDATION_H__ + +// Local Variables: +// mode: C++ +// indent-tabs-mode: nil +// End: diff --git a/src/validate/defaultvalidation.hh b/src/validate/defaultvalidation.hh new file mode 100644 index 00000000..d3bf20f2 --- /dev/null +++ b/src/validate/defaultvalidation.hh @@ -0,0 +1,75 @@ +// +// Copyright (c) 2020, 2021, 2022, 2023 Humanitarian OpenStreetMap Team +// +// This file is part of Underpass. +// +// Underpass is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Underpass is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Underpass. If not, see . +// + +/// \file defaultvalidation.hh +/// \brief This file implements the default data validation + +#ifndef __DEFAULTVALIDATION_HH__ +#define __DEFAULTVALIDATION_HH__ + +// This is generated by autoconf +#ifdef HAVE_CONFIG_H +# include "unconfig.h" +#endif + +#include +#include "utils/yaml.hh" + +// MinGW related workaround +#define BOOST_DLL_FORCE_ALIAS_INSTANTIATION + +#include "validate.hh" + +/// \namespace defaultvalidation +namespace defaultvalidation { + +/// \class DefaultValidation +/// \brief This is the plugin class, deprived from the Validate class +class DefaultValidation : public Validate +{ +public: + DefaultValidation(void); + ~DefaultValidation(void) { }; + + /// Check a POI for tags. A node that is part of a way shouldn't have any + /// tags, this is to check actual POIs, like a school. + std::shared_ptr checkNode(const osmobjects::OsmNode &node, const std::string &type); + + /// This checks a way. A way should always have some tags. Often a polygon + /// is a building + std::shared_ptr checkWay(const osmobjects::OsmWay &way, const std::string &type); + + // Factory method + static std::shared_ptr create(void) { + return std::make_shared(); + }; +private: + std::map> tests; +}; + +BOOST_DLL_ALIAS(DefaultValidation::create, create_plugin) + +} // EOF defaultvalidation namespace + +#endif // EOF __DEFAULTVALIDATION_HH__ + +// Local Variables: +// mode: C++ +// indent-tabs-mode: nil +// End: diff --git a/src/validate/geospatial.cc b/src/validate/geospatial.cc index 1b2e43a9..79bbbaf2 100644 --- a/src/validate/geospatial.cc +++ b/src/validate/geospatial.cc @@ -20,22 +20,9 @@ #ifndef __GEOSPATIAL_H__ #define __GEOSPATIAL_H__ -#include -#include #include #include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include + #include #include @@ -57,45 +44,61 @@ namespace geospatial { LogFile &dbglogfile = LogFile::getDefaultInstance(); -Geospatial::Geospatial(void) {} - -// Check a POI for tags. A node that is part of a way shouldn't have any -// tags, this is to check actual POIs, like a school. -std::shared_ptr -Geospatial::checkPOI(const osmobjects::OsmNode &node, const std::string &type) -{ - auto status = std::make_shared(node); - return status; -} +Geospatial::Geospatial() {} // This checks a way. A way should always have some tags. Often a polygon // with no tags is a building. std::shared_ptr -Geospatial::checkWay(const osmobjects::OsmWay &way, const std::string &type) +Geospatial::checkWay(const osmobjects::OsmWay &way, const std::string &type, yaml::Yaml &tests, std::shared_ptr &status) { - auto status = std::make_shared(way); + // On non-english numeric locales using decimal separator different than '.' + // this is necessary to parse double strings with std::stod correctly + // without loosing precision + // std::setlocale(LC_NUMERIC, "C"); + setlocale(LC_NUMERIC, "C"); + + if (way.action == osmobjects::remove) { + return status; + } + + // These values are in the config section of the YAML file + auto config = tests.get("config"); + + // if (config.contains_value("overlaps", "yes")) { + // auto allWays = context.getOverlappingWays(); + // if (overlaps(allWays, way)) { + // status->status.insert(overlaping); + // } + // } + + // if (config.contains_value("duplicate", "yes")) { + // auto allWays = context.getOverlappingWays(); + // if (overlaps(allWays, way)) { + // status->status.insert(overlaping); + // } + // } + + if (unsquared(way.linestring)) { + status->status.insert(badgeom); + } + return status; } bool Geospatial::overlaps(const std::list> &allways, osmobjects::OsmWay &way) { - // This test only applies to buildings, as highways often overlap. - // TODO: move logic to a config file - yaml::Yaml tests = yamls["building"]; - if (tests.get("config").contains_value("overlaps", "yes")) { #ifdef TIMING_DEBUG_X - boost::timer::auto_cpu_timer timer("validate::overlaps: took %w seconds\n"); + boost::timer::auto_cpu_timer timer("validate::overlaps: took %w seconds\n"); #endif - if (way.numPoints() <= 1) { - return false; - } - for (auto nit = std::begin(allways); nit != std::end(allways); ++nit) { - osmobjects::OsmWay *oldway = nit->get(); - if (boost::geometry::overlaps(oldway->polygon, way.polygon)) { - if (way.getTagValue("layer") == oldway->getTagValue("layer") && way.id != oldway->id) { - log_error("Building %1% overlaps with %2%", way.id, oldway->id); - return true; - } + if (way.numPoints() <= 1) { + return false; + } + for (auto nit = std::begin(allways); nit != std::end(allways); ++nit) { + osmobjects::OsmWay *oldway = nit->get(); + if (boost::geometry::overlaps(oldway->polygon, way.polygon)) { + if (way.getTagValue("layer") == oldway->getTagValue("layer") && way.id != oldway->id) { + log_error("Building %1% overlaps with %2%", way.id, oldway->id); + return true; } } } @@ -106,29 +109,25 @@ bool Geospatial::duplicate(const std::list> &allways, osmobjects::OsmWay &way) { // This test only applies to buildings, as highways often overlap. // TODO: move logic to a config file - yaml::Yaml tests = yamls["building"]; - if (tests.get("config").contains_value("duplicate", "yes")) { #ifdef TIMING_DEBUG_X - boost::timer::auto_cpu_timer timer("validate::duplicate: took %w seconds\n"); + boost::timer::auto_cpu_timer timer("validate::duplicate: took %w seconds\n"); #endif - if (way.numPoints() <= 1) { - return false; - } - - for (auto nit = std::begin(allways); nit != std::end(allways); ++nit) { - osmobjects::OsmWay *oldway = nit->get(); - std::deque output; - bg::intersection(oldway->polygon, way.polygon, output); - double iarea = 0; - for (auto& p : output) - iarea += bg::area(p); - double wayarea = bg::area(way.polygon); - double iareapercent = (iarea * 100) / wayarea; - if (iareapercent >= 80) { - if (way.getTagValue("layer") == oldway->getTagValue("layer") && way.id != oldway->id) { - log_error("Building %1% duplicate %2%", way.id, oldway->id); - return true; - } + if (way.numPoints() <= 1) { + return false; + } + for (auto nit = std::begin(allways); nit != std::end(allways); ++nit) { + osmobjects::OsmWay *oldway = nit->get(); + std::deque output; + bg::intersection(oldway->polygon, way.polygon, output); + double iarea = 0; + for (auto& p : output) + iarea += bg::area(p); + double wayarea = bg::area(way.polygon); + double iareapercent = (iarea * 100) / wayarea; + if (iareapercent >= 80) { + if (way.getTagValue("layer") == oldway->getTagValue("layer") && way.id != oldway->id) { + log_error("Building %1% duplicate %2%", way.id, oldway->id); + return true; } } } @@ -142,6 +141,9 @@ Geospatial::unsquared( double max_angle ) { const int num_points = boost::geometry::num_points(way); + double last_angle = -1; + double max_angle_diff = 0; + bool unsquared = false; for(int i = 0; i < num_points - 1; i++) { // Three points int a,b,c; @@ -166,14 +168,24 @@ Geospatial::unsquared( double y3 = boost::geometry::get<1>(way[c]); double angle = geo::Geo::calculateAngle(x1,y1,x2,y2,x3,y3); + if (last_angle != -1) { + double diff = abs(angle - last_angle); + if (diff > max_angle_diff) { + max_angle_diff = diff; + } + } + last_angle = angle; if ( (angle > max_angle || angle < min_angle) && (angle < 179 || angle > 181) ) { - return true; + unsquared = true; } } + if (unsquared && !(num_points > 5 && max_angle_diff < 3)) { + return true; + } return false; }; diff --git a/src/validate/geospatial.hh b/src/validate/geospatial.hh index 58a7c4ad..daec1396 100644 --- a/src/validate/geospatial.hh +++ b/src/validate/geospatial.hh @@ -18,7 +18,7 @@ // /// \file geospatial.hh -/// \brief This file implements the data validation used by HOT +/// \brief Geospatial validation #ifndef __GEOSPATIAL_HH__ #define __GEOSPATIAL_HH__ @@ -28,61 +28,28 @@ # include "unconfig.h" #endif -#include -#include -#include #include -#include - -#include -#include -#include -#include -#include -#include -#include -using namespace boost::posix_time; -using namespace boost::gregorian; - -#include "utils/yaml.hh" - -// MinGW related workaround -#define BOOST_DLL_FORCE_ALIAS_INSTANTIATION - +#include "osm/osmobjects.hh" #include "validate.hh" +#include "utils/yaml.hh" /// \namespace geospatial namespace geospatial { /// \class Geospatial /// \brief This is the plugin class, deprived from the Validate class -class Geospatial : public Validate +class Geospatial { public: - Geospatial(void); + Geospatial(); ~Geospatial(void) { }; - - /// Check a POI for tags. A node that is part of a way shouldn't have any - /// tags, this is to check actual POIs, like a school. - std::shared_ptr checkPOI(const osmobjects::OsmNode &node, const std::string &type); - - /// This checks a way. A way should always have some tags. Often a polygon - /// is a building - std::shared_ptr checkWay(const osmobjects::OsmWay &way, const std::string &type); - - // Factory method - static std::shared_ptr create(void) { - return std::make_shared(); - }; + static std::shared_ptr checkWay(const osmobjects::OsmWay &way, const std::string &type, yaml::Yaml &tests, std::shared_ptr &status); private: - std::map> tests; - bool unsquared(const linestring_t &way, double min_angle = 89, double max_angle = 91); - bool duplicate(const std::list> &allways, osmobjects::OsmWay &way); - bool overlaps(const std::list> &allways, osmobjects::OsmWay &way); + static bool unsquared(const linestring_t &way, double min_angle = 89, double max_angle = 91); + static bool duplicate(const std::list> &allways, osmobjects::OsmWay &way); + static bool overlaps(const std::list> &allways, osmobjects::OsmWay &way); }; -BOOST_DLL_ALIAS(Geospatial::create, create_plugin) - } // EOF geospatial namespace #endif // EOF __GEOSPATIAL_HH__ diff --git a/src/validate/semantic.cc b/src/validate/semantic.cc index 057ac84e..1c06af4f 100644 --- a/src/validate/semantic.cc +++ b/src/validate/semantic.cc @@ -31,11 +31,8 @@ #include #include -#include #include #include -#include -#include #include #include @@ -57,7 +54,35 @@ namespace semantic { LogFile &dbglogfile = LogFile::getDefaultInstance(); -Semantic::Semantic(void) {} +Semantic::Semantic() {} + +// Check a tag for typical errors + +void +Semantic::checkTag(const std::string &key, const std::string &value, std::shared_ptr &status) +{ + // log_trace("Semantic::checkTag(%1%, %2%)", key, value); + // Check for an empty value + if (!key.empty() && value.empty()) { + log_debug("WARNING: empty value for tag \"%1%\"", key); + status->status.insert(badvalue); + } + // Check for a space in the tag key + if (key.find(' ') != std::string::npos) { + log_error("WARNING: spaces in tag key \"%1%\"", key); + status->status.insert(badvalue); + } + // Check for single quotes in the tag value + if (value.find('\'') != std::string::npos) { + log_error("WARNING: single quote in tag value \"%1%\"", value); + status->status.insert(badvalue); + } + // Check for single quotes in the tag value + if (value.find('\"') != std::string::npos) { + log_error("WARNING: double quote in tag value \"%1%\"", value); + status->status.insert(badvalue); + } +} bool Semantic::isValidTag(const std::string &key, const std::string &value, yaml::Node tags) { if (tags.contains_value(key, value) || @@ -79,16 +104,8 @@ bool Semantic::isRequiredTag(const std::string &key, yaml::Node required_tags) { // Check a POI for tags. A node that is part of a way shouldn't have any // tags, this is to check actual POIs, like a school. std::shared_ptr -Semantic::checkPOI(const osmobjects::OsmNode &node, const std::string &type) +Semantic::checkNode(const osmobjects::OsmNode &node, const std::string &type, yaml::Yaml &tests, std::shared_ptr &status) { - auto status = std::make_shared(node); - status->timestamp = boost::posix_time::microsec_clock::universal_time(); - status->uid = node.uid; - - if (yamls.size() == 0) { - log_error("No config files!"); - return status; - } if (node.tags.size() == 0) { status->status.insert(notags); return status; @@ -97,8 +114,6 @@ Semantic::checkPOI(const osmobjects::OsmNode &node, const std::string &type) return status; } - // Configuration for validation - yaml::Yaml tests = yamls[type]; // List of valid tags to be validated auto tags = tests.get("tags"); @@ -118,24 +133,19 @@ Semantic::checkPOI(const osmobjects::OsmNode &node, const std::string &type) if (isRequiredTag(vit->first, required_tags)) { tagexists++; } - checkTag(vit->first, vit->second); + checkTag(vit->first, vit->second, status); } - if (tagexists == required_tags.children.size()) { - status->status.insert(complete); - } else { + if (tagexists != required_tags.children.size()) { status->status.insert(incomplete); } - if (status->status.size() == 0) { - status->status.insert(correct); - } return status; } // This checks a way. A way should always have some tags. Often a polygon // with no tags is a building. std::shared_ptr -Semantic::checkWay(const osmobjects::OsmWay &way, const std::string &type) +Semantic::checkWay(const osmobjects::OsmWay &way, const std::string &type, yaml::Yaml &tests, std::shared_ptr &status) { // On non-english numeric locales using decimal separator different than '.' // this is necessary to parse double strings with std::stod correctly @@ -143,14 +153,6 @@ Semantic::checkWay(const osmobjects::OsmWay &way, const std::string &type) // std::setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C"); - auto status = std::make_shared(way); - status->timestamp = boost::posix_time::microsec_clock::universal_time(); - status->uid = way.uid; - - if (yamls.size() == 0) { - log_error("No config files!"); - return status; - } if (way.tags.size() == 0) { status->status.insert(notags); return status; @@ -159,8 +161,6 @@ Semantic::checkWay(const osmobjects::OsmWay &way, const std::string &type) return status; } - yaml::Yaml tests = yamls[type]; - std::string key; // List of valid tags to be validated auto tags = tests.get("tags"); @@ -178,83 +178,23 @@ Semantic::checkWay(const osmobjects::OsmWay &way, const std::string &type) int tagexists = 0; for (auto vit = std::begin(way.tags); vit != std::end(way.tags); ++vit) { - if (!isValidTag(vit->first, vit->second, tags)) { - status->status.insert(badvalue); - status->values.insert(vit->first + "=" + vit->second); - } - if (isRequiredTag(vit->first, required_tags)) { - tagexists++; - } - checkTag(vit->first, vit->second); + if (!isValidTag(vit->first, vit->second, tags)) { + status->status.insert(badvalue); + status->values.insert(vit->first + "=" + vit->second); + } + if (isRequiredTag(vit->first, required_tags)) { + tagexists++; + } + // checkTag(vit->first, vit->second, status); } - if (tagexists == required_tags.children.size()) { - status->status.insert(complete); - } else { + if (tagexists != required_tags.children.size()) { status->status.insert(incomplete); } return status; } -// Check a tag for typical errors -std::shared_ptr -Semantic::checkTag(const std::string &key, const std::string &value) -{ - auto status = std::make_shared(); - // log_trace("Semantic::checkTag(%1%, %2%)", key, value); - // Check for an empty value - if (!key.empty() && value.empty()) { - log_debug("WARNING: empty value for tag \"%1%\"", key); - status->status.insert(badvalue); - } - // Check for a space in the tag key - if (key.find(' ') != std::string::npos) { - log_error("WARNING: spaces in tag key \"%1%\"", key); - status->status.insert(badvalue); - } - // Check for single quotes in the tag value - if (value.find('\'') != std::string::npos) { - log_error("WARNING: single quote in tag value \"%1%\"", value); - status->status.insert(badvalue); - } - // Check for single quotes in the tag value - if (value.find('\"') != std::string::npos) { - log_error("WARNING: double quote in tag value \"%1%\"", value); - status->status.insert(badvalue); - } - return status; -} - -// Check a OSM Change for typical errors -std::vector -Semantic::checkOsmChange(const std::string &xml, const std::string &check) { - osmchange::OsmChangeFile ocf; - std::stringstream _xml(xml); - ocf.readXML(_xml); - std::vector result; - for (auto it = std::begin(ocf.changes); it != std::end(ocf.changes); ++it) { - osmchange::OsmChange *change = it->get(); - for (auto wit = std::begin(change->ways); wit != std::end(change->ways); ++wit) { - osmobjects::OsmWay *way = wit->get(); - if (!way->containsKey(check)) { - continue; - } - auto status = checkWay(*way, check); - result.push_back(*status); - } - for (auto nit = std::begin(change->nodes); nit != std::end(change->nodes); ++nit) { - osmobjects::OsmNode *node = nit->get(); - if (!node->containsKey(check)) { - continue; - } - auto status = checkPOI(*node, check); - result.push_back(*status); - } - } - return result; -} - }; // namespace semantic #endif // EOF __SEMANTIC_H__ diff --git a/src/validate/semantic.hh b/src/validate/semantic.hh index 6f62896c..14f93e11 100644 --- a/src/validate/semantic.hh +++ b/src/validate/semantic.hh @@ -35,20 +35,14 @@ #include #include -#include -#include #include #include #include -#include using namespace boost::posix_time; using namespace boost::gregorian; #include "utils/yaml.hh" -// MinGW related workaround -#define BOOST_DLL_FORCE_ALIAS_INSTANTIATION - #include "validate.hh" /// \namespace semantic @@ -56,38 +50,19 @@ namespace semantic { /// \class Semantic /// \brief This is the plugin class, deprived from the Validate class -class Semantic : public Validate +class Semantic { public: - Semantic(void); + Semantic(); ~Semantic(void) { }; - - /// Check a POI for tags. A node that is part of a way shouldn't have any - /// tags, this is to check actual POIs, like a school. - std::shared_ptr checkPOI(const osmobjects::OsmNode &node, const std::string &type); - - /// This checks a way. A way should always have some tags. Often a polygon - /// is a building - std::shared_ptr checkWay(const osmobjects::OsmWay &way, const std::string &type); - - /// Check a tag - std::shared_ptr checkTag(const std::string &key, const std::string &value); - - /// Check a set of changes - std::vector checkOsmChange(const std::string &xml, const std::string &check); - - // Factory method - static std::shared_ptr create(void) { - return std::make_shared(); - }; + static std::shared_ptr checkNode(const osmobjects::OsmNode &node, const std::string &type, yaml::Yaml &tests, std::shared_ptr &status); + static std::shared_ptr checkWay(const osmobjects::OsmWay &way, const std::string &type, yaml::Yaml &tests, std::shared_ptr &status); private: - std::map> tests; - bool isValidTag(const std::string &key, const std::string &value, yaml::Node tags); - bool isRequiredTag(const std::string &key, yaml::Node required_tags); + static bool isValidTag(const std::string &key, const std::string &value, yaml::Node tags); + static bool isRequiredTag(const std::string &key, yaml::Node required_tags); + static void checkTag(const std::string &key, const std::string &value, std::shared_ptr &status); }; -BOOST_DLL_ALIAS(Semantic::create, create_plugin) - } // EOF semantic namespace #endif // EOF __SEMANTIC_HH__ diff --git a/src/validate/validate.hh b/src/validate/validate.hh index 5d5cdf12..6f96b674 100644 --- a/src/validate/validate.hh +++ b/src/validate/validate.hh @@ -183,7 +183,7 @@ class BOOST_SYMBOL_VISIBLE Validate { for (auto &file: std::filesystem::recursive_directory_iterator(path)) { std::filesystem::path config = file.path(); if (config.extension() == ".yaml") { - log_debug("Loading: %s", config.stem()); + std::cout << "Loading: " << config.stem() << std::endl; yaml::Yaml yaml; yaml.read(config.string()); if (!config.stem().empty()) { @@ -196,25 +196,8 @@ class BOOST_SYMBOL_VISIBLE Validate { virtual ~Validate(void){}; // Validate(std::vector> &changes) {}; - /// Check a POI for tags. A node that is part of a way shouldn't have any - /// tags, this is to check actual POIs, like a school. - virtual std::shared_ptr checkGeometry(const osmobjects::OsmNode &node, const std::string &type) = 0; - /// This checks a way. A way should always have some tags. Often a polygon - /// is a building - virtual std::shared_ptr checkGeometry(const osmobjects::OsmWay &way, const std::string &type) = 0; - - virtual std::shared_ptr checkSemantic(const osmobjects::OsmWay &way, const std::string &type) = 0; - virtual std::shared_ptr checkSemantic(const osmobjects::OsmWay &node, const std::string &type) = 0; - - std::shared_ptr checkNode(const osmobjects::OsmWay &node, const std::string &type) { - auto status = std::make_shared(node); - auto geometryStatus = checkGeometry(node, type); - auto semanticStatus = checkSemantic(node, type); - } - std::shared_ptr checkWay(const osmobjects::OsmWay &way, const std::string &type) { - // checkGeometry - // checkSemantic - } + virtual std::shared_ptr checkNode(const osmobjects::OsmNode &node, const std::string &type) = 0; + virtual std::shared_ptr checkWay(const osmobjects::OsmWay &way, const std::string &type) = 0; yaml::Yaml &operator[](const std::string &key) { return yamls[key]; }; diff --git a/src/wrappers/python.cc b/src/wrappers/python.cc index 83ac89ad..c3b0efbb 100644 --- a/src/wrappers/python.cc +++ b/src/wrappers/python.cc @@ -25,7 +25,7 @@ #define BOOST_BIND_GLOBAL_PLACEHOLDERS 1 #include -#include "validate/hotosm.hh" +// #include "validate/defaultvalidation.hh" #include "validate/validate.hh" #include "osm/osmobjects.hh" #include "osm/osmchange.hh" @@ -51,19 +51,19 @@ std::map results = { {duplicate, "duplicate"} }; -ValidateStatus* checkPOI(hotosm::Hotosm& self, const osmobjects::OsmNode &node, const std::string &type) { - auto _v = self.checkPOI(node, type); - ValidateStatus* v = new ValidateStatus(); - v->status = _v->status; - return v; -} +// ValidateStatus* checkNode(defaultvalidation::DefaultValidation& self, const osmobjects::OsmNode &node, const std::string &type) { +// // auto _v = self.checkNode(node, type); +// ValidateStatus* v = new ValidateStatus(); +// // v->status = _v->status; +// return v; +// } -ValidateStatus* checkWay(hotosm::Hotosm& self, const osmobjects::OsmWay &way, const std::string &type) { - auto _v = self.checkWay(way, type); - ValidateStatus* v = new ValidateStatus(); - v->status = _v->status; - return v; -} +// ValidateStatus* checkWay(defaultvalidation::DefaultValidation& self, const osmobjects::OsmWay &way, const std::string &type) { +// // auto _v = self.checkWay(way, type); +// ValidateStatus* v = new ValidateStatus(); +// // v->status = _v->status; +// return v; +// } std::string dumpJSON(ValidateStatus& self) { std::string output = ""; @@ -93,29 +93,29 @@ std::string dumpJSON(ValidateStatus& self) { return output; } -std::string checkOsmChange(hotosm::Hotosm& self, const std::string &xml, const std::string &check) { - auto result = self.checkOsmChange(xml, check); - std::string output = "[ "; - for (auto it = std::begin(result); it != std::end(result); ++it) { - if ((*it).status.size() > 0) { - output += dumpJSON(*it) + ","; - } - } - output.erase(output.size() - 1); - output += " ]"; - return output; -} +// std::string checkOsmChange(defaultvalidation::DefaultValidation& self, const std::string &xml, const std::string &check) { +// auto result = self.checkOsmChange(xml, check); +// std::string output = "[ "; +// for (auto it = std::begin(result); it != std::end(result); ++it) { +// if ((*it).status.size() > 0) { +// output += dumpJSON(*it) + ","; +// } +// } +// output.erase(output.size() - 1); +// output += " ]"; +// return output; +// } BOOST_PYTHON_MODULE(underpass) { // - using namespace hotosm; - class_("Validate") - .def("checkTag", &Hotosm::checkTag) - .def("checkWay", &checkWay, boost::python::return_value_policy()) - .def("checkPOI", &checkPOI, boost::python::return_value_policy()) - .def("overlaps", &Hotosm::overlaps) - .def("checkOsmChange", &checkOsmChange); + // using namespace defaultvalidation; + // class_("Validate") + // // .def("checkTag", &DefaultValidation::checkTag) + // .def("checkWay", &checkWay, boost::python::return_value_policy()) + // .def("checkNode", &checkNode, boost::python::return_value_policy()); + // // .def("overlaps", &DefaultValidation::overlaps); + // // .def("checkOsmChange", &checkOsmChange); class_("ValidateStatus") .def("hasStatus", &ValidateStatus::hasStatus)