Skip to content

Commit b0add82

Browse files
committed
multiple quoting fixes from sc & naming
1 parent 22c919b commit b0add82

File tree

6 files changed

+49
-35
lines changed

6 files changed

+49
-35
lines changed

tests/common.sh

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function step_summary()
4040
# ref. https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary
4141
if [ -n "${GITHUB_STEP_SUMMARY-}" ]; then
4242
{ echo "# $header"; echo '```console'; cat "$contents"; echo '```'; } \
43-
>> $GITHUB_STEP_SUMMARY
43+
>> "$GITHUB_STEP_SUMMARY"
4444
else
4545
echo "# $header"
4646
cat "$contents"
@@ -55,7 +55,7 @@ function print_size_info_header()
5555

5656
function print_size_info()
5757
{
58-
local awk_script='
58+
local awk_script=$'
5959
/^\.data/ || /^\.rodata/ || /^\.bss/ || /^\.text/ || /^\.irom0\.text/{
6060
size[$1] = $2
6161
}
@@ -110,9 +110,9 @@ function format_fqbn()
110110
local flash_size=$2
111111
local lwip=$3
112112

113-
echo "esp8266com:esp8266:${board_name}:"\
114-
"eesz=${flash_size},"\
115-
"ip=${lwip}"
113+
echo $"esp8266com:esp8266:${board_name}:
114+
eesz=${flash_size},
115+
ip=${lwip}"
116116
}
117117

118118
function build_sketches()
@@ -131,16 +131,17 @@ function build_sketches()
131131
local build_out="$cache_dir"/out
132132
mkdir -p "$build_out"
133133

134-
local fqbn=$(format_fqbn "generic" "4M1M" "$lwip")
134+
local fqbn
135+
fqbn=$(format_fqbn "generic" "4M1M" "$lwip")
135136
echo "FQBN: $fqbn"
136137

137138
local build_cmd
138-
build_cmd+=${cli_path}
139-
build_cmd+=" compile"\
140-
" --warnings=all"\
141-
" --fqbn $fqbn"\
142-
" --libraries $library_path"\
143-
" --output-dir $build_out"
139+
build_cmd=$''"${cli_path}"'
140+
compile
141+
--warnings=all
142+
--fqbn '"$fqbn"'
143+
--libraries '"$library_path"'
144+
--output-dir '"$build_out"''
144145

145146
print_size_info_header >"$cache_dir"/size.log
146147

@@ -300,9 +301,9 @@ function install_core()
300301

301302
local debug_flags=""
302303
if [ "$debug" = "debug" ]; then
303-
debug_flags="-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM"\
304-
" -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI"\
305-
" -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM"
304+
debug_flags=$'-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM
305+
-DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI
306+
-DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM'
306307
fi
307308

308309
# Set our custom warnings for all builds

tests/test_mkbuildoptglobals.sh

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ function step_summary()
1313

1414
export ARDUINO_BUILD_CACHE_PATH="$cache_dir"
1515

16-
sketches="${cache_dir}/sketches/"
17-
cores="${cache_dir}/cores/"
18-
1916
esp8266_dir="${ESP8266_ARDUINO_BUILD_DIR}"
2017
commonfileh="${esp8266_dir}/cores/esp8266/CommonHFile.h"
2118

2219
tests_dir="$root/tests/test_mkbuildoptglobals"
2320
tests=$(ls -1 "$tests_dir" | sed 's/.sh$//g')
2421

22+
cores_dir="${cache_dir}/cores/"
23+
sketches_dir="${cache_dir}/sketches/"
24+
2525
function name_size_mtime()
2626
{
2727
stat --printf '%n:%s:%Y' "$1"
@@ -31,13 +31,21 @@ function most_recent_file()
3131
{
3232
local name="$1"
3333
local location="$2"
34-
echo $(readlink -f "${location}/"$(ls -t1 "${location}" | grep "$name" | head -1))
34+
35+
local file
36+
file=$(ls -t1 "${location}" | grep "$name" | head -1)
37+
38+
readlink -f "${location}/${file}"
3539
}
3640

3741
function most_recent_dir()
3842
{
3943
local location="$1"
40-
echo $(readlink -f "${location}/"$(ls -t1 "$location" | head -1))
44+
45+
local file
46+
file=$(ls -t1 "$location" | head -1)
47+
48+
readlink -f "${location}/${file}"
4149
}
4250

4351
function assert_build()
@@ -80,20 +88,25 @@ function build_esp8266_example()
8088

8189
function make_commonh_stat()
8290
{
83-
local stat=$(name_size_mtime "$commonfileh")
84-
test -n "$stat"
91+
local stat
92+
stat=$(name_size_mtime "$commonfileh")
8593

94+
test -n "$stat"
8695
echo "$stat"
8796
}
8897

8998
function make_core_stat()
9099
{
91-
local recent_core=$(most_recent_dir "$cores")
92-
local recent_file=$(most_recent_file "core.a" "$recent_core")
100+
local recent_core
101+
recent_core=$(most_recent_dir "$cores_dir")
93102

94-
local stat=$(name_size_mtime "$recent_file")
95-
test -n "$stat"
103+
local recent_file
104+
recent_file=$(most_recent_file "core.a" "$recent_core")
96105

106+
local stat
107+
stat=$(name_size_mtime "$recent_file")
108+
109+
test -n "$stat"
97110
echo "$stat"
98111
}
99112

@@ -105,7 +118,7 @@ case "${1:-}" in
105118
"run")
106119
for test in $tests ; do
107120
printf "Checking \"%s\"\n" "$test"
108-
/usr/bin/env bash $root/tests/test_mkbuildoptglobals.sh $test
121+
/usr/bin/env bash "$root"/tests/test_mkbuildoptglobals.sh "$test"
109122
done
110123
;;
111124
*)

tests/test_mkbuildoptglobals/buildopt_then_buildopt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function buildopt_then_buildopt()
22
{
33
build_esp8266_example "GlobalBuildOptions"
44

5-
local last_sketch=$(most_recent_dir "$sketches")
5+
local last_sketch=$(most_recent_dir "$sketches_dir")
66
assert_build "GlobalBuildOptions" "$last_sketch" 1
77
assert_core 1
88

@@ -11,7 +11,7 @@ function buildopt_then_buildopt()
1111

1212
build_esp8266_example "HwdtStackDump"
1313

14-
last_sketch=$(most_recent_dir "$sketches")
14+
last_sketch=$(most_recent_dir "$sketches_dir")
1515
assert_build "HwdtStackDump" "$last_sketch" 1
1616
assert_core 1
1717

tests/test_mkbuildoptglobals/buildopt_then_nobuildopt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function buildopt_then_nobuildopt()
22
{
33
build_esp8266_example "GlobalBuildOptions"
44

5-
local last_sketch=$(most_recent_dir "$sketches")
5+
local last_sketch=$(most_recent_dir "$sketches_dir")
66
assert_build "GlobalBuildOptions" "$last_sketch" 1
77
assert_core 1
88

@@ -11,7 +11,7 @@ function buildopt_then_nobuildopt()
1111

1212
build_esp8266_example "Blink"
1313

14-
last_sketch=$(most_recent_dir "$sketches")
14+
last_sketch=$(most_recent_dir "$sketches_dir")
1515
assert_build "Blink" "$last_sketch" 0
1616
assert_core 0
1717

tests/test_mkbuildoptglobals/nobuildopt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function nobuildopt()
22
{
33
build_esp8266_example "Blink"
44

5-
local last_sketch=$(most_recent_dir "$sketches")
5+
local last_sketch=$(most_recent_dir "$sketches_dir")
66
assert_build "Blink" "$last_sketch" 0
77
assert_core 0
88

@@ -11,7 +11,7 @@ function nobuildopt()
1111

1212
build_esp8266_example "TestEspApi"
1313

14-
last_sketch=$(most_recent_dir "$sketches")
14+
last_sketch=$(most_recent_dir "$sketches_dir")
1515
assert_build "TestEspApi" "$last_sketch" 0
1616
assert_core 0
1717

tests/test_mkbuildoptglobals/nobuildopt_then_buildopt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function nobuildopt_then_buildopt()
22
{
33
build_esp8266_example "Blink"
44

5-
local last_sketch=$(most_recent_dir "$sketches")
5+
local last_sketch=$(most_recent_dir "$sketches_dir")
66
assert_build "Blink" "$last_sketch" 0
77
assert_core 0
88

@@ -11,7 +11,7 @@ function nobuildopt_then_buildopt()
1111

1212
build_esp8266_example "HwdtStackDump"
1313

14-
last_sketch=$(most_recent_dir "$sketches")
14+
last_sketch=$(most_recent_dir "$sketches_dir")
1515
assert_build "HwdtStackDump" "$last_sketch" 1
1616
assert_core 1
1717

0 commit comments

Comments
 (0)