mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
idf_size: Support JSON output
Pass -DOUTPUT_JSON=1 to get JSON formatted output from CMake targets
This commit is contained in:
committed by
Angus Gratton
parent
80fb837b29
commit
05be37c87c
File diff suppressed because it is too large
Load Diff
@@ -2,11 +2,23 @@
|
||||
|
||||
{ coverage debug sys \
|
||||
&& coverage erase &> output \
|
||||
&& echo -e "\n***\nRunning idf_size.py..." >> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py app.map &>> output \
|
||||
&& echo -e "\n***\nRunning idf_size.py --archives..." >> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --archives app.map &>> output \
|
||||
&& echo -e "\n***\nRunning idf_size.py --files..." >> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --files app.map &>> output \
|
||||
&& echo -e "\n***\nRunning idf_size.py --archive_details..." >> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --archive_details libdriver.a app.map &>> output \
|
||||
&& echo -e "\n***]nProducing JSON output..." >> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json app.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --archives app.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --files app.map &>> output \
|
||||
&& coverage run -a $IDF_PATH/tools/idf_size.py --json --archive_details libdriver.a app.map &>> output \
|
||||
&& echo -e "\n***\nRunning idf_size_tests.py..." >> output \
|
||||
&& coverage run -a $IDF_PATH/tools/test_idf_size/test_idf_size.py &>> output \
|
||||
&& diff output expected_output \
|
||||
&& diff -Z output expected_output \
|
||||
&& coverage report \
|
||||
; } || { echo 'The test for idf_size has failed. Please examine the artifacts.' ; exit 1; }
|
||||
|
||||
# Note: "diff -Z is used because some versions of Python print trailing whitespace for JSON pretty-printing, and some don't
|
||||
|
||||
@@ -24,18 +24,19 @@ except ImportError:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Should deliver a RuntimeError as the 'test' header doesn't exist
|
||||
try:
|
||||
idf_size.scan_to_header([], 'test')
|
||||
except RuntimeError:
|
||||
pass
|
||||
except RuntimeError as e:
|
||||
assert "Didn't find line" in str(e)
|
||||
|
||||
# Should deliver a RuntimeError as there's no content under the heading
|
||||
try:
|
||||
idf_size.load_memory_config(["Memory Configuration"])
|
||||
pass
|
||||
except RuntimeError:
|
||||
pass
|
||||
except RuntimeError as e:
|
||||
assert "End of file" in str(e)
|
||||
|
||||
try:
|
||||
idf_size.print_summary({"iram0_0_seg": {"length":0}, "dram0_0_seg": {"length":0}}, {})
|
||||
except ZeroDivisionError:
|
||||
pass
|
||||
# This used to crash with a division by zero error but now it just prints nan% due to
|
||||
# zero lengths
|
||||
idf_size.print_summary({"iram0_0_seg": {"length":0}, "dram0_0_seg": {"length":0}}, {})
|
||||
|
||||
Reference in New Issue
Block a user