Added poweroff in fs and mm tests.

This commit is contained in:
Fotis Panagiotopoulos 2022-11-07 18:07:13 +02:00 committed by Xiang Xiao
parent 36a0c924f7
commit f85a6b6fb9
4 changed files with 38 additions and 0 deletions

View File

@ -71,4 +71,9 @@ config TESTING_FSTEST_VERBOSE
bool "Verbose output"
default n
config TESTING_FSTEST_POWEROFF
bool "Terminate on test completion"
default n
depends on BOARDCTL_POWEROFF
endif

View File

@ -28,6 +28,10 @@
#include <sys/ioctl.h>
#include <sys/statfs.h>
#ifdef CONFIG_TESTING_FSTEST_POWEROFF
#include <sys/boardctl.h>
#endif
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@ -1175,5 +1179,14 @@ int main(int argc, FAR char *argv[])
fstest_endmemusage(ctx);
fflush(stdout);
free(ctx);
#ifdef CONFIG_TESTING_FSTEST_POWEROFF
/* Power down. This is useful when used with the simulator and gcov,
* as the graceful shutdown allows for the generation of the .gcda files.
*/
boardctl(BOARDIOC_POWEROFF, 0);
#endif
return 0;
}

View File

@ -26,4 +26,9 @@ config TESTING_MM_STACKSIZE
int "Stack size"
default DEFAULT_TASK_STACKSIZE
config TESTING_MM_POWEROFF
bool "Terminate on test completion"
default n
depends on BOARDCTL_POWEROFF
endif

View File

@ -22,12 +22,18 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <assert.h>
#ifdef CONFIG_TESTING_MM_POWEROFF
#include <sys/boardctl.h>
#endif
#include <nuttx/queue.h>
/* Include nuttx/mm/mm_heap/mm.h */
@ -354,5 +360,14 @@ int main(int argc, FAR char *argv[])
do_frees(g_allocs, g_alloc_small_sizes, g_random1, NTEST_ALLOCS);
printf("TEST COMPLETE\n");
#ifdef CONFIG_TESTING_MM_POWEROFF
/* Power down. This is useful when used with the simulator and gcov,
* as the graceful shutdown allows for the generation of the .gcda files.
*/
boardctl(BOARDIOC_POWEROFF, 0);
#endif
return 0;
}