Merge branch 'alex85k-win-038' into develop
This commit is contained in:
		
						commit
						8d89d30c74
					
				@ -16,6 +16,11 @@ else()
 | 
			
		||||
  message(WARNING "Building on a 32 bit system is unsupported")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if (WIN32 AND MSVC_VERSION LESS 1800)
 | 
			
		||||
  message(FATAL_ERROR "Building with Microsoft compiler needs Visual Studio 2013 or later (Express version works too)")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTION(WITH_TOOLS "Build ORSM tools" OFF)
 | 
			
		||||
 | 
			
		||||
include_directories(${CMAKE_SOURCE_DIR}/Include/)
 | 
			
		||||
@ -115,6 +120,11 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
 | 
			
		||||
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-intel -wd10237 -Wall -ipo -fPIC")
 | 
			
		||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
 | 
			
		||||
  # using Visual Studio C++
 | 
			
		||||
  set(BOOST_COMPONENTS ${BOOST_COMPONENTS} date_time chrono zlib)
 | 
			
		||||
  add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 | 
			
		||||
  add_definitions(-DNOMINMAX) # avoid min and max macros that can break compilation
 | 
			
		||||
  add_definitions(-D_USE_MATH_DEFINES) # define M_PI
 | 
			
		||||
  add_definitions(-D_WIN32_WINNT=0x0501)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# disable partitioning of LTO process when possible (fixes Debian issues)
 | 
			
		||||
@ -130,7 +140,9 @@ set(CMAKE_EXE_LINKER_FLAGS    "${CMAKE_EXE_LINKER_FLAGS}    ${LTO_FLAGS} ${LTO_P
 | 
			
		||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LTO_FLAGS} ${LTO_PARTITION_FLAGS}")
 | 
			
		||||
 | 
			
		||||
# Activate C++11
 | 
			
		||||
ADD_DEFINITIONS(-std=c++11)
 | 
			
		||||
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
 | 
			
		||||
  ADD_DEFINITIONS(-std=c++11)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Configuring other platform dependencies
 | 
			
		||||
if(APPLE)
 | 
			
		||||
@ -172,6 +184,10 @@ target_link_libraries(osrm-datastore ${CMAKE_THREAD_LIBS_INIT})
 | 
			
		||||
target_link_libraries(OSRM ${CMAKE_THREAD_LIBS_INIT})
 | 
			
		||||
 | 
			
		||||
find_package(TBB REQUIRED)
 | 
			
		||||
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
 | 
			
		||||
  set(TBB_LIBRARIES ${TBB_DEBUG_LIBRARIES})
 | 
			
		||||
endif()
 | 
			
		||||
target_link_libraries(osrm-datastore ${TBB_LIBRARIES})
 | 
			
		||||
target_link_libraries(osrm-extract ${TBB_LIBRARIES})
 | 
			
		||||
target_link_libraries(osrm-prepare ${TBB_LIBRARIES})
 | 
			
		||||
target_link_libraries(osrm-routed ${TBB_LIBRARIES})
 | 
			
		||||
 | 
			
		||||
@ -34,7 +34,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
#include <boost/filesystem.hpp>
 | 
			
		||||
#include <boost/filesystem/fstream.hpp>
 | 
			
		||||
#include <boost/interprocess/mapped_region.hpp>
 | 
			
		||||
#ifndef WIN32
 | 
			
		||||
#include <boost/interprocess/xsi_shared_memory.hpp>
 | 
			
		||||
#else
 | 
			
		||||
#include <boost/interprocess/shared_memory_object.hpp>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __linux__
 | 
			
		||||
#include <sys/ipc.h>
 | 
			
		||||
@ -57,6 +61,7 @@ struct OSRMLockFile
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#ifndef WIN32
 | 
			
		||||
class SharedMemory
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -189,6 +194,144 @@ class SharedMemory
 | 
			
		||||
    boost::interprocess::mapped_region region;
 | 
			
		||||
    shm_remove remover;
 | 
			
		||||
};
 | 
			
		||||
#else
 | 
			
		||||
// Windows - specific code
 | 
			
		||||
class SharedMemory : boost::noncopyable
 | 
			
		||||
{
 | 
			
		||||
    //Remove shared memory on destruction
 | 
			
		||||
    class shm_remove : boost::noncopyable
 | 
			
		||||
    {
 | 
			
		||||
      private:
 | 
			
		||||
        char* m_shmid;
 | 
			
		||||
        bool m_initialized;
 | 
			
		||||
      public:
 | 
			
		||||
        void SetID(char* shmid) 
 | 
			
		||||
        {
 | 
			
		||||
            m_shmid  = shmid;
 | 
			
		||||
            m_initialized = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        shm_remove() : m_shmid("undefined"), m_initialized(false) {}
 | 
			
		||||
 | 
			
		||||
        ~shm_remove()
 | 
			
		||||
        {
 | 
			
		||||
            if(m_initialized)
 | 
			
		||||
            {
 | 
			
		||||
                SimpleLogger().Write(logDEBUG) <<
 | 
			
		||||
                    "automatic memory deallocation";
 | 
			
		||||
                if(!boost::interprocess::shared_memory_object::remove(m_shmid))
 | 
			
		||||
                {
 | 
			
		||||
                    SimpleLogger().Write(logDEBUG) << "could not deallocate id " << m_shmid;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  public:
 | 
			
		||||
    void * Ptr() const 
 | 
			
		||||
    {
 | 
			
		||||
        return region.get_address();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    SharedMemory(
 | 
			
		||||
        const boost::filesystem::path & lock_file,
 | 
			
		||||
        const int id,
 | 
			
		||||
        const uint64_t size = 0,
 | 
			
		||||
        bool read_write = false,
 | 
			
		||||
        bool remove_prev = true)  
 | 
			
		||||
    {
 | 
			
		||||
        sprintf(key,"%s.%d","osrm.lock", id);
 | 
			
		||||
        if( 0 == size )
 | 
			
		||||
        { //read_only
 | 
			
		||||
            shm = boost::interprocess::shared_memory_object(
 | 
			
		||||
                boost::interprocess::open_only,
 | 
			
		||||
                key,
 | 
			
		||||
                read_write ? boost::interprocess::read_write : boost::interprocess::read_only);
 | 
			
		||||
            region = boost::interprocess::mapped_region (
 | 
			
		||||
                shm, read_write ? boost::interprocess::read_write : boost::interprocess::read_only);
 | 
			
		||||
        } else 
 | 
			
		||||
        { //writeable pointer
 | 
			
		||||
            //remove previously allocated mem
 | 
			
		||||
            if( remove_prev ) 
 | 
			
		||||
            {
 | 
			
		||||
                Remove(key);
 | 
			
		||||
            }
 | 
			
		||||
            shm = boost::interprocess::shared_memory_object (
 | 
			
		||||
                boost::interprocess::open_or_create, key, boost::interprocess::read_write);
 | 
			
		||||
            shm.truncate(size);
 | 
			
		||||
            region = boost::interprocess::mapped_region( shm, boost::interprocess::read_write);
 | 
			
		||||
 | 
			
		||||
            remover.SetID( key );
 | 
			
		||||
            SimpleLogger().Write(logDEBUG) <<
 | 
			
		||||
                "writeable memory allocated " << size << " bytes";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    static bool RegionExists(const int id)
 | 
			
		||||
    {
 | 
			
		||||
        bool result = true;
 | 
			
		||||
        try 
 | 
			
		||||
        {
 | 
			
		||||
            char k[500];
 | 
			
		||||
            build_key(id, k);
 | 
			
		||||
            result = RegionExists(k);
 | 
			
		||||
        } catch(...) 
 | 
			
		||||
        {
 | 
			
		||||
            result = false;
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    static bool Remove(const int id)
 | 
			
		||||
    {
 | 
			
		||||
        char k[500];
 | 
			
		||||
        build_key(id, k);
 | 
			
		||||
        return Remove(k);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
    static void build_key(int id, char* key) 
 | 
			
		||||
    {
 | 
			
		||||
        OSRMLockFile lock_file;
 | 
			
		||||
        sprintf(key,"%s.%d","osrm.lock", id);
 | 
			
		||||
    }
 | 
			
		||||
    static bool RegionExists(const char* key) 
 | 
			
		||||
    {
 | 
			
		||||
        bool result = true;
 | 
			
		||||
        try 
 | 
			
		||||
        {
 | 
			
		||||
            boost::interprocess::shared_memory_object shm(
 | 
			
		||||
                boost::interprocess::open_only, key, boost::interprocess::read_write);
 | 
			
		||||
        } catch(...) 
 | 
			
		||||
        {
 | 
			
		||||
            result = false;
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    static bool Remove(char* key) 
 | 
			
		||||
    {
 | 
			
		||||
        bool ret = false;
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            SimpleLogger().Write(logDEBUG) << "deallocating prev memory";
 | 
			
		||||
            ret = boost::interprocess::shared_memory_object::remove(key);
 | 
			
		||||
        } catch(const boost::interprocess::interprocess_exception &e)
 | 
			
		||||
        {
 | 
			
		||||
            if(e.get_error_code() != boost::interprocess::not_found_error) 
 | 
			
		||||
            {
 | 
			
		||||
                throw;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return ret;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    char key[500];
 | 
			
		||||
    boost::interprocess::shared_memory_object shm;
 | 
			
		||||
    boost::interprocess::mapped_region region;
 | 
			
		||||
    shm_remove remover;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
template <class LockFileT = OSRMLockFile> class SharedMemoryFactory_tmpl
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
 | 
			
		||||
class ExtractionContainers
 | 
			
		||||
{
 | 
			
		||||
#ifndef _MSC_VER
 | 
			
		||||
    constexpr static unsigned stxxl_memory = ((sizeof(std::size_t) == 4) ? std::numeric_limits<int>::max() : std::numeric_limits<unsigned>::max());
 | 
			
		||||
#else
 | 
			
		||||
    const static unsigned stxxl_memory = ((sizeof(std::size_t) == 4) ? INT_MAX : UINT_MAX);
 | 
			
		||||
#endif
 | 
			
		||||
  public:
 | 
			
		||||
    typedef stxxl::vector<NodeID> STXXLNodeIDVector;
 | 
			
		||||
    typedef stxxl::vector<ExternalMemoryNode> STXXLNodeVector;
 | 
			
		||||
 | 
			
		||||
@ -79,6 +79,11 @@ int main(int argc, char *argv[])
 | 
			
		||||
    SimpleLogger().Write() << "Not supported on FreeBSD";
 | 
			
		||||
    return 0;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
    SimpleLogger().Write() << "Not supported on Windows";
 | 
			
		||||
    return 0;
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if (1 == argc)
 | 
			
		||||
    {
 | 
			
		||||
@ -339,4 +344,5 @@ int main(int argc, char *argv[])
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
    return 0;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -50,13 +50,13 @@ FingerPrint::FingerPrint() : magic_number(1297240911)
 | 
			
		||||
    std::string temp_string(__DATE__);
 | 
			
		||||
    temp_string += __TIME__;
 | 
			
		||||
 | 
			
		||||
    std::copy(MD5PREPARE, MD5PREPARE + strlen(MD5PREPARE), md5_prepare);
 | 
			
		||||
    std::memcpy(md5_prepare, MD5PREPARE, strlen(MD5PREPARE));
 | 
			
		||||
    temp_string += md5_prepare;
 | 
			
		||||
    std::copy(MD5RTREE, MD5RTREE + 32, md5_tree);
 | 
			
		||||
    std::memcpy(md5_tree, MD5RTREE, 32);
 | 
			
		||||
    temp_string += md5_tree;
 | 
			
		||||
    std::copy(MD5GRAPH, MD5GRAPH + 32, md5_graph);
 | 
			
		||||
    std::memcpy(md5_graph, MD5GRAPH, 32);
 | 
			
		||||
    temp_string += md5_graph;
 | 
			
		||||
    std::copy(MD5OBJECTS, MD5OBJECTS + 32, md5_objects);
 | 
			
		||||
    std::memcpy(md5_objects, MD5OBJECTS, 32);
 | 
			
		||||
    temp_string += md5_objects;
 | 
			
		||||
 | 
			
		||||
    named_uuid = gen(temp_string);
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
#include <boost/assert.hpp>
 | 
			
		||||
 | 
			
		||||
#include <cstdio>
 | 
			
		||||
 | 
			
		||||
#ifdef _MSC_VER
 | 
			
		||||
#include <io.h>
 | 
			
		||||
#define isatty _isatty
 | 
			
		||||
#define fileno _fileno
 | 
			
		||||
#else
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <ostream>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
#ifndef TRIGONOMETRY_TABLES_H
 | 
			
		||||
#define TRIGONOMETRY_TABLES_H
 | 
			
		||||
 | 
			
		||||
#include "../typedefs.h"
 | 
			
		||||
#include <cmath>
 | 
			
		||||
 | 
			
		||||
#include <limits>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										61
									
								
								appveyor.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								appveyor.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,61 @@
 | 
			
		||||
environment:
 | 
			
		||||
  matrix:
 | 
			
		||||
  - configuration: Debug
 | 
			
		||||
  - configuration: Release
 | 
			
		||||
 | 
			
		||||
# branches to build
 | 
			
		||||
branches:
 | 
			
		||||
  # whitelist
 | 
			
		||||
  only:
 | 
			
		||||
    - win-038
 | 
			
		||||
#   - develop
 | 
			
		||||
#TODO: replace with develop branch when merged
 | 
			
		||||
 | 
			
		||||
# Operating system (build VM template)
 | 
			
		||||
os: Windows Server 2012 R2
 | 
			
		||||
 | 
			
		||||
# scripts that are called at very beginning, before repo cloning
 | 
			
		||||
init:
 | 
			
		||||
  - git config --global core.autocrlf input
 | 
			
		||||
 | 
			
		||||
# clone directory
 | 
			
		||||
clone_folder: c:\projects\osrm
 | 
			
		||||
 | 
			
		||||
platform: x64
 | 
			
		||||
 | 
			
		||||
install:
 | 
			
		||||
  # by default, all script lines are interpreted as batch
 | 
			
		||||
  - cd c:\projects\osrm
 | 
			
		||||
  - curl -O http://build.project-osrm.org/libs_osrm_%Configuration%.7z
 | 
			
		||||
  - 7z x libs_osrm_%Configuration%.7z | find ":"
 | 
			
		||||
 | 
			
		||||
build_script:
 | 
			
		||||
  - cd c:/projects/osrm
 | 
			
		||||
  - mkdir build
 | 
			
		||||
  - cd build
 | 
			
		||||
  - echo Running cmake...
 | 
			
		||||
  - call "%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
 | 
			
		||||
  - SET P=c:/projects/osrm
 | 
			
		||||
  - set TBB_INSTALL_DIR=%P%/tbb
 | 
			
		||||
  - set TBB_ARCH_PLATFORM=intel64/vc12
 | 
			
		||||
  - cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%Configuration% -DBZIP2_INCLUDE_DIR=%P%/libs/include -DBZIP2_LIBRARIES=%P%/libs/lib/libbz2.lib -DCMAKE_INSTALL_PREFIX=%P%/libs -DBOOST_ROOT=%P%/boost_min -DBoost_USE_STATIC_LIBS=ON
 | 
			
		||||
  - nmake
 | 
			
		||||
  - 7z a %P%/osrm_%Configuration%.zip *.exe *.pdb %P%/libs/bin/*.dll -tzip
 | 
			
		||||
 | 
			
		||||
test: off
 | 
			
		||||
 | 
			
		||||
artifacts:
 | 
			
		||||
  - path: osrm_Debug.zip
 | 
			
		||||
    name: osrm_Debug.zip
 | 
			
		||||
  - path: osrm_Release.zip
 | 
			
		||||
    name: osrm_Release.zip
 | 
			
		||||
 | 
			
		||||
#deploy:
 | 
			
		||||
#  provider: FTP
 | 
			
		||||
#  server: ftp.mample.com
 | 
			
		||||
#  username: user
 | 
			
		||||
#  password:
 | 
			
		||||
#    secure: XMdn4xfPcYlZFYgvbytc8Q==
 | 
			
		||||
#  folder: osrm
 | 
			
		||||
#  enable_ssl: true|false (disabled by default)
 | 
			
		||||
#  artifact: /.*\.zip/
 | 
			
		||||
@ -217,7 +217,7 @@ def convert_osm_to_pbf
 | 
			
		||||
  unless File.exist?("#{@osm_file}.osm.pbf")
 | 
			
		||||
    log_preprocess_info
 | 
			
		||||
    log "== Converting #{@osm_file}.osm to protobuffer format...", :preprocess
 | 
			
		||||
    unless system "osmosis --read-xml #{@osm_file}.osm --write-pbf #{@osm_file}.osm.pbf omitmetadata=true 1>>#{PREPROCESS_LOG_FILE} 2>>#{PREPROCESS_LOG_FILE}"
 | 
			
		||||
    unless system "osmosis --read-xml #{@osm_file}.osm --write-pbf #{@osm_file}.osm.pbf omitmetadata=true >>#{PREPROCESS_LOG_FILE} 2>&1"
 | 
			
		||||
      raise OsmosisError.new $?, "osmosis exited with code #{$?.exitstatus}"
 | 
			
		||||
    end
 | 
			
		||||
    log '', :preprocess
 | 
			
		||||
@ -253,7 +253,7 @@ def extract_data
 | 
			
		||||
  Dir.chdir TEST_FOLDER do
 | 
			
		||||
    log_preprocess_info
 | 
			
		||||
    log "== Extracting #{@osm_file}.osm...", :preprocess
 | 
			
		||||
    unless system "#{BIN_PATH}/osrm-extract #{@osm_file}.osm#{'.pbf' if pbf?} --profile #{PROFILES_PATH}/#{@profile}.lua 1>>#{PREPROCESS_LOG_FILE} 2>>#{PREPROCESS_LOG_FILE}"
 | 
			
		||||
    unless system "#{BIN_PATH}/osrm-extract #{@osm_file}.osm#{'.pbf' if pbf?} --profile #{PROFILES_PATH}/#{@profile}.lua >>#{PREPROCESS_LOG_FILE} 2>&1"
 | 
			
		||||
      log "*** Exited with code #{$?.exitstatus}.", :preprocess
 | 
			
		||||
      raise ExtractError.new $?.exitstatus, "osrm-extract exited with code #{$?.exitstatus}."
 | 
			
		||||
    end
 | 
			
		||||
@ -265,7 +265,7 @@ def prepare_data
 | 
			
		||||
  Dir.chdir TEST_FOLDER do
 | 
			
		||||
    log_preprocess_info
 | 
			
		||||
    log "== Preparing #{@osm_file}.osm...", :preprocess
 | 
			
		||||
    unless system "#{BIN_PATH}/osrm-prepare #{@osm_file}.osrm  --profile #{PROFILES_PATH}/#{@profile}.lua 1>>#{PREPROCESS_LOG_FILE} 2>>#{PREPROCESS_LOG_FILE}"
 | 
			
		||||
    unless system "#{BIN_PATH}/osrm-prepare #{@osm_file}.osrm  --profile #{PROFILES_PATH}/#{@profile}.lua >>#{PREPROCESS_LOG_FILE} 2>&1"
 | 
			
		||||
      log "*** Exited with code #{$?.exitstatus}.", :preprocess
 | 
			
		||||
      raise PrepareError.new $?.exitstatus, "osrm-prepare exited with code #{$?.exitstatus}."
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@ -44,6 +44,13 @@ unless File.exists? TEST_FOLDER
 | 
			
		||||
  raise "*** Test folder #{TEST_FOLDER} doesn't exist."
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
if ENV['OS']=~/Windows.*/ then
 | 
			
		||||
   EXE='.exe'
 | 
			
		||||
   QQ='"'
 | 
			
		||||
else
 | 
			
		||||
   EXE=''
 | 
			
		||||
   QQ=''
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
AfterConfiguration do |config|
 | 
			
		||||
  clear_log_files
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ def hash_of_files paths
 | 
			
		||||
  paths = [paths] unless paths.is_a? Array
 | 
			
		||||
  hash = Digest::SHA1.new
 | 
			
		||||
  for path in paths do
 | 
			
		||||
    open(path,'r') do |io|
 | 
			
		||||
    open(path,'rb') do |io|
 | 
			
		||||
      while !io.eof
 | 
			
		||||
        buf = io.readpartial 1024
 | 
			
		||||
        hash.update buf
 | 
			
		||||
@ -32,15 +32,15 @@ def lua_lib_hash
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def bin_extract_hash
 | 
			
		||||
  bin_extract_hash ||= hash_of_files "#{BIN_PATH}/osrm-extract"
 | 
			
		||||
  bin_extract_hash ||= hash_of_files "#{BIN_PATH}/osrm-extract#{EXE}"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def bin_prepare_hash
 | 
			
		||||
  bin_prepare_hash ||= hash_of_files "#{BIN_PATH}/osrm-prepare"
 | 
			
		||||
  bin_prepare_hash ||= hash_of_files "#{BIN_PATH}/osrm-prepare#{EXE}"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def bin_routed_hash
 | 
			
		||||
  bin_routed_hash ||= hash_of_files "#{BIN_PATH}/osrm-routed"
 | 
			
		||||
  bin_routed_hash ||= hash_of_files "#{BIN_PATH}/osrm-routed#{EXE}"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
#combine state of data, profile and binaries into a hash that identifies the exact test scenario
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,12 @@
 | 
			
		||||
require 'socket'
 | 
			
		||||
require 'open3'
 | 
			
		||||
 | 
			
		||||
if ENV['OS']==/Windows.*/ then
 | 
			
		||||
  TERMSIGNAL='TERM'
 | 
			
		||||
else
 | 
			
		||||
  TERMSIGNAL=9
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
OSRM_ROUTED_LOG_FILE = 'osrm-routed.log'
 | 
			
		||||
 | 
			
		||||
class OSRMBackgroundLauncher
 | 
			
		||||
@ -39,9 +45,15 @@ class OSRMBackgroundLauncher
 | 
			
		||||
 | 
			
		||||
  def osrm_up?
 | 
			
		||||
    if @pid
 | 
			
		||||
      `ps -o state -p #{@pid}`.split[1].to_s =~ /^[DRST]/
 | 
			
		||||
    else
 | 
			
		||||
      false
 | 
			
		||||
      begin
 | 
			
		||||
        if Process.waitpid(@pid, Process::WNOHANG) then
 | 
			
		||||
           false
 | 
			
		||||
        else
 | 
			
		||||
           true
 | 
			
		||||
        end
 | 
			
		||||
      rescue Errno::ESRCH, Errno::ECHILD
 | 
			
		||||
        false
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -53,7 +65,7 @@ class OSRMBackgroundLauncher
 | 
			
		||||
 | 
			
		||||
  def osrm_down
 | 
			
		||||
    if @pid
 | 
			
		||||
      Process.kill 'TERM', @pid
 | 
			
		||||
      Process.kill TERMSIGNAL, @pid
 | 
			
		||||
      wait_for_shutdown
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
@ -67,7 +79,7 @@ class OSRMBackgroundLauncher
 | 
			
		||||
  def wait_for_connection
 | 
			
		||||
    while true
 | 
			
		||||
      begin
 | 
			
		||||
        socket = TCPSocket.new('localhost', OSRM_PORT)
 | 
			
		||||
        socket = TCPSocket.new('127.0.0.1', OSRM_PORT)
 | 
			
		||||
        return
 | 
			
		||||
      rescue Errno::ECONNREFUSED
 | 
			
		||||
        sleep 0.1
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
require 'net/http'
 | 
			
		||||
 | 
			
		||||
HOST = "http://localhost:#{OSRM_PORT}"
 | 
			
		||||
HOST = "http://127.0.0.1:#{OSRM_PORT}"
 | 
			
		||||
DESTINATION_REACHED = 15      #OSRM instruction code
 | 
			
		||||
 | 
			
		||||
class Hash
 | 
			
		||||
 | 
			
		||||
@ -10,8 +10,8 @@ def run_bin bin, options
 | 
			
		||||
    if opt.include? '{profile}'
 | 
			
		||||
      opt.gsub! "{profile}", "#{PROFILES_PATH}/#{@profile}.lua" 
 | 
			
		||||
    end
 | 
			
		||||
        
 | 
			
		||||
    @stdout = `#{BIN_PATH}/#{bin} #{opt} 2>error.log`
 | 
			
		||||
 | 
			
		||||
    @stdout = `#{QQ}#{BIN_PATH}/#{bin}#{EXE}#{QQ} #{opt} 2>error.log`
 | 
			
		||||
    @stderr = File.read 'error.log'
 | 
			
		||||
    @exit_code = $?.exitstatus
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@ -261,8 +261,12 @@ int main(int argc, char *argv[])
 | 
			
		||||
 | 
			
		||||
        speed_profile.has_turn_penalty_function = lua_function_exists(lua_state, "turn_function");
 | 
			
		||||
 | 
			
		||||
        #ifdef WIN32
 | 
			
		||||
        #pragma message ("Memory consumption on Windows can be higher due to memory alignment")
 | 
			
		||||
        #else
 | 
			
		||||
        static_assert(sizeof(ImportEdge) == 20,
 | 
			
		||||
                      "changing ImportEdge type has influence on memory consumption!");
 | 
			
		||||
        #endif
 | 
			
		||||
        std::vector<ImportEdge> edge_list;
 | 
			
		||||
        NodeID number_of_node_based_nodes =
 | 
			
		||||
            readBinaryOSRMGraphFromStream(in,
 | 
			
		||||
@ -314,8 +318,10 @@ int main(int argc, char *argv[])
 | 
			
		||||
        unsigned number_of_edge_based_nodes = edge_based_graph_factor->GetNumberOfEdgeBasedNodes();
 | 
			
		||||
        BOOST_ASSERT(number_of_edge_based_nodes != std::numeric_limits<unsigned>::max());
 | 
			
		||||
        DeallocatingVector<EdgeBasedEdge> edgeBasedEdgeList;
 | 
			
		||||
        #ifndef WIN32
 | 
			
		||||
        static_assert(sizeof(EdgeBasedEdge) == 16,
 | 
			
		||||
                      "changing ImportEdge type has influence on memory consumption!");
 | 
			
		||||
        #endif
 | 
			
		||||
 | 
			
		||||
        edge_based_graph_factor->GetEdgeBasedEdges(edgeBasedEdgeList);
 | 
			
		||||
        std::vector<EdgeBasedNode> node_based_edge_list;
 | 
			
		||||
 | 
			
		||||
@ -142,7 +142,7 @@ int main(int argc, const char *argv[])
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            std::packaged_task<void()> server_task(std::bind(&Server::Run, routing_server));
 | 
			
		||||
            std::packaged_task<int()> server_task([&]()->int{ routing_server->Run(); return 0; });
 | 
			
		||||
            auto future = server_task.get_future();
 | 
			
		||||
            std::thread server_thread(std::move(server_task));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -35,8 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
#ifndef M_PI
 | 
			
		||||
#define M_PI 3.14159265358979323846
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
template <typename digitT> digitT round(digitT x) { return std::floor(x + 0.5); }
 | 
			
		||||
#define constexpr const static
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef unsigned int NodeID;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user