parallel: Partial Reuse licensing support.
[parallel.git] / testsuite / tests-to-run / parallel-local18.sh
blob264cc29470457e4b7cb17686b209684fbae82436
1 #!/bin/bash
3 # SPDX-FileCopyrightText: 2021 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
5 # SPDX-License-Identifier: GPL-3.0-or-later
7 par_space() {
8 echo '### Test --env - https://savannah.gnu.org/bugs/?37351'
9 export TWOSPACES=' 2 spaces '
10 export THREESPACES=" > My brother's 12\" records < "
11 echo a"$TWOSPACES"b 1
12 stdout parallel --env TWOSPACES echo 'a"$TWOSPACES"b' ::: 1
13 stdout parallel -S localhost --env TWOSPACES echo 'a"$TWOSPACES"b' ::: 1
14 stdout parallel -S csh@localhost --env TWOSPACES echo 'a"$TWOSPACES"b' ::: 1
15 stdout parallel -S tcsh@localhost --env TWOSPACES echo 'a"$TWOSPACES"b' ::: 1
17 echo a"$TWOSPACES"b a"$THREESPACES"b 2
18 stdout parallel --env TWOSPACES --env THREESPACES echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 2
19 stdout parallel -S localhost --env TWOSPACES --env THREESPACES echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 2
20 stdout parallel -S csh@localhost --env TWOSPACES --env THREESPACES echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 2
21 stdout parallel -S tcsh@localhost --env TWOSPACES --env THREESPACES echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 2
23 echo a"$TWOSPACES"b a"$THREESPACES"b 3
24 stdout parallel --env TWOSPACES,THREESPACES echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 3
25 stdout parallel -S localhost --env TWOSPACES,THREESPACES echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 3
26 stdout parallel -S csh@localhost --env TWOSPACES,THREESPACES echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 3
27 stdout parallel -S tcsh@localhost --env TWOSPACES,THREESPACES echo 'a"$TWOSPACES"b' 'a"$THREESPACES"b' ::: 3
30 par_space_quote() {
31 export MIN=" \'\""
32 echo a"$MIN"b 4
33 stdout parallel --env MIN echo 'a"$MIN"b' ::: 4
34 stdout parallel -S localhost --env MIN echo 'a"$MIN"b' ::: 4
35 stdout parallel -S csh@localhost --env MIN echo 'a"$MIN"b' ::: 4
36 stdout parallel -S tcsh@localhost --env MIN echo 'a"$MIN"b' ::: 4
39 par_special_char() {
40 export SPC="'"' * ? >o <i*? ][\!#ยค%=( ) | }'
41 echo a"$SPC"b 5
42 LANG=C stdout parallel --env SPC echo 'a"$SPC"b' ::: 5
43 LANG=C stdout parallel -S localhost --env SPC echo 'a"$SPC"b' ::: 5
44 # \ misses due to quoting incompatiblilty between bash and csh
45 LANG=C stdout parallel -S csh@localhost --env SPC echo 'a"$SPC"b' ::: 5
46 LANG=C stdout parallel -S tcsh@localhost --env SPC echo 'a"$SPC"b' ::: 5
49 test_chr_on_sshlogin() {
50 # test_chr_on_sshlogin 10,92 2/:,2/lo
51 # test_chr_on_sshlogin 10,92 2/tcsh@lo,2/csh@lo
52 chr="$1"
53 sshlogin="$2"
54 onall="$3"
55 perl -e 'for('$chr') { printf "%c%c %c%d\0",$_,$_,$_,$_ }' |
56 stdout parallel -j4 -k -I // --arg-sep _ -0 V=// V2=V2=// LANG=C parallel -k -j1 $onall -S $sshlogin --env V,V2,LANG echo \''"{}$V$V2"'\' ::: {#} {#} {#} {#} |
57 sort |
58 uniq -c |
59 grep -av ' 4 '|
60 grep -av xauth |
61 grep -av X11
63 export -f test_chr_on_sshlogin
65 par_env_newline_backslash_bash() {
66 echo '### Test --env for \n and \\ - single and double (bash only) - no output is good'
67 test_chr_on_sshlogin 10,92 2/:,2/lo ''
70 par_env_newline_backslash_csh() {
71 echo '### Test --env for \n and \\ - single and double (*csh only) - no output is good but csh fails'
72 test_chr_on_sshlogin 10,92 2/tcsh@lo,2/csh@lo '' |
73 perl -pe "s/'(.)'/\$1/g"
76 par_env_newline_backslash_onall_bash() {
77 echo '### Test --env for \n and \\ - single and double --onall (bash only) - no output is good'
78 test_chr_on_sshlogin 10,92 :,lo --onall |
79 grep -v "Unmatched '\"'"
82 par_env_newline_backslash_onall_csh() {
83 echo '### Test --env for \n and \\ - single and double --onall (*csh only) - no output is good but csh fails'
84 test_chr_on_sshlogin 10,92 2/tcsh@lo,2/csh@lo --onall
87 par_env_160() {
88 echo '### Test --env for \160 - which kills csh - single and double - no output is good'
89 test_chr_on_sshlogin 160 :,1/lo,1/tcsh@lo |
90 grep -v ' 3 '
93 par_env_160_onall() {
94 echo '### Test --env for \160 - which kills csh - single and double --onall - no output is good'
95 test_chr_on_sshlogin 160 :,1/lo,1/tcsh@lo --onall |
96 grep -a -v ' 3 '
99 export -f $(compgen -A function | grep par_)
100 #compgen -A function | grep par_ | sort | parallel --delay $D -j$P --tag -k '{} 2>&1'
101 compgen -A function | grep par_ | sort |
102 parallel --joblog /tmp/jl-`basename $0` --retries 3 -j2 --tag -k '{} 2>&1'