Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Feb 10, 2024
1 parent 1d97d49 commit c4c6182
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ nxf_eval_cmd() {
(IFS=$'\n' read -r -d '' _ERRNO_; return ${_ERRNO_});
} < <((printf '\0%s\0%d\0' "$(((({ shift 2; "${@}"; echo "${?}" 1>&3-; } | tr -d '\0' 1>&4-) 4>&2- 2>&1- | tr -d '\0' 1>&4-) 3>&1- | exit "$(cat)") 4>&1-)" "${?}" 1>&2) 2>&1)
}

## reset/create command env file
echo '' > {{env_file}}
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ class BashWrapperBuilderTest extends Specification {
set +e
cd "$NXF_TASK_WORKDIR"
nxf_catch() {
nxf_eval_cmd() {
{
IFS=$'\\n' read -r -d '' "${1}";
IFS=$'\\n' read -r -d '' "${2}";
Expand Down Expand Up @@ -1163,7 +1163,7 @@ class BashWrapperBuilderTest extends Specification {
set +e
cd "$NXF_TASK_WORKDIR"
nxf_catch() {
nxf_eval_cmd() {
{
IFS=$'\\n' read -r -d '' "${1}";
IFS=$'\\n' read -r -d '' "${2}";
Expand All @@ -1176,7 +1176,7 @@ class BashWrapperBuilderTest extends Specification {
echo FOO="${FOO[@]}" >> .command.env
echo /FOO/ >> .command.env
#
nxf_catch STDOUT STDERR this --cmd
nxf_eval_cmd STDOUT STDERR this --cmd
status=$?
if [ $status -eq 0 ]; then
echo THIS="$STDOUT" >> .command.env
Expand All @@ -1186,7 +1186,7 @@ class BashWrapperBuilderTest extends Specification {
echo /THIS/=exit:$status >> .command.env
fi
#
nxf_catch STDOUT STDERR other --cmd
nxf_eval_cmd STDOUT STDERR other --cmd
status=$?
if [ $status -eq 0 ]; then
echo THAT="$STDOUT" >> .command.env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ class TaskProcessorTest extends Specification {
processor.collectOutEnvMap(workDir, [cmd_out_1: 'foo --this', cmd_out_2: 'bar --that'])
then:
def e = thrown(ProcessEvalException)
e.message == 'Unable to evaluate command output'
e.message == 'Unable to evaluate output'
e.command == 'bar --that'
e.output == 'This is an error message\nfor unknown reason'
e.status == 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ class TupleOutParamTest extends Dsl2Spec {
outs[0].inner[1].getName() == 'BAR'
}

def 'should create tuple of cmd' () {
def 'should create tuple of eval' () {
setup:
def text = '''
process hola {
output:
tuple cmd('this --one'), cmd("$other --two")
tuple eval('this --one'), eval("$other --two")
/echo command/
}
Expand All @@ -208,11 +208,11 @@ class TupleOutParamTest extends Dsl2Spec {
outs[0].inner.size() == 2
and:
outs[0].inner[0] instanceof CmdEvalParam
outs[0].inner[0].getName() =~ /nxf_out_cmd_\d+/
outs[0].inner[0].getName() =~ /nxf_out_eval_\d+/
(outs[0].inner[0] as CmdEvalParam).getTarget(binding) == 'this --one'
and:
outs[0].inner[1] instanceof CmdEvalParam
outs[0].inner[1].getName() =~ /nxf_out_cmd_\d+/
outs[0].inner[1].getName() =~ /nxf_out_eval_\d+/
(outs[0].inner[1] as CmdEvalParam).getTarget(binding) == 'tool --two'

}
Expand Down

0 comments on commit c4c6182

Please sign in to comment.