3 # SPDX-FileCopyrightText: 2021-2022 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
5 # SPDX-License-Identifier: GPL-3.0-or-later
7 SERVER1
=parallel-server1
8 SERVER2
=parallel-server2
9 SERVER2
=parallel-server3
13 SSHLOGIN1
=$SSHUSER1@
$SERVER1
14 SSHLOGIN2
=$SSHUSER2@
$SERVER2
15 SSHLOGIN3
=$SSHUSER3@
$SERVER3
17 ## must be other servers than localhost
18 #SERVER1=parallel-server1
19 #SERVER2=parallel-server2
20 #SSHLOGIN1=parallel@$SERVER1
21 #SSHLOGIN2=parallel@$SERVER2
24 # Minimal version of test17
27 # Make sure sort order is the same
30 echo '### Test --transfer --return --cleanup'
32 rm -rf /tmp
/parallel.
file*
33 stdout
ssh $SSHLOGIN1 rm -rf 'tmp/parallel.file*' '/tmp/parallel.file*' |
34 grep -v 'Warning: Permanently added.*known hosts'
35 stdout
ssh $SSHLOGIN2 rm -rf 'tmp/parallel.file*' '/tmp/parallel.file*' |
36 grep -v 'Warning: Permanently added.*known hosts'
37 (seq 1 2) >/tmp
/test17
38 echo '# Create some weirdly files in /tmp'
39 mkdir
-p /tmp
/parallel.
file
40 cat /tmp
/test17 | parallel
-k /bin
/echo file{} '>'/tmp
/parallel.
file{}.
file
41 cat /tmp
/test17 | parallel
-k /bin
/echo /tmp
/parallel.
file{}.
file >/tmp
/test17abs
42 cat /tmp
/test17 | parallel
-k /bin
/echo tmp
/parallel.
file{}.
file >/tmp
/test17rel
44 echo '### --transfer - abspath'
45 stdout
ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
46 stdout
ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
48 parallel
-k --transfer --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}";"rm {}
49 # One of these should give the empty dir /tmp/parallel.file
51 stdout
ssh $SSHLOGIN1 ls '/tmp/parallel.file*'
52 # The other: No such file or directory
53 stdout
ssh $SSHLOGIN2 ls '/tmp/parallel.file*'
55 echo '### --transfer - relpath'
56 stdout
ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
57 stdout
ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
59 cat /tmp
/test17rel | parallel
-k --transfer --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}";"rm {}
60 # Should give: No such file or directory
62 stdout
ssh $SSHLOGIN1 ls 'tmp/parallel.file*'
63 # Should give: No such file or directory
64 stdout
ssh $SSHLOGIN2 ls 'tmp/parallel.file*'
66 echo '### --transfer --cleanup - abspath'
67 stdout
ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
68 stdout
ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
69 cat /tmp
/test17abs | parallel
-k --transfer --cleanup --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}
71 # Should give: No such file or directory
72 stdout
ssh $SSHLOGIN1 ls '/tmp/parallel.file*'
73 # Should give: No such file or directory
74 stdout
ssh $SSHLOGIN2 ls '/tmp/parallel.file*'
76 echo '### --transfer --cleanup - relpath'
77 stdout
ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
78 stdout
ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
79 cat /tmp
/test17rel | parallel
-k --transfer --cleanup --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}
80 # Should give: No such file or directory
82 stdout
ssh $SSHLOGIN1 ls 'tmp/parallel.file*' ||
echo OK
83 # Should give: No such file or directory
84 stdout
ssh $SSHLOGIN2 ls 'tmp/parallel.file*' ||
echo OK
86 echo '### --return - abspath'
87 stdout
ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
88 stdout
ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
89 rm -rf /tmp
/parallel.
file*out
90 cat /tmp
/test17abs | parallel
-k --return {.
}.out
--sshlogin $SSHLOGIN1,$SSHLOGIN2 echo {} ">"{.
}.out
91 ls /tmp
/parallel.
file*out
93 echo '### --return - relpath'
94 stdout
ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
95 stdout
ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
96 rm -rf /tmp
/parallel.
file*out
97 cat /tmp
/test17rel | parallel
-k --return {.
}.out
--sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir
-p tmp
/parallel.
file ';'echo {} ">"{.
}.out
98 ls tmp
/parallel.
file*out
100 echo '### --return - multiple files'
101 stdout
ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
102 stdout
ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
103 rm -rf tmp
/parallel.
file*out tmp
/parallel.
file*done
104 cat /tmp
/test17rel | parallel
-k --return {.
}.out
--return {}.
done \
105 --sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir
-p tmp
';'echo {} ">"{.
}.out
';'echo {} ">"{}.
done';'
106 ls tmp
/parallel.
file*out tmp
/parallel.
file*done
108 echo '### --return --cleanup - abspath'
109 stdout
ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
110 stdout
ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
111 rm -rf /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
112 cat /tmp
/test17abs | parallel
-k --return {.
}.out
--return {}.
done --cleanup \
113 --sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir
-p tmp
/parallel.
file ';'echo {} ">"{.
}.out
';'echo {} ">"{}.
done';'
114 ls /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
116 stdout
ssh $SSHLOGIN1 ls '/tmp/parallel.file*' ||
echo OK
117 # Should give: No such file or directory
118 stdout
ssh $SSHLOGIN2 ls '/tmp/parallel.file*' ||
echo OK
120 echo '### --return --cleanup - relpath'
121 stdout
ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
122 stdout
ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
123 rm -rf tmp
/parallel.
file*out tmp
/parallel.
file*done
124 cat /tmp
/test17rel | parallel
-k --return {.
}.out
--return {}.
done --cleanup \
125 --sshlogin $SSHLOGIN1,$SSHLOGIN2 echo {} ">"{.
}.out
';'echo {} ">"{}.
done';'
126 ls tmp
/parallel.
file*out tmp
/parallel.
file*done
128 stdout
ssh $SSHLOGIN1 ls 'tmp/parallel.file*' ||
echo OK
129 # Should give: No such file or directory
130 stdout
ssh $SSHLOGIN2 ls 'tmp/parallel.file*' ||
echo OK
132 echo '### --return --cleanup - multiple returns'
133 stdout
ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
134 stdout
ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
135 rm -rf tmp
/parallel.
file*out tmp
/parallel.
file*done
136 cat /tmp
/test17rel | parallel
-k --return {.
}.out
--return {}.
done --cleanup \
137 --sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir
-p tmp
";"echo {} ">"{.
}.out
';'echo {} ">"{}.
done';'
138 ls /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
140 stdout
ssh $SSHLOGIN1 ls 'tmp/parallel.file*' ||
echo OK
141 # Should give: No such file or directory
142 stdout
ssh $SSHLOGIN2 ls 'tmp/parallel.file*' ||
echo OK
144 echo '### --transfer --return --cleanup - abspath'
145 stdout
ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
146 stdout
ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
147 rm -rf /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
148 cat /tmp
/test17abs | parallel
-k --transfer --return {.
}.out
--return {}.
done --cleanup \
149 --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} ">"{.
}.out
';'cat {} ">"{}.
done';'
150 ls /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
152 stdout
ssh $SSHLOGIN1 ls '/tmp/parallel.file*' ||
echo OK
153 # Should give: No such file or directory
154 stdout
ssh $SSHLOGIN2 ls '/tmp/parallel.file*' ||
echo OK
156 echo '### --transfer --return --cleanup - relpath'
157 stdout
ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
158 stdout
ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
159 rm -rf tmp
/parallel.
file*out tmp
/parallel.
file*done
160 cat /tmp
/test17rel | parallel
-k --transfer --return {.
}.out
--return {}.
done --cleanup \
161 --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} ">"{.
}.out
';'cat {} ">"{}.
done';'
162 ls /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
164 stdout
ssh $SSHLOGIN1 ls 'tmp/parallel.file*' ||
echo OK
165 # Should give: No such file or directory
166 stdout
ssh $SSHLOGIN2 ls 'tmp/parallel.file*' ||
echo OK
168 echo '### --transfer --return --cleanup - multiple files'
169 stdout
ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
170 stdout
ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
171 rm -rf tmp
/parallel.
file*out tmp
/parallel.
file*done
172 cat /tmp
/test17rel | parallel
-k --transfer --return {.
}.out
--return {}.
done --cleanup \
173 --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} ">"{.
}.out
';'cat {} ">"{}.
done';'
174 ls /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
175 stdout
ssh $SSHLOGIN1 ls 'tmp/parallel.file*' ||
echo OK
176 # Should give: No such file or directory
177 stdout
ssh $SSHLOGIN2 ls 'tmp/parallel.file*' ||
echo OK
179 echo '### --trc - abspath'
180 stdout
ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
181 stdout
ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
182 rm -rf /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
183 cat /tmp
/test17abs | parallel
-k --trc {.
}.out
--trc {}.
done \
184 --sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir
-p tmp
';'cat {} ">"{.
}.out
';'cat {} ">"{}.
done';'
185 ls /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
187 stdout
ssh $SSHLOGIN1 ls '/tmp/parallel.file*' ||
echo OK
188 # Should give: No such file or directory
189 stdout
ssh $SSHLOGIN2 ls '/tmp/parallel.file*' ||
echo OK
191 echo '### --trc - relpath'
192 stdout
ssh $SSHLOGIN1 'rm -rf tmp/parallel.file*'
193 stdout
ssh $SSHLOGIN2 'rm -rf tmp/parallel.file*'
194 rm -rf tmp
/parallel.
file*out tmp
/parallel.
file*done
195 cat /tmp
/test17rel | parallel
-k --trc {.
}.out
--trc {}.
done \
196 --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {} ">"{.
}.out
';'cat {} ">"{}.
done';'
197 ls tmp
/parallel.
file*out tmp
/parallel.
file*done
199 stdout
ssh $SSHLOGIN1 ls 'tmp/parallel.file*' ||
echo OK
200 # Should give: No such file or directory
201 stdout
ssh $SSHLOGIN2 ls 'tmp/parallel.file*' ||
echo OK
203 echo '### --trc - multiple files'
204 stdout
ssh $SSHLOGIN1 'rm -rf /tmp/parallel.file*'
205 stdout
ssh $SSHLOGIN2 'rm -rf /tmp/parallel.file*'
206 rm -rf /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
207 cat /tmp
/test17abs | parallel
-k --trc {.
}.out
--trc {}.
done \
208 --sshlogin $SSHLOGIN1,$SSHLOGIN2 mkdir
-p tmp
';'cat {} ">"{.
}.out
';'cat {} ">"{}.
done';'
209 ls /tmp
/parallel.
file*out
/tmp
/parallel.
file*done
211 stdout
ssh $SSHLOGIN1 ls '/tmp/parallel.file*' ||
echo OK
212 # Should give: No such file or directory
213 stdout
ssh $SSHLOGIN2 ls '/tmp/parallel.file*' ||
echo OK
215 echo '### --transfer --cleanup - multiple argument files'
216 parallel
--xapply -kv --transferfile {1} --transferfile {2} --cleanup -S$SSHLOGIN2 cat {2} {1} :::: /tmp
/test17rel
<(sort -r /tmp
/test17abs
)
217 # Should give: No such file or directory
218 stdout
ssh $SSHLOGIN2 ls '/tmp/parallel.file*' ||
echo OK