set -e

#
# run normal mode
#
echo ''
$NXF_RUN | tee stdout

[[ `grep 'INFO' .nextflow.log | grep -c 'Submitted process > printVars'` == 3 ]] || false

< stdout grep 'cpus: 2'
< stdout grep 'penv: mpi'
< stdout grep 'time: 1d'
< stdout grep 'memory: 1 GB'
< stdout grep 'proc: printVars'
< stdout grep 'exec: local'
< stdout grep 'indx: 1'
< stdout grep 'indx: 2'
< stdout grep 'indx: 3'


#
# RESUME mode
#
echo ''
$NXF_RUN -resume | tee stdout

[[ `grep 'INFO' .nextflow.log | grep -c 'Cached process > printVars'` == 3 ]] || false

< stdout grep 'cpus: 2'
< stdout grep 'penv: mpi'
< stdout grep 'time: 1d'
< stdout grep 'memory: 1 GB'
< stdout grep 'proc: printVars'
< stdout grep 'exec: local'
< stdout grep 'indx: 1'
< stdout grep 'indx: 2'
< stdout grep 'indx: 3'