Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tools - mkbuildoptglobals refactoring & attempt to fix caching#9249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
mcspr wants to merge22 commits intoesp8266:master
base:master
Choose a base branch
Loading
frommcspr:buildopts/refactoring
Open
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
22 commits
Select commitHold shift + click to select a range
8253d94
Tools - mkbuildoptglobals refactoring & attempt to fix caching
mcsprMay 27, 2025
8cdc906
compile args typo
mcsprMay 27, 2025
eac15af
build_out & no explicit clean
mcsprMay 27, 2025
60689bc
drop partial data, handle missing closing comment
mcsprMay 27, 2025
9be7e67
check cache state dir state in ci
mcsprMay 27, 2025
c3b64a2
missing file
mcsprMay 27, 2025
a527244
typo, fix err trap for "test ...something..."
mcsprMay 27, 2025
fe3102f
mention indirect and direct dependency on globals .h contents
mcsprMay 28, 2025
d72ca55
update doc
mcsprMay 28, 2025
35c6221
update docs
mcsprMay 28, 2025
d1c9c7b
restore command-line opts info, newlined debugging
mcsprMay 28, 2025
a3f9218
mkdir parent when writing
mcsprMay 28, 2025
56bac44
useless from None
mcsprMay 28, 2025
eb1a542
multiple quoting fixes from sc & naming
mcsprMay 28, 2025
a9afc33
spacing
mcsprMay 29, 2025
a91da86
$cache_dir & $root quoting
mcsprMay 29, 2025
7f06e65
debug flag passed as fqbn
mcsprJul 1, 2025
664e9d8
direct types
mcsprJul 1, 2025
78380e8
warnings fix v2, propogate errors instead
mcsprJul 1, 2025
2e63e3e
debugging in ci tool checks
mcsprJul 1, 2025
e023926
invalid debug lvl=
mcsprJul 1, 2025
0c67f33
rebase unused var
mcsprJul 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
check cache state dir state in ci
  • Loading branch information
@mcspr
mcspr committedJul 1, 2025
commit9be7e67d338d89bcdceec4fb5b31da529b7946a1
3 changes: 3 additions & 0 deletions.github/workflows/build-ide.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ jobs:
python-version: '3.x'
- run: |
python ./tools/test_mkbuildoptglobals.py --quiet
- run: |
bash ./tests/install_arduino.sh
bash ./tests/test_mkbuildoptglobals.sh run

# Examples are built in parallel to avoid CI total job time limitation
build-linux:
Expand Down
38 changes: 1 addition & 37 deletionstests/build.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,39 +3,7 @@
# expect to have git available
root=$(git rev-parse --show-toplevel)

# general configuration related to the builder itself
ESP8266_ARDUINO_BUILD_DIR=${ESP8266_ARDUINO_BUILD_DIR:-$root}
ESP8266_ARDUINO_BUILDER=${ESP8266_ARDUINO_BUILDER:-arduino}
ESP8266_ARDUINO_PRESERVE_CACHE=${ESP8266_ARDUINO_PRESERVE_CACHE:-}

# sketch build options
ESP8266_ARDUINO_DEBUG=${ESP8266_ARDUINO_DEBUG:-nodebug}
ESP8266_ARDUINO_LWIP=${ESP8266_ARDUINO_LWIP:-default}
ESP8266_ARDUINO_SKETCHES=${ESP8266_ARDUINO_SKETCHES:-}

ESP8266_ARDUINO_CLI=${ESP8266_ARDUINO_CLI:-$HOME/.local/bin/arduino-cli}

# ref. https://arduino.github.io/arduino-cli/1.2/configuration/#default-directories
case "${RUNNER_OS:-Linux}" in
"Linux")
ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:-$HOME/Arduino/hardware}
ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:-$HOME/Arduino/libraries}
;;
"macOS")
ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:-$HOME/Documents/Arduino/hardware}
ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:-$HOME/Documents/Arduino/libraries}
;;
"Windows")
ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:-$HOME/Documents/Arduino/hardware}
ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:-$HOME/Documents/Arduino/libraries}
;;
*)
echo 'Unknown ${RUNNER_OS} = "' ${RUNNER_OS} '"'
exit 2
esac

source "$root/tests/lib-skip-ino.sh"
source "$root/tests/common.sh"
source "$root/tests/env.sh"

cmd=${0##*/}
usage="
Expand All@@ -56,10 +24,6 @@ USAGE:
$cmd - build every .ino file from ESP8266_ARDUINO_SKETCHES
"

mod=1
rem=0
cnt=0

if [ "$#" -eq 1 ] ; then
case "$1" in
"-h")
Expand Down
8 changes: 8 additions & 0 deletionstests/install_arduino.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -x

root=$(git rev-parse --show-toplevel)
source "$root/tests/env.sh"

install_arduino "$ESP8266_ARDUINO_DEBUG"
112 changes: 112 additions & 0 deletionstests/test_mkbuildoptglobals.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
#!/usr/bin/env bash

root=$(git rev-parse --show-toplevel)
source "$root/tests/env.sh"

unset -f step_summary
function step_summary()
{
echo ""
}

export ARDUINO_BUILD_CACHE_PATH="$cache_dir"

sketches="${cache_dir}/sketches/"
cores="${cache_dir}/cores/"

esp8266_dir="${ESP8266_ARDUINO_BUILD_DIR}"
commonfileh="${esp8266_dir}/cores/esp8266/CommonHFile.h"

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

function name_size_mtime()
{
stat --printf '%n:%s:%Y' "$1"
}

function most_recent_file()
{
local name="$1"
local location="$2"
echo $(readlink -f "${location}/"$(ls -t1 "${location}" | grep "$name" | head -1))
}

function most_recent_dir()
{
local location="$1"
echo $(readlink -f "${location}/"$(ls -t1 "$location" | head -1))
}

function assert_build()
{
local name="$1"
local build_dir="$2"
local size_check="${3:-0}"

local build_opt="$build_dir"/sketch/build.opt
test -e "$build_opt"

local globals_h="$build_dir"/${name}.ino.globals.h
test -e "$globals_h"

if [ "$size_check" = "1" ] ; then
test -s "$build_opt"
test -s "$globals_h"
fi
}

function assert_core()
{
local size_check="$1"

if [ "$size_check" = "1" ] ; then
test -s "$commonfileh"
else
test ! -s "$commonfileh"
fi

}

function build_esp8266_example()
{
local name="$1"

ESP8266_ARDUINO_SKETCHES="$root/libraries/esp8266/examples/${name}/${name}.ino"
build_sketches_with_arduino "$ESP8266_ARDUINO_LWIP" "$mod" "$rem" "$cnt"
}

function make_commonh_stat()
{
local stat=$(name_size_mtime "$commonfileh")
test -n "$stat"

echo "$stat"
}

function make_core_stat()
{
local recent_core=$(most_recent_dir "$cores")
local recent_file=$(most_recent_file "core.a" "$recent_core")

local stat=$(name_size_mtime "$recent_file")
test -n "$stat"

echo "$stat"
}

case "${1:-}" in
"list")
printf "%s\n" $tests
;;

"run")
for test in $tests ; do
printf "Checking \"%s\"\n" "$test"
/usr/bin/env bash $root/tests/test_mkbuildoptglobals.sh $test
done
;;
*)
source "$tests_dir/${1}.sh"
;;
esac
25 changes: 25 additions & 0 deletionstests/test_mkbuildoptglobals/buildopt_then_buildopt.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
function buildopt_then_buildopt()
{
build_esp8266_example "GlobalBuildOptions"

local last_sketch=$(most_recent_dir "$sketches")
assert_build "GlobalBuildOptions" "$last_sketch" 1
assert_core 1

local globalbuildoptions_commonh_stat=$(make_commonh_stat)
local globalbuildoptions_core_stat=$(make_core_stat)

build_esp8266_example "HwdtStackDump"

last_sketch=$(most_recent_dir "$sketches")
assert_build "HwdtStackDump" "$last_sketch" 1
assert_core 1

local hwdtstackdump_commonh_stat=$(make_commonh_stat)
local hwdtstackdump_core_stat=$(make_core_stat)

test "$hwdtstackdump_commonh_stat" != "$globalbuildoptions_commonh_stat"
test "$hwdtstackdump_core_stat" != "$globalbuildoptions_core_stat"
}

buildopt_then_buildopt
25 changes: 25 additions & 0 deletionstests/test_mkbuildoptglobals/buildopt_then_nobuildopt.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
function buildopt_then_nobuildopt()
{
build_esp8266_example "GlobalBuildOptions"

local last_sketch=$(most_recent_dir "$sketches")
assert_build "GlobalBuildOptions" "$last_sketch" 1
assert_core 1

local globalbuildoptions_commonh_stat=$(make_commonh_stat)
local globalbuildoptions_core_stat=$(make_core_stat)

build_esp8266_example "Blink"

last_sketch=$(most_recent_dir "$sketches")
assert_build "Blink" "$last_sketch" 0
assert_core 0

local blink_commonh_stat=$(make_commonh_stat)
local blink_core_stat=$(make_core_stat)

test "$globalbuildoptions_commonh_stat" != "$blink_commonh_stat"
test "$globalbuildoptions_core_stat" != "$blink_core_stat"
}

buildopt_then_nobuildopt
25 changes: 25 additions & 0 deletionstests/test_mkbuildoptglobals/nobuildopt.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
function nobuildopt()
{
build_esp8266_example "Blink"

local last_sketch=$(most_recent_dir "$sketches")
assert_build "Blink.ino" "$last_sketch" 0
assert_core 0

local blink_commonh_stat=$(make_commonh_stat)
local blink_core_stat=$(make_core_stat)

build_esp8266_example "TestEspApi"

last_sketch=$(most_recent_dir "$sketches")
assert_build "TestEspApi" "$last_sketch" 0
assert_core 0

local testespapi_commonh_stat=$(make_commonh_stat)
local testespapi_core_stat=$(make_core_stat)

test "$blink_commonh_stat" = "$testespapi_commonh_stat"
test "$blink_core_stat" = "$testespapi_core_stat"
}

nobuildopt
25 changes: 25 additions & 0 deletionstests/test_mkbuildoptglobals/nobuildopt_then_buildopt.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
function nobuildopt_then_buildopt()
{
build_esp8266_example "Blink"

local last_sketch=$(most_recent_dir "$sketches")
assert_build "Blink" "$last_sketch" 0
assert_core 0

local blink_commonh_stat=$(make_commonh_stat)
local blink_core_stat=$(make_core_stat)

build_esp8266_example "HwdtStackDump"

last_sketch=$(most_recent_dir "$sketches")
assert_build "HwdtStackDump" "$last_sketch" 1
assert_core 1

local hwdtstackdump_commonh_stat=$(make_commonh_stat)
local hwdtstackdump_core_stat=$(make_core_stat)

test "$hwdtstackdump_commonh_stat" != "$blink_commonh_stat"
test "$hwdtstackdump_core_stat" != "$blink_core_stat"
}

nobuildopt_then_buildopt

[8]ページ先頭

©2009-2025 Movatter.jp