mirror of
https://github.com/esphome/esphome.git
synced 2026-10-02 01:10:22 +00:00
Merge branch 'heap_scheduler_stress_component' into integration
This commit is contained in:
+42
@@ -38,6 +38,48 @@ void SchedulerStringLifetimeComponent::run_string_lifetime_test() {
|
||||
});
|
||||
}
|
||||
|
||||
void SchedulerStringLifetimeComponent::run_test1() {
|
||||
test_temporary_string_lifetime();
|
||||
// Wait for all callbacks to execute
|
||||
this->set_timeout("test1_complete", 10, [this]() { ESP_LOGI(TAG, "Test 1 complete"); });
|
||||
}
|
||||
|
||||
void SchedulerStringLifetimeComponent::run_test2() {
|
||||
test_scope_exit_string();
|
||||
// Wait for all callbacks to execute
|
||||
this->set_timeout("test2_complete", 20, [this]() { ESP_LOGI(TAG, "Test 2 complete"); });
|
||||
}
|
||||
|
||||
void SchedulerStringLifetimeComponent::run_test3() {
|
||||
test_vector_reallocation();
|
||||
// Wait for all callbacks to execute
|
||||
this->set_timeout("test3_complete", 60, [this]() { ESP_LOGI(TAG, "Test 3 complete"); });
|
||||
}
|
||||
|
||||
void SchedulerStringLifetimeComponent::run_test4() {
|
||||
test_string_move_semantics();
|
||||
// Wait for all callbacks to execute
|
||||
this->set_timeout("test4_complete", 35, [this]() { ESP_LOGI(TAG, "Test 4 complete"); });
|
||||
}
|
||||
|
||||
void SchedulerStringLifetimeComponent::run_test5() {
|
||||
test_lambda_capture_lifetime();
|
||||
// Wait for all callbacks to execute
|
||||
this->set_timeout("test5_complete", 50, [this]() { ESP_LOGI(TAG, "Test 5 complete"); });
|
||||
}
|
||||
|
||||
void SchedulerStringLifetimeComponent::run_final_check() {
|
||||
ESP_LOGI(TAG, "String lifetime tests complete");
|
||||
ESP_LOGI(TAG, "Tests passed: %d", this->tests_passed_);
|
||||
ESP_LOGI(TAG, "Tests failed: %d", this->tests_failed_);
|
||||
|
||||
if (this->tests_failed_ == 0) {
|
||||
ESP_LOGI(TAG, "SUCCESS: All string lifetime tests passed!");
|
||||
} else {
|
||||
ESP_LOGE(TAG, "FAILURE: %d string lifetime tests failed!", this->tests_failed_);
|
||||
}
|
||||
}
|
||||
|
||||
void SchedulerStringLifetimeComponent::test_temporary_string_lifetime() {
|
||||
ESP_LOGI(TAG, "Test 1: Temporary string lifetime for timeout names");
|
||||
|
||||
|
||||
+8
@@ -14,6 +14,14 @@ class SchedulerStringLifetimeComponent : public Component {
|
||||
|
||||
void run_string_lifetime_test();
|
||||
|
||||
// Individual test methods exposed as services
|
||||
void run_test1();
|
||||
void run_test2();
|
||||
void run_test3();
|
||||
void run_test4();
|
||||
void run_test5();
|
||||
void run_final_check();
|
||||
|
||||
private:
|
||||
void test_temporary_string_lifetime();
|
||||
void test_scope_exit_string();
|
||||
|
||||
@@ -21,3 +21,27 @@ api:
|
||||
then:
|
||||
- lambda: |-
|
||||
id(string_lifetime)->run_string_lifetime_test();
|
||||
- service: run_test1
|
||||
then:
|
||||
- lambda: |-
|
||||
id(string_lifetime)->run_test1();
|
||||
- service: run_test2
|
||||
then:
|
||||
- lambda: |-
|
||||
id(string_lifetime)->run_test2();
|
||||
- service: run_test3
|
||||
then:
|
||||
- lambda: |-
|
||||
id(string_lifetime)->run_test3();
|
||||
- service: run_test4
|
||||
then:
|
||||
- lambda: |-
|
||||
id(string_lifetime)->run_test4();
|
||||
- service: run_test5
|
||||
then:
|
||||
- lambda: |-
|
||||
id(string_lifetime)->run_test5();
|
||||
- service: run_final_check
|
||||
then:
|
||||
- lambda: |-
|
||||
id(string_lifetime)->run_final_check();
|
||||
|
||||
Reference in New Issue
Block a user