tangetools/find-first-fail/testsuite

39 lines
1 KiB
Plaintext
Raw Normal View History

#!/bin/bash
test_unexported_function() {
myprog() { perl -e 'exit (shift > 12345678)' "$@"; }
# myprog is a function, so source find-first-fail first
. `which find-first-fail`
find-first-fail myprog
}
test_exported_function() {
myprog() { perl -e 'exit (shift > 12345678)' "$@"; }
# myprog is an exported function
export -f myprog
find-first-fail myprog
}
test_startvalue() {
# exit value changes at 100 and 12345678
myprog() { perl -e '$a=shift;if($a <= 123) { exit 0; }
else { exit ($a <= 12345678) }' "$@"; }
export -f myprog
# Finds 123
find-first-fail myprog
# Finds 12345678
find-first-fail -s 200 myprog
}
test_s_v_12() {
# Multiple options
myprog() { perl -e 'exit (shift > 12)' "$@"; }
export -f myprog
find-first-fail -v -s 10 myprog
find-first-fail -v -q -s 10 myprog
}
export -f $(compgen -A function | grep test_)
compgen -A function | grep test_ | LC_ALL=C sort |
parallel --timeout 1000% --tag -k --joblog /tmp/jl-`basename $0` '{} 2>&1'