2020-04-22 18:15:59 +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
|
|
|
|
|
2020-04-22 18:15:59 +00:00
|
|
|
setup() {
|
2022-07-10 17:27:35 +00:00
|
|
|
tmp=$(mktemp)
|
2023-01-30 21:51:56 +00:00
|
|
|
perl -pe 's/\n/\n\0/' >"$tmp" <<EOF
|
2020-04-22 18:15:59 +00:00
|
|
|
chr1 1 Sample 1
|
|
|
|
chr1 11 Sample 1
|
|
|
|
chr1 111 Sample 1
|
|
|
|
chr1 1111 Sample 1
|
|
|
|
chr1 11111 Sample 1
|
|
|
|
chr1 111111 Sample 1
|
|
|
|
chr2 1 Sample 1
|
|
|
|
chr2 22 Sample 1
|
|
|
|
chr2 111 Sample 1
|
|
|
|
chr2 2222 Sample 1
|
|
|
|
chr2 11111 Sample 1
|
|
|
|
chr2 111111 Sample 1
|
|
|
|
chr10 1 Sample 1
|
|
|
|
chr10 11 Sample 1
|
|
|
|
chr10 111 Sample 1
|
|
|
|
chr10 1111 Sample 1
|
|
|
|
chr10 11111 Sample 1
|
|
|
|
chr10 111111 Sample 1
|
|
|
|
chr1 1 Sample 2
|
|
|
|
chr1 11 Sample 2
|
|
|
|
chr1 111 Sample 2
|
|
|
|
chr1 1111 Sample 2
|
|
|
|
chr1 11111 Sample 2
|
|
|
|
chr1 111111 Sample 2
|
|
|
|
chr2 1 Sample 2
|
|
|
|
chr2 22 Sample 2
|
|
|
|
chr2 111 Sample 2
|
|
|
|
chr2 2222 Sample 2
|
|
|
|
chr2 11111 Sample 2
|
|
|
|
chr2 111111 Sample 2
|
|
|
|
chr10 1 Sample 2
|
|
|
|
chr10 11 Sample 2
|
|
|
|
chr10 111 Sample 2
|
|
|
|
chr10 1111 Sample 2
|
|
|
|
chr10 11111 Sample 2
|
|
|
|
chr10 111111 Sample 2
|
|
|
|
chr1 1 Sample 10
|
|
|
|
chr1 11 Sample 10
|
|
|
|
chr1 111 Sample 10
|
|
|
|
chr1 1111 Sample 10
|
|
|
|
chr1 11111 Sample 10
|
|
|
|
chr1 111111 Sample 10
|
|
|
|
chr2 1 Sample 10
|
|
|
|
chr2 22 Sample 10
|
|
|
|
chr2 111 Sample 10
|
|
|
|
chr2 2222 Sample 10
|
|
|
|
chr2 11111 Sample 10
|
|
|
|
chr2 111111 Sample 10
|
|
|
|
chr10 1 Sample 10
|
|
|
|
chr10 11 Sample 10
|
|
|
|
chr10 111 Sample 10
|
|
|
|
chr10 1111 Sample 10
|
|
|
|
chr10 11111 Sample 10
|
|
|
|
chr10 111111 Sample 10
|
|
|
|
EOF
|
|
|
|
export tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
parsort_test() {
|
|
|
|
echo "### parsort $@"
|
2023-01-30 21:51:56 +00:00
|
|
|
parsort "$@" "$tmp" | md5sum
|
|
|
|
sort "$@" "$tmp" | md5sum
|
|
|
|
parsort "$@" < "$tmp" | md5sum
|
|
|
|
sort "$@" < "$tmp" | md5sum
|
2020-04-22 18:15:59 +00:00
|
|
|
}
|
|
|
|
export -f parsort_test
|
|
|
|
|
|
|
|
par_normal() { parsort_test; }
|
|
|
|
|
|
|
|
par_n() { parsort_test -n; }
|
|
|
|
|
|
|
|
par_r() { parsort_test -r; }
|
|
|
|
|
|
|
|
par_nr() { parsort_test -nr; }
|
|
|
|
|
|
|
|
par_z() { parsort_test -z; }
|
|
|
|
|
|
|
|
par_k2() { parsort_test -k2n; }
|
|
|
|
|
|
|
|
par_k2r() { parsort_test -k2nr; }
|
|
|
|
|
|
|
|
par_k3() { parsort_test -k3; }
|
|
|
|
|
|
|
|
par_k3r() { parsort_test -k3r; }
|
|
|
|
|
|
|
|
par_dummy() {
|
|
|
|
parsort_test --random-source=`which parallel` --batch-size=10 \
|
|
|
|
--compress-program=gzip --temporary-directory=/var/tmp \
|
|
|
|
--parallel=8 --unique
|
|
|
|
# TODO
|
|
|
|
# files0=$(tempfile)
|
|
|
|
# echo $tmp > $files0
|
|
|
|
# --files0-from=$files0
|
|
|
|
}
|
|
|
|
|
2021-07-09 16:39:01 +00:00
|
|
|
par_tmpdir() {
|
|
|
|
export TMPDIR="/tmp/parsort dir"
|
|
|
|
rm -rf "$TMPDIR"
|
2021-07-11 14:59:27 +00:00
|
|
|
echo Should fail
|
2021-07-09 16:39:01 +00:00
|
|
|
echo Fail: no such dir | parsort
|
|
|
|
mkdir "$TMPDIR"
|
|
|
|
echo OK | parsort
|
|
|
|
chmod -w "$TMPDIR"
|
2021-07-11 14:59:27 +00:00
|
|
|
echo Should fail
|
2021-07-09 16:39:01 +00:00
|
|
|
echo Fail: writeable | parsort
|
2021-07-11 14:59:27 +00:00
|
|
|
rm -rf "$TMPDIR"
|
2021-07-09 16:39:01 +00:00
|
|
|
}
|
|
|
|
|
2020-04-22 18:15:59 +00:00
|
|
|
setup
|
|
|
|
|
|
|
|
export -f $(compgen -A function | grep par_)
|
|
|
|
compgen -A function | grep par_ | LC_ALL=C sort |
|
|
|
|
parallel --timeout 10000% -j6 --tag -k --joblog /tmp/jl-`basename $0` '{} 2>&1'
|