diff --git a/UNIT_TESTS/OLD/.forkrun.unit-tests.sorting.new.bash.swo b/UNIT_TESTS/OLD/.forkrun.unit-tests.sorting.new.bash.swo new file mode 100644 index 0000000..950f0d6 Binary files /dev/null and b/UNIT_TESTS/OLD/.forkrun.unit-tests.sorting.new.bash.swo differ diff --git a/UNIT_TESTS/forkrun.unit-tests.sorting.bash b/UNIT_TESTS/OLD/forkrun.unit-tests.sorting.bash similarity index 100% rename from UNIT_TESTS/forkrun.unit-tests.sorting.bash rename to UNIT_TESTS/OLD/forkrun.unit-tests.sorting.bash diff --git a/UNIT_TESTS/forkrun.unit-tests.sorting.forked.bash b/UNIT_TESTS/OLD/forkrun.unit-tests.sorting.forked.bash similarity index 100% rename from UNIT_TESTS/forkrun.unit-tests.sorting.forked.bash rename to UNIT_TESTS/OLD/forkrun.unit-tests.sorting.forked.bash diff --git a/UNIT_TESTS/OLD/forkrun.unit-tests.sorting.new.bash.old b/UNIT_TESTS/OLD/forkrun.unit-tests.sorting.new.bash.old new file mode 100755 index 0000000..bd334c9 --- /dev/null +++ b/UNIT_TESTS/OLD/forkrun.unit-tests.sorting.new.bash.old @@ -0,0 +1,54 @@ +#!/bin/bash + +#testDir='/usr' +useRamdiskFlag=true + +################################################################################ + +: "${testDir:=/usr}" "${useRamdiskFlag:=false}" + +[[ ${useRamdiskFlag} == 'true' ]] || useRamdiskFlag=false +[[ -d "${testDir}" ]] || { printf '\n\nERROR: can not access "%s". Perhaps due to permissions issues?\n\nABORTING\n\n' "${testDir}"; exit 1; } + +unset forkrun +{ [[ -f ./forkrun.bash ]] && source ./forkrun.bash; } +declare -F forkrun &>/dev/null || source <(curl https://raw.githubusercontent.com/jkool702/forkrun/main/forkrun.bash) +declare -F forkrun &>/dev/null || { [[ -f ./forkrun.bash ]] && source ./forkrun.bash; } + +which nproc 1>/dev/null 2>/dev/null && nProcs=$(nproc) || nProcs=8 + +if ${useRamdiskFlag}; then + mkdir -p /mnt/ramdisk/ + grep -qF '/mnt/ramdisk' <</dev/null\ -q\ -B\ -E\ -Z\ -d\ -a\ -b\ -w\ \<\(printf\ \'%s\\n\'\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ "${runArgs}"\ "${fStr[$fInd]}"\ "${fFix[$fInd]}"\ "${kFix[$kInd]}"\ \)\ \<\(printf\ \'%s\\n\'\ \"\$\{C\[@\]\}\"\ "${kFix[$kInd]}"\)\ \&\&\ printf\ \'%s\'\ \"PASS\"\ \|\|\ printf\ \'%s\'\ \"FAIL\"\;\ printf\ \'\:\ %s\\n\'\ \'printf\ \'\"\'\"\'%s\\n\'\"\'\"\'\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ "${runArgs}"\ "${fStr[$fInd]}"\'\;\ \}\ \|\ tee\ -a\ /tmp/.forkrun.log\;\ \)$'\n';) + + source <(printf '%s' \(\ \{\ diff\ 2\>/dev/null\ -q\ -B\ -E\ -Z\ -d\ -a\ -b\ -w\ \<\(printf\ \'%s\\x00\'\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ -z\ "${runArgs}"\ "${fStr[$fInd]}"\ "${fFix[$fInd]}"\ "${kFix[$kInd]}"\ \)\ \<\(printf\ \'%s\\n\'\ \"\$\{C\[@\]\}\"\ "${kFix[$kInd]}"\)\ \&\&\ printf\ \'%s\'\ \"PASS\"\ \|\|\ printf\ \'%s\'\ \"FAIL\"\;\ printf\ \'\:\ %s\\n\'\ \'printf\ \'\"\'\"\'%s\\0\'\"\'\"\'\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ -z\ "${runArgs}"\ "${fStr[$fInd]}"\'\;\ \}\ \|\ tee\ -a\ /tmp/.forkrun.log\;\ \)$'\n';) + done + done +done diff --git a/UNIT_TESTS/forkrun.unit-tests.sorting.new.bash b/UNIT_TESTS/forkrun.unit-tests.sorting.new.bash index 07824af..174e07c 100755 --- a/UNIT_TESTS/forkrun.unit-tests.sorting.new.bash +++ b/UNIT_TESTS/forkrun.unit-tests.sorting.new.bash @@ -19,17 +19,17 @@ which nproc 1>/dev/null 2>/dev/null && nProcs=$(nproc) || nProcs=8 if ${useRamdiskFlag}; then mkdir -p /mnt/ramdisk/ - cat /proc/mounts | grep -F '/mnt/ramdisk' || mount -t tmpfs tmpfs /mnt/ramdisk + grep -qF '/mnt/ramdisk' <</dev/null\ -q\ -B\ -E\ -Z\ -d\ -a\ -b\ -w\ \<\(printf\ \'%s\\n\'\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ "${runArgs}"\ "${fFix[$fInd]}"\ "${kFix[$kInd]}"\ \)\ \<\(printf\ \'%s\\n\'\ \"\$\{C\[@\]\}\"\)\ \&\&\ printf\ \'%s\'\ \"PASS\"\ \|\|\ printf\ \'%s\'\ \"FAIL\"\;\ printf \': %s\\n\'\ \'printf\ \'\"\'\"\'%s\\n\'\"\'\"\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ "${runArgs}"\;\ \}\ \|\ tee -a /tmp/.forkrun.log\;\ \)$'\n';) + source <(printf '%s' \(\ \{\ diff\ 2\>/dev/null\ -q\ -B\ -E\ -Z\ -d\ -a\ -b\ -w\ \<\(printf\ \'%s\\n\'\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ "${runArgs}"\ "${fFix[$fInd]}"\ "${kFix[$kInd]}"\ \)\ \<\(printf\ \'%s\\n\'\ \"\$\{C\[@\]\}\"\ "${kFix[$kInd]}"\)\ \&\&\ printf\ \'%s\'\ \"PASS\"\ \|\|\ printf\ \'%s\'\ \"FAIL\"\;\ printf\ \'\:\ %s\\n\'\ \'printf\ \'\"\'\"\'%s\\n\'\"\'\"\'\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ "${runArgs}"\ \'\;\ \}\ \|\ tee\ -a\ /tmp/.forkrun.log\;\ \)$'\n';) + source <(printf '%s' \(\ \{\ diff\ 2\>/dev/null\ -q\ -B\ -E\ -Z\ -d\ -a\ -b\ -w\ \<\(printf\ \'%s\\x00\'\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ -z\ "${runArgs}"\ "${fFix[$fInd]}"\ "${kFix[$kInd]}"\ \)\ \<\(printf\ \'%s\\n\'\ \"\$\{C\[@\]\}\"\ "${kFix[$kInd]}"\)\ \&\&\ printf\ \'%s\'\ \"PASS\"\ \|\|\ printf\ \'%s\'\ \"FAIL\"\;\ printf\ \'\:\ %s\\n\'\ \'printf\ \'\"\'\"\'%s\\0\'\"\'\"\'\ \"\$\{C\[@\]\}\"\ \|\ forkrun\ 2\>/dev/null\ -z\ "${runArgs}"\ \'\;\ \}\ \|\ tee\ -a\ /tmp/.forkrun.log\;\ \)$'\n';) done done done +