2010-12-21 17:08:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-01-24 01:02:07 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-2024 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
|
2021-03-22 20:16:35 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2013-03-24 16:24:59 +00:00
|
|
|
SERVER1=parallel-server1
|
2010-12-21 17:08:16 +00:00
|
|
|
SERVER2=parallel-server2
|
2023-07-21 02:33:22 +00:00
|
|
|
SERVER3=parallel-server3
|
2020-08-07 20:20:30 +00:00
|
|
|
SSHUSER1=vagrant
|
|
|
|
SSHUSER2=vagrant
|
|
|
|
SSHUSER3=vagrant
|
|
|
|
SSHLOGIN1=$SSHUSER1@$SERVER1
|
|
|
|
SSHLOGIN2=$SSHUSER2@$SERVER2
|
|
|
|
SSHLOGIN3=$SSHUSER3@$SERVER3
|
|
|
|
|
|
|
|
## must be other servers than localhost
|
|
|
|
#SERVER1=parallel-server1
|
|
|
|
#SERVER2=parallel-server2
|
|
|
|
#SSHLOGIN1=parallel@$SERVER1
|
|
|
|
#SSHLOGIN2=parallel@$SERVER2
|
2018-01-03 08:03:16 +00:00
|
|
|
export SSHLOGIN1
|
|
|
|
export SSHLOGIN2
|
2010-12-21 17:08:16 +00:00
|
|
|
# Minimal version of test17
|
|
|
|
|
2013-04-08 19:17:59 +00:00
|
|
|
export PARALLEL=-j8
|
2010-12-21 17:08:16 +00:00
|
|
|
# Make sure sort order is the same
|
|
|
|
export LANG=C
|
|
|
|
|
|
|
|
echo '### Test --transfer --return --cleanup'
|
|
|
|
|
|
|
|
rm -rf /tmp/parallel.file*
|
2022-02-17 21:39:01 +00:00
|
|
|
stdout ssh $SSHLOGIN1 rm -rf 'tmp/parallel.file*' '/tmp/parallel.file*' |
|
|
|
|
grep -v 'Warning: Permanently added.*known hosts'
|
|
|
|
stdout ssh $SSHLOGIN2 rm -rf 'tmp/parallel.file*' '/tmp/parallel.file*' |
|
|
|
|
grep -v 'Warning: Permanently added.*known hosts'
|
2010-12-21 17:08:16 +00:00
|
|
|
(seq 1 2) >/tmp/test17
|
|
|
|
echo '# Create some weirdly files in /tmp'
|
|
|
|
mkdir -p /tmp/parallel.file
|
|
|
|
cat /tmp/test17 | parallel -k /bin/echo file{} '>'/tmp/parallel.file{}.file
|
|
|
|
cat /tmp/test17 | parallel -k /bin/echo /tmp/parallel.file{}.file >/tmp/test17abs
|
|
|
|
cat /tmp/test17 | parallel -k /bin/echo tmp/parallel.file{}.file >/tmp/test17rel
|
|
|
|
|
|
|
|
echo '### --transfer - abspath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
|
2018-01-03 08:03:16 +00:00
|
|
|
cat /tmp/test17abs |
|
|
|
|
parallel -k --transfer --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}";"rm {}
|
2010-12-21 17:08:16 +00:00
|
|
|
# One of these should give the empty dir /tmp/parallel.file
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls '/tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
# The other: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls '/tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --transfer - relpath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
cd /
|
2011-10-17 01:10:32 +00:00
|
|
|
cat /tmp/test17rel | parallel -k --transfer --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}";"rm {}
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --transfer --cleanup - abspath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
|
|
|
|
cat /tmp/test17abs | parallel -k --transfer --cleanup --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}
|
2010-12-21 17:08:16 +00:00
|
|
|
echo good if no file
|
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls '/tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls '/tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --transfer --cleanup - relpath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
|
|
|
|
cat /tmp/test17rel | parallel -k --transfer --cleanup --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --return - abspath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf /tmp/parallel.file*out
|
2011-10-17 01:10:32 +00:00
|
|
|
cat /tmp/test17abs | parallel -k --return {.}.out --sshlogin $SSHLOGIN1,$SSHLOGIN2 echo {} ">"{.}.out
|
2010-12-21 17:08:16 +00:00
|
|
|
ls /tmp/parallel.file*out
|
|
|
|
|
|
|
|
echo '### --return - relpath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf /tmp/parallel.file*out
|
2011-10-17 01:10:32 +00:00
|
|
|
cat /tmp/test17rel | parallel -k --return {.}.out --sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir -p tmp/parallel.file ';'echo {} ">"{.}.out
|
2010-12-21 17:08:16 +00:00
|
|
|
ls tmp/parallel.file*out
|
|
|
|
|
|
|
|
echo '### --return - multiple files'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf tmp/parallel.file*out tmp/parallel.file*done
|
|
|
|
cat /tmp/test17rel | parallel -k --return {.}.out --return {}.done \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir -p tmp ';'echo {} ">"{.}.out';'echo {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls tmp/parallel.file*out tmp/parallel.file*done
|
|
|
|
|
|
|
|
echo '### --return --cleanup - abspath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
cat /tmp/test17abs | parallel -k --return {.}.out --return {}.done --cleanup \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir -p tmp/parallel.file ';'echo {} ">"{.}.out';'echo {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls '/tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls '/tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --return --cleanup - relpath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf tmp/parallel.file*out tmp/parallel.file*done
|
|
|
|
cat /tmp/test17rel | parallel -k --return {.}.out --return {}.done --cleanup \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 echo {} ">"{.}.out';'echo {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls tmp/parallel.file*out tmp/parallel.file*done
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --return --cleanup - multiple returns'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf tmp/parallel.file*out tmp/parallel.file*done
|
|
|
|
cat /tmp/test17rel | parallel -k --return {.}.out --return {}.done --cleanup \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir -p tmp";"echo {} ">"{.}.out';'echo {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --transfer --return --cleanup - abspath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
cat /tmp/test17abs | parallel -k --transfer --return {.}.out --return {}.done --cleanup \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} ">"{.}.out';'cat {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls '/tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls '/tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --transfer --return --cleanup - relpath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf tmp/parallel.file*out tmp/parallel.file*done
|
|
|
|
cat /tmp/test17rel | parallel -k --transfer --return {.}.out --return {}.done --cleanup \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} ">"{.}.out';'cat {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --transfer --return --cleanup - multiple files'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf tmp/parallel.file*out tmp/parallel.file*done
|
|
|
|
cat /tmp/test17rel | parallel -k --transfer --return {.}.out --return {}.done --cleanup \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} ">"{.}.out';'cat {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls /tmp/parallel.file*out /tmp/parallel.file*done
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --trc - abspath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
cat /tmp/test17abs | parallel -k --trc {.}.out --trc {}.done \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir -p tmp ';'cat {} ">"{.}.out';'cat {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls '/tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls '/tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --trc - relpath'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf tmp/parallel.file*out tmp/parallel.file*done
|
|
|
|
cat /tmp/test17rel | parallel -k --trc {.}.out --trc {}.done \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} ">"{.}.out';'cat {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls tmp/parallel.file*out tmp/parallel.file*done
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls 'tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --trc - multiple files'
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
|
|
|
|
stdout ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
|
2010-12-21 17:08:16 +00:00
|
|
|
rm -rf /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
cat /tmp/test17abs | parallel -k --trc {.}.out --trc {}.done \
|
2011-10-17 01:10:32 +00:00
|
|
|
--sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir -p tmp ';'cat {} ">"{.}.out';'cat {} ">"{}.done';'
|
2010-12-21 17:08:16 +00:00
|
|
|
ls /tmp/parallel.file*out /tmp/parallel.file*done
|
|
|
|
echo good if no file
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN1 ls '/tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls '/tmp/parallel.file*' || echo OK
|
2010-12-21 17:08:16 +00:00
|
|
|
|
|
|
|
echo '### --transfer --cleanup - multiple argument files'
|
2016-05-17 00:11:38 +00:00
|
|
|
parallel --xapply -kv --transferfile {1} --transferfile {2} --cleanup -S$SSHLOGIN2 cat {2} {1} :::: /tmp/test17rel <(sort -r /tmp/test17abs)
|
2010-12-21 17:08:16 +00:00
|
|
|
# Should give: No such file or directory
|
2011-10-17 01:10:32 +00:00
|
|
|
stdout ssh $SSHLOGIN2 ls '/tmp/parallel.file*' || echo OK
|