Skip to content

Commit 69982cc

Browse files
committed
$cache_dir & $root quoting
1 parent ca3c0de commit 69982cc

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

tests/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ root=$(git rev-parse --show-toplevel)
66
source "$root/tests/env.sh"
77

88
cmd=${0##*/}
9-
usage="
9+
usage=$"
1010
ENVIRONMENT:
1111
ESP8266_ARDUINO_SKETCHES - list of .ino files; defaults to **all available examples**
1212
ESP8266_ARDUINO_BUILDER - arduino or platformio

tests/common.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ END {
7474
local elf_file=$2
7575

7676
local elf_name
77-
elf_name=$(basename $elf_file)
77+
elf_name=$(basename "$elf_file")
7878
$size --format=sysv "$elf_file" | \
7979
awk -v sketch_name="${elf_name%.*}" "$awk_script" -
8080
}
@@ -251,8 +251,8 @@ function install_library()
251251
local url=$6
252252

253253
fetch_and_unpack "$archive" "$hash" "$url"
254-
mkdir -p "$lib_path"
255-
rm -rf "$lib_path/$name"
254+
mkdir -p "${lib_path:?}"
255+
rm -rf "${lib_path}/${name:?}"
256256
mv "$extract" "$lib_path/$name"
257257
}
258258

@@ -264,7 +264,7 @@ function install_libraries()
264264
mkdir -p "$core_path"/tools/dist
265265
pushd "$core_path"/tools/dist
266266

267-
source "$root/tests/dep-libraries.sh"
267+
source "${root:?}"/tests/dep-libraries.sh
268268

269269
popd
270270
}
@@ -279,14 +279,17 @@ function install_arduino_cli()
279279

280280
echo "Arduino CLI ${ver}"
281281

282-
mkdir -p ${core_path}/dist
283-
pushd ${core_path}/dist
282+
mkdir -p "${core_path}"/dist
283+
pushd "${core_path}"/dist
284284

285285
source "$root/tests/dep-arduino-cli.sh"
286286

287-
mkdir -p $(dirname $path)
288-
cp -v arduino-cli $path
289-
chmod +x $path
287+
local path_dir
288+
path_dir=$(dirname "$path")
289+
290+
mkdir -p "$path_dir"
291+
cp -v arduino-cli "$path"
292+
chmod +x "$path"
290293

291294
popd
292295
}
@@ -311,7 +314,7 @@ function install_core()
311314
"compiler.c.extra_flags=-Wall -Wextra $debug_flags" \
312315
"compiler.cpp.extra_flags=-Wall -Wextra $debug_flags" \
313316
"recipe.hooks.prebuild.1.pattern=\"{runtime.tools.python3.path}/python3\" -I \"{runtime.tools.makecorever}\" --git-root \"{runtime.platform.path}\" --version \"{version}\" \"{runtime.platform.path}/cores/esp8266/core_version.h\"" \
314-
> ${core_path}/platform.local.txt
317+
> "${core_path}"/platform.local.txt
315318
echo -e "\n----platform.local.txt----"
316319
cat platform.local.txt
317320
echo -e "\n----\n"
@@ -432,7 +435,7 @@ function install_platformio()
432435

433436
local board=$1
434437

435-
pushd $ESP8266_ARDUINO_BUILD_DIR/tools
438+
pushd "$ESP8266_ARDUINO_BUILD_DIR"/tools
436439
python3 get.py -q
437440
popd
438441

@@ -446,7 +449,7 @@ function install_platformio()
446449
local toolchain_symlink="toolchain-xtensa @ symlink://${ESP8266_ARDUINO_BUILD_DIR}/tools/xtensa-lx106-elf/"
447450

448451
# pre-generate config; pio-ci with multiple '-O' options replace each other instead of appending to the same named list
449-
cat <<EOF > $cache_dir/platformio.ini
452+
cat <<EOF > "$cache_dir"/platformio.ini
450453
[platformio]
451454
lib_dir =
452455
${ESP8266_ARDUINO_LIBRARIES}

0 commit comments

Comments
 (0)