parallel: ssh command hexed to a script in $PARALLEL_REMOTE_TMPDIR.
[parallel.git] / testsuite / tests-to-run / test47.sh
blob3ac111485fd81a2cfedc2f9dac43b6cb2785ec77
1 #!/bin/bash
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
10 SSHUSER1=vagrant
11 SSHUSER2=vagrant
12 SSHUSER3=vagrant
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
22 export SSHLOGIN1
23 export SSHLOGIN2
24 # Minimal version of test17
26 export PARALLEL=-j8
27 # Make sure sort order is the same
28 export LANG=C
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*'
47 cat /tmp/test17abs |
48 parallel -k --transfer --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}";"rm {}
49 # One of these should give the empty dir /tmp/parallel.file
50 echo good if no 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*'
58 cd /
59 cat /tmp/test17rel | parallel -k --transfer --sshlogin $SSHLOGIN1,$SSHLOGIN2 cat {}";"rm {}
60 # Should give: No such file or directory
61 echo good if no file
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 {}
70 echo good if no file
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
81 echo good if no file
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
115 echo good if no file
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
127 echo good if no file
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
139 echo good if no file
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
151 echo good if no file
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
163 echo good if no file
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
186 echo good if no file
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
198 echo good if no file
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
210 echo good if no file
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