Skip to content

Commit e6ba353

Browse files
committed
enable the last skipped tests from binutils-esp32ulp
Everything necessary to pass previously skipped binutils-esp32ulp tests is now fixed. So we no longer need to skip them. (Tests using unsupported features, such as assembler macros, are still skipped.) Note 1: There is one test, esp32ulp_ranges.s, which requires symbols defined in esp32ulp_globals.s. binutils-esp32ulp joins these during the linking stage in its test scripts. Since we don't separate stages, we simply concatenate the two files before assembly. Note 2: binutils-esp32ulp has a bug related to how absolute symbols defined with .set are interpreted by the JUMP instruction. If a symbol is marked global, the value is taken as-is, but if a symbol is not global, it's value is divided by 4. Since py-esp32-ulp treats the symbol value the same, whether global or not (the believed correct behaviour), we work around the bug in our test script and patch the input files to make the relevant symbols global.
1 parent e3597a7 commit e6ba353

File tree

1 file changed

+48
-11
lines changed

1 file changed

+48
-11
lines changed

tests/02_compat_rtc_tests.sh

+48-11
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,42 @@ build_defines_db() {
5151
esp-idf/components/esp_common/include/*.h 1>$log_file
5252
}
5353

54+
patch_test() {
55+
local test_name=$1
56+
local out_file="${test_name}.tmp"
57+
58+
if [ "${test_name}" = esp32ulp_jumpr ]; then
59+
(
60+
cd binutils-esp32ulp/gas/testsuite/gas/esp32ulp/esp32
61+
cp ${test_name}.s ${out_file}
62+
echo -e "\tPatching test to work around binutils-esp32ulp .global bug"
63+
cat >> ${out_file} <<EOF
64+
.global check_jump1
65+
EOF
66+
)
67+
return 0
68+
69+
elif [ "${test_name}" = esp32ulp_ranges ]; then
70+
(
71+
cd binutils-esp32ulp/gas/testsuite/gas/esp32ulp/esp32
72+
# merge 2 files: https://github.com/espressif/binutils-esp32ulp/blob/249ec34/gas/testsuite/gas/esp32ulp/esp32/check_as_ld.sh#L31
73+
echo -e "\t${test_name} requires esp32ulp_globals. Merging both files into ${out_file}"
74+
cat esp32ulp_globals.s ${test_name}.s > ${out_file}
75+
echo -e "\tPatching test to work around binutils-esp32ulp .global bug"
76+
cat >> ${out_file} <<EOF
77+
.global min_add
78+
.global min_jump1
79+
.global max_jump1
80+
.global min_jumpr1
81+
.global max_jumpr1
82+
EOF
83+
)
84+
return 0
85+
fi
86+
87+
return 1 # nothing was patched
88+
}
89+
5490
make_log_dir
5591
fetch_esp_idf
5692
fetch_ulptool_examples
@@ -60,21 +96,12 @@ build_defines_db $1
6096
for src_file in ulptool/src/ulp_examples/*/*.s binutils-esp32ulp/gas/testsuite/gas/esp32ulp/esp32/*.s; do
6197

6298
src_name="${src_file%.s}"
99+
src_dir="${src_name%/*}"
63100

64101
echo "Testing $src_file"
65102

66103
test_name="${src_name##*/}"
67104

68-
# for now, skip files that contain known bugs in esp32_ulp (essentially a todo list of what to fix)
69-
for I in esp32ulp_jumpr esp32ulp_ranges; do
70-
if [ "${test_name}" = "$I" ]; then
71-
# these are old bugs, and not related to the RTC macro handling functionality
72-
# they will still be great to fix over time
73-
echo -e "\tSkipping... known bugs in esp32_ulp"
74-
continue 2
75-
fi
76-
done
77-
78105
# for now, skip files that contain unsupported things (macros)
79106
for I in i2c i2c_dev stack i2c_wr test1 test_jumpr test_macro; do
80107
if [ "${test_name}" = "$I" ]; then
@@ -83,8 +110,18 @@ for src_file in ulptool/src/ulp_examples/*/*.s binutils-esp32ulp/gas/testsuite/g
83110
fi
84111
done
85112

86-
echo -e "\tBuilding using py-esp32-ulp"
113+
# BEGIN: work around known issues with binutils-esp32ulp
87114
ulp_file="${src_name}.ulp"
115+
116+
if patch_test ${test_name}; then
117+
# switch to the patched file instead of original one
118+
src_file="${src_dir}/${test_name}.tmp"
119+
src_name="${src_file%.tmp}"
120+
ulp_file="${src_name}.tmp.ulp" # when extension is not .s, py-esp32-ulp doesn't remove original extension
121+
fi
122+
# END: work around known issues with binutils-esp32ulp
123+
124+
echo -e "\tBuilding using py-esp32-ulp"
88125
log_file="${src_name}.log"
89126
micropython -m esp32_ulp $src_file 1>$log_file # generates $ulp_file
90127

0 commit comments

Comments
 (0)