Skip to content

Commit

Permalink
Merge branch 'dkj-devel' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
dozy committed Oct 14, 2014
2 parents bdf9711 + cc2f960 commit 454b01c
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 6 deletions.
11 changes: 9 additions & 2 deletions bin/viv.pl
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,17 @@ sub _update_node_data_xfer {

if($node->{type} eq q[EXEC] and $data_xfer_name ne q[]) {
if(defined $port) {
if(my($inout) = grep {$_} $port=~/_(IN|OUT)__\z/smx , $port=~/\A__(IN|OUT)_/smx ){ # if port has _{IN,OUT}_ {suf,pre}fix convention
#ensure port is connected to in manner suggested by naming convention
croak 'Node '.($node->{'id'})." port $port connected as ".($edge_side == $FROM?q("from"):q("to")) if (($inout eq q(OUT))^($edge_side == $FROM));
} else {
$logger->($VLMED, 'Node '.($node->{'id'})." has poorly described port $port (no _{IN,OUT}__ {suf,pre}fix)\n");
}
my $cmd = $node->{'cmd'};
for my$cmd_part ( ref $cmd eq 'ARRAY' ? @{$cmd}[1..$#{$cmd}] : ($node->{'cmd'}) ){
$cmd_part =~ s/\Q$port\E/$data_xfer_name/;
}
return if ($cmd_part =~ s/\Q$port\E/$data_xfer_name/smx);
} #if link for port has not been made (port never defined, or already substituted, in node cmd) bail out
croak 'Node '.($node->{'id'})." has no port $port";
}
else {
my $node_edge_std = $edge_side == $FROM? q[STDOUT]: q[STDIN];
Expand Down
40 changes: 40 additions & 0 deletions t/data/simple_carping_pipeline1.vtf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"description": "minimal carping test pipeline - works, but I/O port names are poorly named. See log for warning",
"nodes":[
{ "id": "n1",
"type": "EXEC",
"cmd": "echo stuff",
"use_STDIN": 0,
"use_STDOUT": 1
},
{ "id": "n2",
"type": "EXEC",
"cmd": ["cat"],
"use_STDIN": 1,
"use_STDOUT": 1
},
{ "id": "m",
"type": "EXEC",
"cmd": ["echo", "stuff"],
"use_STDIN": false,
"use_STDOUT": true
},
{ "id": "d",
"type": "EXEC",
"cmd": "diff __IN1__ __IN2__",
"use_STDIN": 0,
"use_STDOUT": 0
}
],
"edges":[
{ "from": "n1",
"to": "n2"
},
{ "from": "n2",
"to": "d:__IN1__"
},
{ "from": "m",
"to": "d:__IN2__"
}
]
}
40 changes: 40 additions & 0 deletions t/data/simple_failing_io_pipeline1.vtf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"description": "minimal failing test pipeline. Port name in edge does not match one in node definition. Also carps about poorly named __IN1__ and __INN2__ ports",
"nodes":[
{ "id": "n1",
"type": "EXEC",
"cmd": "echo stuff",
"use_STDIN": 0,
"use_STDOUT": 1
},
{ "id": "n2",
"type": "EXEC",
"cmd": ["cat"],
"use_STDIN": 1,
"use_STDOUT": 1
},
{ "id": "m",
"type": "EXEC",
"cmd": ["echo", "stuff"],
"use_STDIN": false,
"use_STDOUT": true
},
{ "id": "d",
"type": "EXEC",
"cmd": "diff __IN1__ __IN2__",
"use_STDIN": 0,
"use_STDOUT": 0
}
],
"edges":[
{ "from": "n1",
"to": "n2"
},
{ "from": "n2",
"to": "d:__IN1__"
},
{ "from": "m",
"to": "d:__INN2__"
}
]
}
40 changes: 40 additions & 0 deletions t/data/simple_failing_io_pipeline2.vtf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"description": "minimal failing test pipeline. Port names in edges match the node definitions, but are of the wrong type",
"nodes":[
{ "id": "n1",
"type": "EXEC",
"cmd": "echo stuff",
"use_STDIN": 0,
"use_STDOUT": 1
},
{ "id": "n2",
"type": "EXEC",
"cmd": ["cat"],
"use_STDIN": 1,
"use_STDOUT": 1
},
{ "id": "m",
"type": "EXEC",
"cmd": ["echo", "stuff"],
"use_STDIN": false,
"use_STDOUT": true
},
{ "id": "d",
"type": "EXEC",
"cmd": "diff __IN_1__ __OUT_2__",
"use_STDIN": 0,
"use_STDOUT": 0
}
],
"edges":[
{ "from": "n1",
"to": "n2"
},
{ "from": "n2",
"to": "d:__IN_1__"
},
{ "from": "m",
"to": "d:__OUT_2__"
}
]
}
2 changes: 1 addition & 1 deletion t/data/simple_failing_pipeline.vtf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"description": "minimal failing test pipeline",
"description": "minimal failing test pipeline. Fails because of false in cmd. Also carps about poorly named __IN1__ and __IN2__ ports",
"nodes":[
{ "id": "n1",
"type": "EXEC",
Expand Down
6 changes: 3 additions & 3 deletions t/data/simple_pipeline.vtf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
{ "id": "d",
"type": "EXEC",
"cmd": "diff __IN1__ __IN2__",
"cmd": "diff __IN_1__ __IN_2__",
"use_STDIN": 0,
"use_STDOUT": 0
}
Expand All @@ -31,10 +31,10 @@
"to": "n2"
},
{ "from": "n2",
"to": "d:__IN1__"
"to": "d:__IN_1__"
},
{ "from": "m",
"to": "d:__IN2__"
"to": "d:__IN_2__"
}
]
}

0 comments on commit 454b01c

Please sign in to comment.