New options to only run assert or competion tests
New tests for missing permissions
This commit is contained in:
@@ -27,6 +27,8 @@ readonly color_less='\033[0m'
|
|||||||
flag_runall=0
|
flag_runall=0
|
||||||
flag_extendedOutput=0
|
flag_extendedOutput=0
|
||||||
flag_verbose=0
|
flag_verbose=0
|
||||||
|
flag_onlyassert=0
|
||||||
|
flag_onlycompete=0
|
||||||
|
|
||||||
toassert=()
|
toassert=()
|
||||||
tocompete=()
|
tocompete=()
|
||||||
@@ -102,9 +104,18 @@ rl::test() {
|
|||||||
flag_extendedOutput=1
|
flag_extendedOutput=1
|
||||||
flag_verbose=1
|
flag_verbose=1
|
||||||
shift ;;
|
shift ;;
|
||||||
|
-oa|--only-assert)
|
||||||
|
flag_onlyassert=1
|
||||||
|
shift ;;
|
||||||
|
-oc|--only-compete)
|
||||||
|
flag_onlycompete=1
|
||||||
|
shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
(( flag_onlyassert )) && tocompete=()
|
||||||
|
(( flag_onlycompete )) && toassert=()
|
||||||
|
|
||||||
# Only run `compete_args` if arguments are available
|
# Only run `compete_args` if arguments are available
|
||||||
if [[ "$@" ]]; then
|
if [[ "$@" ]]; then
|
||||||
compete_args=( "Tests from command line" "$@" )
|
compete_args=( "Tests from command line" "$@" )
|
||||||
@@ -113,7 +124,7 @@ rl::test() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Compare against expected result
|
# Compare against expected result
|
||||||
printf "\n# Assertion tests (\"Expected path\" == rdlink)\n"
|
(( ${#toassert[@]} )) && printf "\n# Assertion tests (\"Expected path\" == rdlink)\n"
|
||||||
for testarray in "${toassert[@]}"; do
|
for testarray in "${toassert[@]}"; do
|
||||||
i=0
|
i=0
|
||||||
arraywalker="$testarray"[@]
|
arraywalker="$testarray"[@]
|
||||||
@@ -143,7 +154,7 @@ rl::test() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Compare output of rdlink and readlink -f
|
# Compare output of rdlink and readlink -f
|
||||||
printf "\n# Competition tests (readlink -f == rdlink)\n"
|
(( ${#tocompete[@]} )) && printf "\n# Competition tests (readlink -f == rdlink)\n"
|
||||||
for testarray in "${tocompete[@]}"; do
|
for testarray in "${tocompete[@]}"; do
|
||||||
i=0
|
i=0
|
||||||
arraywalker="$testarray"[@]
|
arraywalker="$testarray"[@]
|
||||||
|
@@ -35,6 +35,13 @@ tocompete_init() {
|
|||||||
touch "${_tc_tmp}/a"
|
touch "${_tc_tmp}/a"
|
||||||
ln -s "${_tc_tmp}/a" "${_tc_tmp}/a 2"
|
ln -s "${_tc_tmp}/a" "${_tc_tmp}/a 2"
|
||||||
ln -s "${_tc_tmp}/a 2" "${_tc_tmp}/a 3"
|
ln -s "${_tc_tmp}/a 2" "${_tc_tmp}/a 3"
|
||||||
|
|
||||||
|
# compete_no_permission
|
||||||
|
mkdir -p "${_tc_tmp}/noperm"
|
||||||
|
chmod 400 "${_tc_tmp}/noperm"
|
||||||
|
ln -s "noperm" "${_tc_tmp}/lnoperm"
|
||||||
|
|
||||||
|
#ls -l "${_tc_tmp}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Base directory for the test
|
# Base directory for the test
|
||||||
@@ -50,8 +57,14 @@ tocompete_init() {
|
|||||||
"/bin/adb"
|
"/bin/adb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
compete_no_permission=( "No permission to enter directory (direct and link)"
|
||||||
|
"noperm"
|
||||||
|
"lnoperm"
|
||||||
|
)
|
||||||
|
|
||||||
# Add tests to global test array from test_rdlink
|
# Add tests to global test array from test_rdlink
|
||||||
tocompete+=(
|
tocompete+=(
|
||||||
|
compete_no_permission
|
||||||
compete_links
|
compete_links
|
||||||
compete_canonicalize
|
compete_canonicalize
|
||||||
#compete_all
|
#compete_all
|
||||||
|
Reference in New Issue
Block a user