mirror of https://github.com/thesofproject/sof.git
test: improve compatibility for malloc
The C header file malloc.h does not exist on some Xtensa processor configurations or host OSes, include stdlib.h instead because they both provide the prototype for 'malloc' function. Fixes: #5102 Signed-off-by: Chao Song <chao.song@linux.intel.com>
This commit is contained in:
parent
37ce03fbd9
commit
b673d4a3e2
|
@ -6,11 +6,16 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <malloc.h>
|
||||
#include <sof/list.h>
|
||||
#include <sof/audio/stream.h>
|
||||
#include <sof/audio/component.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "comp_mock.h"
|
||||
|
||||
static struct comp_dev *mock_comp_new(const struct comp_driver *drv,
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <math.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdint.h>
|
||||
#include <malloc.h>
|
||||
#include <cmocka.h>
|
||||
#include <sof/list.h>
|
||||
#include <sof/ipc/driver.h>
|
||||
|
@ -21,6 +20,12 @@
|
|||
#include <sof/audio/format.h>
|
||||
#include <sof/audio/mixer.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "comp_mock.h"
|
||||
|
||||
#define MIX_TEST_SAMPLES 32
|
||||
|
|
|
@ -16,10 +16,15 @@
|
|||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <stdint.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "../../util.h"
|
||||
|
||||
/* used during float assertions */
|
||||
|
|
|
@ -12,9 +12,14 @@
|
|||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdint.h>
|
||||
#include <malloc.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#define PIPELINE_ID_SAME 3
|
||||
#define PIPELINE_ID_DIFFERENT 4
|
||||
|
||||
|
|
|
@ -14,9 +14,14 @@
|
|||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <malloc.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* mock free() - dont free as we inspect contents */
|
||||
void rfree(void *ptr)
|
||||
{
|
||||
|
|
|
@ -12,9 +12,14 @@
|
|||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <malloc.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
static int setup(void **state)
|
||||
{
|
||||
struct pipeline_new_setup_data *pipeline_data = malloc(
|
||||
|
|
|
@ -10,9 +10,14 @@
|
|||
#include <stdarg.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdint.h>
|
||||
#include <malloc.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <sof/trace/preproc.h>
|
||||
#include <sof/sof.h>
|
||||
#include <sof/trace/trace.h>
|
||||
|
@ -46,7 +51,7 @@ static void test_debugability_macros_declare_log_entry(void **state)
|
|||
"1"
|
||||
"0"
|
||||
"1"
|
||||
"31"
|
||||
"36"
|
||||
"sizeof(\"" RELATIVE_FILE "\")"
|
||||
"sizeof(\"Message\")"
|
||||
"\"" RELATIVE_FILE "\""
|
||||
|
|
|
@ -11,9 +11,14 @@
|
|||
#include <setjmp.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <cmocka.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <test_group_generator.h>
|
||||
|
||||
struct test_data_t {
|
||||
|
|
Loading…
Reference in New Issue