Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLD shortest direct path search #3788

Merged
merged 16 commits into from
Mar 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cucumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module.exports = {
default: '--strict --tags ~@stress --tags ~@todo --require features/support --require features/step_definitions',
verify: '--strict --tags ~@stress --tags ~@todo -f progress --require features/support --require features/step_definitions',
todo: '--strict --tags @todo --require features/support --require features/step_definitions',
all: '--strict --require features/support --require features/step_definitions'
all: '--strict --require features/support --require features/step_definitions',
mld: '--strict --tags ~@stress --tags ~@todo --tags ~@match --tags ~@alternative --tags ~@matrix --tags ~@trip --tags ~@via --require features/support --require features/step_definitions -f progress'
}



2 changes: 1 addition & 1 deletion features/car/summaries.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: Basic Routing
Given the profile "car"
Given a grid size of 500 meters

@smallest
@smallest @via
Scenario: Summaries when routing on a simple network
Given the node map
"""
Expand Down
6 changes: 4 additions & 2 deletions features/car/traffic_turn_penalties.feature
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Feature: Traffic - turn penalties
# hkl left turn
# ade left turn
And the contract extra arguments "--turn-penalty-file {penalties_file}"
And the customize extra arguments "--turn-penalty-file {penalties_file}"
When I route I should get
| from | to | route | speed | weight | time |
| a | h | ad,dhk | 65 km/h | 11 | 11s +-1 |
Expand All @@ -109,8 +110,9 @@ Feature: Traffic - turn penalties
# double left - hdc penalty ever so slightly higher than imn; forces all the way around

Scenario: Too-negative penalty clamps, but does not fail
Given the contract extra arguments "--turn-penalty-file {penalties_file}"
And the profile "testbot"
Given the profile "testbot"
And the contract extra arguments "--turn-penalty-file {penalties_file}"
And the customize extra arguments "--turn-penalty-file {penalties_file}"
And the turn penalty file
"""
1,4,5,-10
Expand Down
1 change: 1 addition & 0 deletions features/car/weight.feature
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Feature: Car - weights
| ec | service | yes |
And the extract extra arguments "--generate-edge-lookup"
And the contract extra arguments "--segment-speed-file {speeds_file}"
And the customize extra arguments "--segment-speed-file {speeds_file}"
And the speed file
"""
2,5,8
Expand Down
6 changes: 4 additions & 2 deletions features/lib/osrm_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class OSRMDirectLoader extends OSRMBaseLoader {
osrmUp (callback) {
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));

this.child = this.scope.runBin('osrm-routed', util.format("%s -p %d", this.inputFile, this.scope.OSRM_PORT), this.scope.environment, (err) => {
const command_arguments = util.format('%s -p %d -a %s', this.inputFile, this.scope.OSRM_PORT, this.scope.ROUTING_ALGORITHM);
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
if (err && err.signal !== 'SIGINT') {
this.child = null;
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
Expand Down Expand Up @@ -115,7 +116,8 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
osrmUp (callback) {
if (this.osrmIsRunning()) return callback();

this.child = this.scope.runBin('osrm-routed', util.format('--shared-memory=1 -p %d', this.scope.OSRM_PORT), this.scope.environment, (err) => {
const command_arguments = util.format('--shared-memory=1 -p %d -a %s', this.scope.OSRM_PORT, this.scope.ROUTING_ALGORITHM);
this.child = this.scope.runBin('osrm-routed', command_arguments, this.scope.environment, (err) => {
if (err && err.signal !== 'SIGINT') {
this.child = null;
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
Expand Down
2 changes: 1 addition & 1 deletion features/options/contract/version.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@prepare @options @version
@contract @options @version
Feature: osrm-contract command line options: version
# the regex will match these two formats:
# v0.3.7.0 # this is the normal format when you build from a git clone
Expand Down
23 changes: 23 additions & 0 deletions features/options/customize/files.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@customize @options @files
Feature: osrm-contract command line options: files
Background:
Given the profile "testbot"
And the node map
"""
a b
"""
And the ways
| nodes |
| ab |
And the data has been extracted
And the data has been partitioned

Scenario: osrm-customize - Passing base file
When I run "osrm-customize {processed_file}"
Then it should exit successfully

Scenario: osrm-customize - Missing input file
When I try to run "osrm-customize over-the-rainbow.osrm"
And stderr should contain "over-the-rainbow.osrm"
And stderr should contain "not found"
And it should exit with an error
35 changes: 35 additions & 0 deletions features/options/customize/help.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@contract @options @help
Feature: osrm-customize command line options: help

Scenario: osrm-customize - Help should be shown when no options are passed
When I try to run "osrm-customize"
Then stderr should be empty
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And it should exit with an error

Scenario: osrm-customize - Help, short
When I run "osrm-customize -h"
Then stderr should be empty
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And it should exit successfully

Scenario: osrm-customize - Help, long
When I run "osrm-customize --help"
Then stderr should be empty
And stdout should contain /osrm-customize(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And it should exit successfully
20 changes: 20 additions & 0 deletions features/options/customize/invalid.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@prepare @options @invalid
Feature: osrm-customize command line options: invalid options

Background:
Given the profile "testbot"
And the node map
"""
a b
"""
And the ways
| nodes |
| ab |
And the data has been extracted

Scenario: osrm-customize - Non-existing option
When I try to run "osrm-customize --fly-me-to-the-moon"
Then stdout should be empty
And stderr should contain "option"
And stderr should contain "fly-me-to-the-moon"
And it should exit with an error
19 changes: 19 additions & 0 deletions features/options/customize/version.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@prepare @options @version
Feature: osrm-customize command line options: version

Background:
Given the profile "testbot"

Scenario: osrm-customize - Version, short
When I run "osrm-customize --v"
Then stderr should be empty
And stdout should contain 1 line
And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/
And it should exit successfully

Scenario: osrm-customize - Version, long
When I run "osrm-customize --version"
Then stderr should be empty
And stdout should contain 1 line
And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/
And it should exit successfully
22 changes: 22 additions & 0 deletions features/options/partition/files.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@partition @options @files
Feature: osrm-partition command line options: files
Background:
Given the profile "testbot"
And the node map
"""
a b
"""
And the ways
| nodes |
| ab |
And the data has been extracted

Scenario: osrm-partition - Passing base file
When I run "osrm-partition {processed_file}"
Then it should exit successfully

Scenario: osrm-partition - Missing input file
When I try to run "osrm-partition over-the-rainbow.osrm"
And stderr should contain "over-the-rainbow.osrm"
And stderr should contain "not found"
And it should exit with an error
50 changes: 50 additions & 0 deletions features/options/partition/help.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@partition @options @help
Feature: osrm-partition command line options: help

Scenario: osrm-partition - Help should be shown when no options are passed
When I try to run "osrm-partition"
Then stderr should be empty
And stdout should contain /osrm-partition(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--min-cell-size"
And stdout should contain "--balance"
And stdout should contain "--boundary"
And stdout should contain "--optimizing-cuts"
And stdout should contain "--small-component-size"
And it should exit with an error

Scenario: osrm-partition - Help, short
When I run "osrm-partition -h"
Then stderr should be empty
And stdout should contain /osrm-partition(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--min-cell-size"
And stdout should contain "--balance"
And stdout should contain "--boundary"
And stdout should contain "--optimizing-cuts"
And stdout should contain "--small-component-size"
And it should exit successfully

Scenario: osrm-partition - Help, long
When I run "osrm-partition --help"
Then stderr should be empty
And stdout should contain /osrm-partition(.exe)? <input.osrm> \[options\]:/
And stdout should contain "Options:"
And stdout should contain "--version"
And stdout should contain "--help"
And stdout should contain "Configuration:"
And stdout should contain "--threads"
And stdout should contain "--min-cell-size"
And stdout should contain "--balance"
And stdout should contain "--boundary"
And stdout should contain "--optimizing-cuts"
And stdout should contain "--small-component-size"
And it should exit successfully
20 changes: 20 additions & 0 deletions features/options/partition/invalid.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@partition @options @invalid
Feature: osrm-partition command line options: invalid options

Background:
Given the profile "testbot"
And the node map
"""
a b
"""
And the ways
| nodes |
| ab |
And the data has been extracted

Scenario: osrm-partition - Non-existing option
When I try to run "osrm-partition --fly-me-to-the-moon"
Then stdout should be empty
And stderr should contain "option"
And stderr should contain "fly-me-to-the-moon"
And it should exit with an error
19 changes: 19 additions & 0 deletions features/options/partition/version.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@partition @options @version
Feature: osrm-partition command line options: version

Background:
Given the profile "testbot"

Scenario: osrm-partition - Version, short
When I run "osrm-partition --v"
Then stderr should be empty
And stdout should contain 1 line
And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/
And it should exit successfully

Scenario: osrm-partition - Version, long
When I run "osrm-partition --version"
Then stderr should be empty
And stdout should contain 1 line
And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/
And it should exit successfully
16 changes: 11 additions & 5 deletions features/step_definitions/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ module.exports = function () {
callback();
});

this.Given(/^the partition extra arguments "(.*?)"$/, (args, callback) => {
this.partitionArgs = this.expandOptions(args);
callback();
});

this.Given(/^the customize extra arguments "(.*?)"$/, (args, callback) => {
this.customizeArgs = this.expandOptions(args);
callback();
});

this.Given(/^a grid size of ([0-9.]+) meters$/, (meters, callback) => {
this.setGridSize(meters);
callback();
Expand Down Expand Up @@ -259,11 +269,7 @@ module.exports = function () {
this.writeAndLinkOSM(callback);
});

this.Given(/^the data has been extracted$/, (callback) => {
this.reprocess(callback);
});

this.Given(/^the data has been contracted$/, (callback) => {
this.Given(/^the data has been (extract|contract|partition|customiz)ed$/, (step, callback) => {
this.reprocess(callback);
});

Expand Down
31 changes: 8 additions & 23 deletions features/step_definitions/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,16 @@ module.exports = function () {
this.runAndSafeOutput('osrm-routed', options, callback);
});

this.When(/^I run "osrm\-extract\s?(.*?)"$/, (options, callback) => {
const stamp = this.processedCacheFile + '.extract';
this.runAndSafeOutput('osrm-extract', options, (err) => {
this.When(/^I run "osrm\-(extract|contract|partition|customize)\s?(.*?)"$/, (binary, options, callback) => {
const stamp = this.processedCacheFile + '.stamp_' + binary;
this.runAndSafeOutput('osrm-' + binary, options, (err) => {
if (err) return callback(err);
fs.writeFile(stamp, 'ok', callback);
});
});

this.When(/^I run "osrm\-contract\s?(.*?)"$/, (options, callback) => {
const stamp = this.processedCacheFile + '.contract';
this.runAndSafeOutput('osrm-contract', options, (err) => {
if (err) return callback(err);
fs.writeFile(stamp, 'ok', callback);
});
});

this.When(/^I try to run "osrm\-routed\s?(.*?)"$/, (options, callback) => {
this.runAndSafeOutput('osrm-routed', options, () => { callback(); });
});

this.When(/^I try to run "osrm\-extract\s?(.*?)"$/, (options, callback) => {
this.runAndSafeOutput('osrm-extract', options, () => { callback(); });
});

this.When(/^I try to run "osrm\-contract\s?(.*?)"$/, (options, callback) => {
this.runAndSafeOutput('osrm-contract', options, () => { callback(); });
this.When(/^I try to run "(osrm\-[a-z]+)\s?(.*?)"$/, (binary, options, callback) => {
this.runAndSafeOutput(binary, options, () => { callback(); });
});

this.When(/^I run "osrm\-datastore\s?(.*?)"(?: with input "([^"]*)")?$/, (options, input, callback) => {
Expand All @@ -68,8 +52,9 @@ module.exports = function () {
assert.ok(this.exitCode !== 0 || this.termSignal);
});

this.Then(/^stdout should contain "(.*?)"$/, (str) => {
assert.ok(this.stdout.indexOf(str) > -1);
this.Then(/^stdout should( not)? contain "(.*?)"$/, (not, str) => {
const contains = this.stdout.indexOf(str) > -1;
assert.ok(typeof not === 'undefined' ? contains : !contains);
});

this.Then(/^stderr should( not)? contain "(.*?)"$/, (not, str) => {
Expand Down
Loading