mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 00:51:42 +01:00 
			
		
		
		
	util-test: Copy the test in the esp32 directory to the esp32s2beta directory
This commit is contained in:
		
							
								
								
									
										25
									
								
								components/esp32s2beta/test/test_stack_check.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								components/esp32s2beta/test/test_stack_check.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
#include "unity.h"
 | 
			
		||||
 | 
			
		||||
#if CONFIG_COMPILER_STACK_CHECK
 | 
			
		||||
 | 
			
		||||
static void recur_and_smash()
 | 
			
		||||
{
 | 
			
		||||
    static int cnt;
 | 
			
		||||
    volatile uint8_t buf[50];
 | 
			
		||||
    volatile int num = sizeof(buf)+10;
 | 
			
		||||
 | 
			
		||||
    if (cnt++ < 1) {
 | 
			
		||||
        recur_and_smash();
 | 
			
		||||
    }
 | 
			
		||||
    for (int i = 0; i < num; i++) {
 | 
			
		||||
        buf[i] = 0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST_CASE("stack smashing protection", "[stack_check] [ignore]")
 | 
			
		||||
{
 | 
			
		||||
    recur_and_smash();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
		Reference in New Issue
	
	Block a user