2014-03-03 10:42:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-12-26 22:29:28 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-2022 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
|
|
|
|
|
2014-03-03 10:42:04 +00:00
|
|
|
echo "### These tests requires VirtualBox running with the following images"
|
2023-03-22 19:32:12 +00:00
|
|
|
SERVER1=freebsd12
|
2020-08-07 20:20:30 +00:00
|
|
|
SSHUSER1=vagrant
|
|
|
|
SSHLOGIN1=$SSHUSER1@$SERVER1
|
2020-09-23 15:41:03 +00:00
|
|
|
echo $SSHUSER1@$SERVER1
|
2020-08-07 20:20:30 +00:00
|
|
|
|
|
|
|
ssh $SSHLOGIN1 touch .parallel/will-cite
|
2023-01-30 21:51:56 +00:00
|
|
|
(
|
|
|
|
pwd=$(pwd)
|
|
|
|
# If not run in dir parallel/testsuite: set testsuitedir to path of testsuite
|
|
|
|
testsuitedir=${testsuitedir:-$pwd}
|
|
|
|
cd $testsuitedir
|
|
|
|
scp -q "$testsuitedir"/../src/{parallel,sem,sql,niceload,env_parallel*} $SSHLOGIN1:bin/
|
|
|
|
)
|
2018-08-22 22:21:29 +00:00
|
|
|
. `which env_parallel.bash`
|
|
|
|
env_parallel --session
|
|
|
|
|
2017-12-01 19:53:56 +00:00
|
|
|
par_no_more_procs() {
|
|
|
|
echo 'bug #40136: FreeBSD: No more processes'
|
|
|
|
sem --jobs 3 --id my_id -u 'echo First started; sleep 10; echo The first finished;echo' &&
|
|
|
|
sem --jobs 3 --id my_id -u 'echo Second started; sleep 11; echo The second finished;echo' &&
|
|
|
|
sem --jobs 3 --id my_id -u 'echo Third started; sleep 12; echo The third finished;echo' &&
|
|
|
|
sem --jobs 3 --id my_id -u 'echo Fourth started; sleep 13; echo The fourth finished;echo' &&
|
|
|
|
sem --wait --id my_id
|
|
|
|
}
|
|
|
|
|
|
|
|
par_compress_pipe() {
|
|
|
|
echo 'Test --compress --pipe'
|
|
|
|
jot 1000 | parallel --compress --pipe cat | wc
|
|
|
|
|
|
|
|
echo 'bug #41613: --compress --line-buffer no newline'
|
|
|
|
perl -e 'print "It worked"'| parallel --pipe --compress --line-buffer cat
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
par_sem_fg() {
|
|
|
|
echo 'bug #40135: FreeBSD: sem --fg does not finish under /bin/sh'
|
|
|
|
sem --fg 'sleep 1; echo The job finished'
|
|
|
|
}
|
|
|
|
|
|
|
|
par_round_robin() {
|
|
|
|
echo 'bug #40133: FreeBSD: --round-robin gives no output'
|
|
|
|
jot 1000000 | parallel --round-robin --pipe -kj3 cat | wc
|
|
|
|
jot 1000000 | parallel --round-robin --pipe -kj4 cat | wc
|
|
|
|
}
|
|
|
|
|
|
|
|
par_shebang() {
|
|
|
|
echo 'bug #40134: FreeBSD: --shebang not working'
|
|
|
|
(echo '#!/usr/bin/env -S parallel --shebang -rk echo'
|
|
|
|
echo It
|
|
|
|
echo worked) > shebang
|
|
|
|
chmod 755 ./shebang; ./shebang
|
|
|
|
|
|
|
|
echo 'bug #40134: FreeBSD: --shebang(-wrap) not working'
|
2020-08-07 20:20:30 +00:00
|
|
|
(echo '#!/usr/bin/env -S parallel --shebang-wrap /usr/local/bin/perl :::';
|
2017-12-01 19:53:56 +00:00
|
|
|
echo 'print @ARGV,"\n";') > shebang-wrap
|
|
|
|
chmod 755 ./shebang-wrap
|
|
|
|
./shebang-wrap wrap works | sort -r
|
|
|
|
|
|
|
|
echo 'bug #40134: FreeBSD: --shebang(-wrap) with options not working'
|
2020-08-07 20:20:30 +00:00
|
|
|
(echo '#!/usr/bin/env -S parallel --shebang-wrap -v -k -j 0 /usr/local/bin/perl -w :::'
|
2017-12-01 19:53:56 +00:00
|
|
|
echo 'print @ARGV,"\n";') > shebang-wrap-opt;
|
|
|
|
chmod 755 ./shebang-wrap-opt
|
|
|
|
./shebang-wrap-opt wrap works with options
|
|
|
|
}
|
|
|
|
|
|
|
|
par_load() {
|
|
|
|
echo '### Test --load (must give 1=true)'
|
|
|
|
parallel -j0 -N0 --timeout 5 --nice 10 'bzip2 < /dev/zero >/dev/null' ::: 1 2 3 4 5 6 &
|
|
|
|
parallel --argsep ,, --joblog - -N0 parallel --load 100% echo ::: 1 ,, 1 |
|
2022-12-15 21:30:15 +00:00
|
|
|
# Must take > 5 sec
|
2018-09-20 22:15:14 +00:00
|
|
|
parallel -k --colsep '\t' --header : echo '{=4 $_=$_>5=}'
|
2017-12-01 19:53:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_env_parallel() {
|
|
|
|
echo "### env_parallel on Freebsd"
|
|
|
|
. bin/env_parallel.sh
|
|
|
|
myvar="`echo 'myvar_line 1'; echo 'myvar_line 2'`"
|
|
|
|
alias myalias='echo myalias1 "$myvar";'"`echo` echo myalias2"
|
|
|
|
env_parallel myalias ::: foo
|
|
|
|
}
|
|
|
|
|
|
|
|
# Moving the functions to FreeBSD is a bit tricky:
|
|
|
|
# We use env_parallel.bash to copy the functions to FreeBSD
|
|
|
|
|
|
|
|
. `which env_parallel.bash`
|
|
|
|
|
|
|
|
# GNU/Linux runs bash, but the FreeBSD runs (a)sh,
|
|
|
|
# (a)sh does not support 'export -f' so any function exported
|
|
|
|
# must be unset
|
|
|
|
|
2023-02-19 13:49:30 +00:00
|
|
|
unset replace_tmpdir
|
2017-12-01 19:53:56 +00:00
|
|
|
unset run_once
|
|
|
|
unset run_test
|
|
|
|
unset TMPDIR
|
|
|
|
|
|
|
|
# As the copied environment is written in Bash dialect
|
|
|
|
# we get 'shopt'-errors and 'declare'-errors.
|
|
|
|
# We can safely ignore those.
|
|
|
|
|
2020-09-23 15:41:03 +00:00
|
|
|
export LC_ALL=C
|
2018-08-22 22:21:29 +00:00
|
|
|
PARALLEL_SHELL=sh env_parallel --env _ -vj9 -k --joblog /tmp/jl-`basename $0` --retries 3 \
|
2020-08-07 20:20:30 +00:00
|
|
|
-S $SSHLOGIN1 --tag '{} 2>&1' \
|
2017-12-01 19:53:56 +00:00
|
|
|
::: $(compgen -A function | grep par_ | sort) \
|
|
|
|
2> >(grep -Ev 'shopt: not found|declare: not found')
|