| 
									
										
										
										
											2018-12-21 12:49:33 +08:00
										 |  |  | #include "freertos/FreeRTOS.h"
 | 
					
						
							|  |  |  | #include "freertos/task.h"
 | 
					
						
							|  |  |  | #include "freertos/semphr.h"
 | 
					
						
							|  |  |  | #include "unity.h"
 | 
					
						
							|  |  |  | #include "esp_ipc.h"
 | 
					
						
							|  |  |  | #include "test_utils.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void mutex_release_task(void* arg) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     SemaphoreHandle_t mutex = (SemaphoreHandle_t) arg; | 
					
						
							|  |  |  |     xSemaphoreGive(mutex); | 
					
						
							|  |  |  |     TEST_FAIL_MESSAGE("should not be reached"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-09 12:32:11 +05:30
										 |  |  | TEST_CASE_ESP32("mutex released not by owner causes an assert", "[freertos][reset=abort,SW_CPU_RESET]") | 
					
						
							| 
									
										
										
										
											2018-12-21 12:49:33 +08:00
										 |  |  | { | 
					
						
							|  |  |  |     SemaphoreHandle_t mutex = xSemaphoreCreateMutex(); | 
					
						
							|  |  |  |     xSemaphoreTake(mutex, portMAX_DELAY); | 
					
						
							|  |  |  |     xTaskCreate(&mutex_release_task, "mutex_release", 2048, mutex, UNITY_FREERTOS_PRIORITY + 1, NULL); | 
					
						
							|  |  |  |     vTaskDelay(1); | 
					
						
							|  |  |  | } |