feat(storage/vfs): add /dev/null for unwanted output redirection

This commit is contained in:
Tomáš Rohlínek
2024-04-19 10:03:36 +02:00
parent 0b4fff69c5
commit a615f487dd
6 changed files with 349 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdio.h>
#include <assert.h>
#include "sdkconfig.h"
#include "esp_rom_uart.h"
@@ -15,6 +16,9 @@
#include "driver/uart.h"
#include "soc/uart_channel.h"
#include <fcntl.h>
#include <unistd.h>
#if CONFIG_ESP_CONSOLE_NONE
/* Set up UART on UART_0 (console) to be able to
notify pytest test case that app booted successfully
@@ -49,6 +53,15 @@ void app_main(void)
{
printf("Hello World\n");
int fd = open("/dev/null", O_RDWR);
assert(fd >= 0); // Standard check
// Check if correct file descriptor is returned
// In this case it should be neither of 0, 1, 2 (== stdin, stdout, stderr)
assert(fd > 2);
close(fd);
#if CONFIG_ESP_CONSOLE_NONE
console_none_print();
#endif // CONFIG_ESP_CONSOLE_NONE