mirror of
https://github.com/esphome/esphome.git
synced 2026-05-30 07:16:11 +08:00
[tests] Fix -Wformat= mismatches in test YAML lambdas/logger.log (#16435)
This commit is contained in:
committed by
Jesse Hills
parent
dd1818661c
commit
d5c6efb2fe
@@ -506,13 +506,13 @@ async def _late_logger_init(config: ConfigType) -> None:
|
|||||||
def validate_printf(value):
|
def validate_printf(value):
|
||||||
# https://stackoverflow.com/questions/30011379/how-can-i-parse-a-c-format-string-in-python
|
# https://stackoverflow.com/questions/30011379/how-can-i-parse-a-c-format-string-in-python
|
||||||
cfmt = r"""
|
cfmt = r"""
|
||||||
( # start of capture group 1
|
( # start of capture group 1
|
||||||
% # literal "%"
|
% # literal "%"
|
||||||
(?:[-+0 #]{0,5}) # optional flags
|
(?:[-+0 #]{0,5}) # optional flags
|
||||||
(?:\d+|\*)? # width
|
(?:\d+|\*)? # width
|
||||||
(?:\.(?:\d+|\*))? # precision
|
(?:\.(?:\d+|\*))? # precision
|
||||||
(?:h|l|ll|w|I|I32|I64)? # size
|
(?:hh|h|ll|l|j|z|t|L|w|I|I32|I64)? # size
|
||||||
[cCdiouxXeEfgGaAnpsSZ] # type
|
[cCdiouxXeEfgGaAnpsSZ] # type
|
||||||
)
|
)
|
||||||
""" # noqa
|
""" # noqa
|
||||||
matches = re.findall(cfmt, value[CONF_FORMAT], flags=re.VERBOSE)
|
matches = re.findall(cfmt, value[CONF_FORMAT], flags=re.VERBOSE)
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ CONF_IF_NAN = "if_nan"
|
|||||||
# noqa
|
# noqa
|
||||||
f_regex = re.compile(
|
f_regex = re.compile(
|
||||||
r"""
|
r"""
|
||||||
( # start of capture group 1
|
( # start of capture group 1
|
||||||
% # literal "%"
|
% # literal "%"
|
||||||
[-+0 #]{0,5} # optional flags
|
[-+0 #]{0,5} # optional flags
|
||||||
(?:\d+|\*)? # width
|
(?:\d+|\*)? # width
|
||||||
(?:\.(?:\d+|\*))? # precision
|
(?:\.(?:\d+|\*))? # precision
|
||||||
(?:h|l|ll|w|I|I32|I64)? # size
|
(?:hh|h|ll|l|j|z|t|L|w|I|I32|I64)? # size
|
||||||
f # type
|
f # type
|
||||||
)
|
)
|
||||||
""",
|
""",
|
||||||
flags=re.VERBOSE,
|
flags=re.VERBOSE,
|
||||||
@@ -23,13 +23,13 @@ f_regex = re.compile(
|
|||||||
# noqa
|
# noqa
|
||||||
c_regex = re.compile(
|
c_regex = re.compile(
|
||||||
r"""
|
r"""
|
||||||
( # start of capture group 1
|
( # start of capture group 1
|
||||||
% # literal "%"
|
% # literal "%"
|
||||||
[-+0 #]{0,5} # optional flags
|
[-+0 #]{0,5} # optional flags
|
||||||
(?:\d+|\*)? # width
|
(?:\d+|\*)? # width
|
||||||
(?:\.(?:\d+|\*))? # precision
|
(?:\.(?:\d+|\*))? # precision
|
||||||
(?:h|l|ll|w|I|I32|I64)? # size
|
(?:hh|h|ll|l|j|z|t|L|w|I|I32|I64)? # size
|
||||||
[cCdiouxXeEfgGaAnpsSZ] # type
|
[cCdiouxXeEfgGaAnpsSZ] # type
|
||||||
)
|
)
|
||||||
""",
|
""",
|
||||||
flags=re.VERBOSE,
|
flags=re.VERBOSE,
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ esp32_ble_tracker:
|
|||||||
- service_uuid: ABCD
|
- service_uuid: ABCD
|
||||||
then:
|
then:
|
||||||
- lambda: !lambda |-
|
- lambda: !lambda |-
|
||||||
ESP_LOGD("main", "Length of service data is %i", x.size());
|
ESP_LOGD("main", "Length of service data is %zu", x.size());
|
||||||
on_ble_manufacturer_data_advertise:
|
on_ble_manufacturer_data_advertise:
|
||||||
- manufacturer_id: ABCD
|
- manufacturer_id: ABCD
|
||||||
then:
|
then:
|
||||||
- lambda: !lambda |-
|
- lambda: !lambda |-
|
||||||
ESP_LOGD("main", "Length of manufacturer data is %i", x.size());
|
ESP_LOGD("main", "Length of manufacturer data is %zu", x.size());
|
||||||
on_scan_end:
|
on_scan_end:
|
||||||
- then:
|
- then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ select:
|
|||||||
- lambda: |-
|
- lambda: |-
|
||||||
id(uart_bus).flush();
|
id(uart_bus).flush();
|
||||||
uint32_t new_baud_rate = stoi(x);
|
uint32_t new_baud_rate = stoi(x);
|
||||||
ESP_LOGD("change_baud_rate", "Changing baud rate from %i to %i",id(uart_bus).get_baud_rate(), new_baud_rate);
|
ESP_LOGD("change_baud_rate", "Changing baud rate from %" PRIu32 " to %" PRIu32, id(uart_bus).get_baud_rate(), new_baud_rate);
|
||||||
if (id(uart_bus).get_baud_rate() != new_baud_rate) {
|
if (id(uart_bus).get_baud_rate() != new_baud_rate) {
|
||||||
id(uart_bus).set_baud_rate(new_baud_rate);
|
id(uart_bus).set_baud_rate(new_baud_rate);
|
||||||
#if defined(USE_ESP8266) || defined(USE_ESP32)
|
#if defined(USE_ESP8266) || defined(USE_ESP32)
|
||||||
|
|||||||
@@ -660,13 +660,13 @@ lvgl:
|
|||||||
on_release:
|
on_release:
|
||||||
logger.log:
|
logger.log:
|
||||||
format: Button released at %d/%d
|
format: Button released at %d/%d
|
||||||
args: [point.x, point.y]
|
args: ['(int) point.x', '(int) point.y']
|
||||||
on_long_press_repeat:
|
on_long_press_repeat:
|
||||||
logger.log: Button clicked
|
logger.log: Button clicked
|
||||||
on_pressing:
|
on_pressing:
|
||||||
logger.log:
|
logger.log:
|
||||||
format: Button pressing at %d/%d
|
format: Button pressing at %d/%d
|
||||||
args: [point.x, point.y]
|
args: ['(int) point.x', '(int) point.y']
|
||||||
on_press_lost:
|
on_press_lost:
|
||||||
logger.log: Button press lost
|
logger.log: Button press lost
|
||||||
on_single_click:
|
on_single_click:
|
||||||
@@ -944,7 +944,7 @@ lvgl:
|
|||||||
on_release:
|
on_release:
|
||||||
logger.log:
|
logger.log:
|
||||||
format: Slider released at %d/%d with value %.0f
|
format: Slider released at %d/%d with value %.0f
|
||||||
args: [point.x, point.y, x]
|
args: ['(int) point.x', '(int) point.y', x]
|
||||||
- button:
|
- button:
|
||||||
styles: spin_button
|
styles: spin_button
|
||||||
id: spin_up
|
id: spin_up
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ modbus_server:
|
|||||||
read_lambda: |-
|
read_lambda: |-
|
||||||
return 31;
|
return 31;
|
||||||
write_lambda: |-
|
write_lambda: |-
|
||||||
printf("address=%d, value=%d", x);
|
printf("address=%d, value=%" PRId32 "\n", (int) address, x);
|
||||||
return true;
|
return true;
|
||||||
- id: modbus_server4
|
- id: modbus_server4
|
||||||
modbus_id: mod_bus2
|
modbus_id: mod_bus2
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ mqtt:
|
|||||||
topic: some/topic
|
topic: some/topic
|
||||||
payload: Good-bye
|
payload: Good-bye
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
ESP_LOGD("MQTT", "Disconnect reason %d", reason);
|
ESP_LOGD("MQTT", "Disconnect reason %d", (int) reason);
|
||||||
publish_nan_as_none: false
|
publish_nan_as_none: false
|
||||||
|
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ display:
|
|||||||
- lambda: |-
|
- lambda: |-
|
||||||
// key: StringRef, value: int32_t
|
// key: StringRef, value: int32_t
|
||||||
if (key == "temperature_raw") {
|
if (key == "temperature_raw") {
|
||||||
ESP_LOGD("nextion.custom", "%s=%d", key.c_str(), value);
|
ESP_LOGD("nextion.custom", "%s=%" PRId32, key.c_str(), value);
|
||||||
}
|
}
|
||||||
on_custom_binary_sensor:
|
on_custom_binary_sensor:
|
||||||
then:
|
then:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ on_brennenstuhl:
|
|||||||
then:
|
then:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
format: "on_brennenstuhl: %u"
|
format: "on_brennenstuhl: %u"
|
||||||
args: ["x.code"]
|
args: ["(unsigned) x.code"]
|
||||||
on_aeha:
|
on_aeha:
|
||||||
then:
|
then:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ script:
|
|||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
ESP_LOGD("main", "ints=%d floats=%f bools=%d strings=%s",
|
ESP_LOGD("main", "ints=%d floats=%f bools=%d strings=%s",
|
||||||
ints[0], floats[0], bools[0], strings[0].c_str());
|
ints[0], floats[0], (int) bools[0], strings[0].c_str());
|
||||||
- id: my_script_with_params
|
- id: my_script_with_params
|
||||||
parameters:
|
parameters:
|
||||||
prefix: string
|
prefix: string
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ udp:
|
|||||||
- "10.0.0.255"
|
- "10.0.0.255"
|
||||||
on_receive:
|
on_receive:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
format: "Received %d bytes"
|
format: "Received %zu bytes"
|
||||||
args: [data.size()]
|
args: [data.size()]
|
||||||
- udp.write:
|
- udp.write:
|
||||||
id: my_udp
|
id: my_udp
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ udp:
|
|||||||
addresses: ["239.0.60.53"]
|
addresses: ["239.0.60.53"]
|
||||||
on_receive:
|
on_receive:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
format: "Received %d bytes"
|
format: "Received %zu bytes"
|
||||||
args: [data.size()]
|
args: [data.size()]
|
||||||
- udp.write:
|
- udp.write:
|
||||||
id: my_udp
|
id: my_udp
|
||||||
|
|||||||
Reference in New Issue
Block a user