summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-07-13 14:59:36 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-07-13 14:59:36 -0400
commit2a4d320e7306484613723f97d1b194c988d23d51 (patch)
treea56f39b7338f81b1d5da5e105cd939f2cfdf18cd
parentf32acaf99c209c1fd7623cc7dc827fec52979d76 (diff)
downloadbfs-2a4d320e7306484613723f97d1b194c988d23d51.tar.xz
tests: Optimize startup
./tests.sh is about 110ms faster on my machine with this patch.
-rwxr-xr-xtests/tests.sh28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/tests.sh b/tests/tests.sh
index 7854a65..5254311 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -32,14 +32,14 @@ export LS_COLORS=""
unset BFS_COLORS
if [ -t 1 ]; then
- BLD=$(printf '\033[01m')
- RED=$(printf '\033[01;31m')
- GRN=$(printf '\033[01;32m')
- YLW=$(printf '\033[01;33m')
- BLU=$(printf '\033[01;34m')
- MAG=$(printf '\033[01;35m')
- CYN=$(printf '\033[01;36m')
- RST=$(printf '\033[0m')
+ BLD=$'\033[01m'
+ RED=$'\033[01;31m'
+ GRN=$'\033[01;32m'
+ YLW=$'\033[01;33m'
+ BLU=$'\033[01;34m'
+ MAG=$'\033[01;35m'
+ CYN=$'\033[01;36m'
+ RST=$'\033[0m'
fi
UNAME=$(uname)
@@ -1058,17 +1058,17 @@ function make_deep() {
name="${name}${name}${name}${name}"
name="${name:0:255}"
+ # 4 * 4 * 256 - 1 == 4095 == PATH_MAX - 1
+ local names="$name/$name/$name/$name"
+ names="$names/$names/$names/$names"
+
for i in {0..9} A B C D E F; do
(
mkdir "$1/$i"
cd "$1/$i"
- # 16 * 256 == 4096 == PATH_MAX
- for _ in {1..16}; do
- mkdir "$name"
- cd "$name" 2>/dev/null
- done
-
+ mkdir -p "$names"
+ cd "$names"
$TOUCH "$name"
)
done