OVMS3-idf/components/esp32s2/test/test_stack_check_cxx.cpp
2020-01-22 12:14:38 +08:00

25 lines
415 B
C++

#include "unity.h"
#if CONFIG_COMPILER_STACK_CHECK
static void recur_and_smash_cxx(void)
{
static int cnt;
volatile uint8_t buf[50];
volatile int num = sizeof(buf)+10;
if (cnt++ < 1) {
recur_and_smash_cxx();
}
for (int i = 0; i < num; i++) {
buf[i] = 0;
}
}
TEST_CASE("stack smashing protection CXX", "[stack_check] [ignore]")
{
recur_and_smash_cxx();
}
#endif