diff mbox

[5/5] test/api_test: Add odp_buffer

Message ID 1407274197-44498-5-git-send-email-mike.holmes@linaro.org
State Rejected
Headers show

Commit Message

Mike Holmes Aug. 5, 2014, 9:29 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/api_test/Makefile.am   |   4 +-
 test/api_test/minunit.h     |   4 +
 test/api_test/odp_buffer.c  | 365 ++++++++++++++++++++++++++++++++++++++++++++
 test/api_test/odp_buffer.sh |  12 ++
 4 files changed, 384 insertions(+), 1 deletion(-)
 create mode 100644 test/api_test/minunit.h
 create mode 100644 test/api_test/odp_buffer.c
 create mode 100755 test/api_test/odp_buffer.sh

Comments

Stuart Haslam Aug. 6, 2014, 5:40 p.m. UTC | #1
On Tue, Aug 05, 2014 at 10:29:57PM +0100, Mike Holmes wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>  test/api_test/Makefile.am   |   4 +-
>  test/api_test/minunit.h     |   4 +
>  test/api_test/odp_buffer.c  | 365 ++++++++++++++++++++++++++++++++++++++++++++

Shouldn't it be called odp_buffer_test.c?

>  test/api_test/odp_buffer.sh |  12 ++
>  4 files changed, 384 insertions(+), 1 deletion(-)
>  create mode 100644 test/api_test/minunit.h
>  create mode 100644 test/api_test/odp_buffer.c
>  create mode 100755 test/api_test/odp_buffer.sh

There are quite a few checkpatch issues (are we supposed to be
checkpatch clean for test/?)

> 
> diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
> index 5104454..6fbf982 100644
> --- a/test/api_test/Makefile.am
> +++ b/test/api_test/Makefile.am
> @@ -1,12 +1,14 @@
>  include $(top_srcdir)/test/Makefile.inc
> 
> -bin_PROGRAMS = odp_atomic odp_shm odp_ring odp_timer_ping
> +bin_PROGRAMS = odp_atomic odp_shm odp_ring odp_timer_ping odp_buffer
>  odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
>  odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
>  odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
>  odp_timer_ping_LDFLAGS = $(AM_LDFLAGS) -static
> +odp_buffer_LDFLAGS = $(AM_LDFLAGS) -static
> 
>  dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c
>  dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c
>  dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c
>  dist_odp_timer_ping_SOURCES = odp_timer_ping.c odp_common.c
> +dist_odp_buffer_SOURCES = odp_buffer.c
> diff --git a/test/api_test/minunit.h b/test/api_test/minunit.h
> new file mode 100644
> index 0000000..d256ec1
> --- /dev/null
> +++ b/test/api_test/minunit.h
> @@ -0,0 +1,4 @@
> +/* file: minunit.h */

Missing header / license declaration.

> +#define mu_run_test(test) do { const char *message = test(); tests_run++; \
> +if (message) return message; } while (0)
> +extern int tests_run;
> diff --git a/test/api_test/odp_buffer.c b/test/api_test/odp_buffer.c
> new file mode 100644
> index 0000000..57dcd3c
> --- /dev/null
> +++ b/test/api_test/odp_buffer.c

Missing header / license declaration.

> @@ -0,0 +1,365 @@
> +#include <stdio.h>
> +#include "minunit.h"
> +#include "odp.h"
> +
> +
> +int tests_run = 0;
> +
> +typedef struct {
> +        int msg_id;
> +        int seq;
> +} test_message_t;

This structure doesn't seem to be needed, it's only used for sizeof when
creating the pools.

> +
> +#define DEFAULT_MSG_POOL_SIZE         (4*1024*1024)
> +
> +static const char* test_odp_buffer_addr(void) {
> +    void* startaddress;
> +    odp_buffer_pool_t msg_pool;
> +    odp_buffer_t mybuffer;
> +    void* pool_base;
> +    printf("->%s:\n",__FUNCTION__);
> +    odp_init_global();

odp_init_global() should only be called once so this should be moved
into main(), also need to call odp_init_local().

> +
> +    pool_base = odp_shm_reserve("msg_pool",
> +                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
> +
> +    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
> +                                  sizeof(test_message_t),
> +                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
> +    mybuffer = odp_buffer_alloc(msg_pool);
> +
> +    startaddress  = odp_buffer_addr(mybuffer);
> +
> +    printf("<-\n");
> +    printf("%s: Result:",__FUNCTION__);
> +    if  (startaddress == NULL)
> +    {
> +        printf("fail\n");
> +        printf("error, start address == NULL\n");
> +    }
> +    else
> +        printf("pass\n");
> +

Should odp_buffer_free()

It's leaking the pool for each test too, but there's no free for that
yet!

> +    return NULL;
> +}
> +
> +static const char* test_odp_buffer_size(void) {
> +    size_t size;
> +    odp_buffer_pool_t msg_pool;
> +    odp_buffer_t mybuffer;
> +    void* pool_base;
> +
> +    printf("->%s:\n",__FUNCTION__);
> +    odp_init_global();
> +
> +    pool_base = odp_shm_reserve("msg_pool",
> +                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
> +
> +    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
> +                                  sizeof(test_message_t),
> +                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
> +    mybuffer = odp_buffer_alloc(msg_pool);
> +
> +    size  = odp_buffer_size(mybuffer);
> +
> +    printf("<-\n");
> +    printf("%s: Measurement: %lu Result:",__FUNCTION__, size);
> +
> +    if  (size != sizeof(test_message_t))
> +    {
> +        printf("fail\n");
> +    }
> +    else
> +        printf("pass\n");
> +
> +    return NULL;
> +}
> +
> +static const char* test_odp_buffer_type1 (void) {
> +    int type;
> +    int type_in = ODP_BUFFER_TYPE_ANY;
> +    odp_buffer_pool_t msg_pool;
> +    odp_buffer_t mybuffer;
> +    void* pool_base;
> +
> +    printf("->%s:\n",__FUNCTION__);
> +
> +    odp_init_global();
> +
> +    pool_base = odp_shm_reserve("msg_pool",
> +                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
> +
> +    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
> +                                  sizeof(test_message_t),
> +                                  ODP_CACHE_LINE_SIZE, type_in);
> +    mybuffer = odp_buffer_alloc(msg_pool);
> +
> +    type  = odp_buffer_type(mybuffer);
> +
> +    printf ("buffer type: %d\n",type);
> +
> +    printf("<-\n");
> +    printf("%s: Result:",__FUNCTION__);
> +
> +    if (type == type_in)
> +            printf("pass\n");
> +    else
> +            printf("fail\n");
> +
> +    return NULL;
> +}
> +

There's a lot of duplicated code in test_odp_buffer_type1 to type4 which
could be factored out e.g.; test_odp_buffer_type(ODP_BUFFER_TYPE_RAW);

[...]

> +
> +static const char* test_odp_buffer_type5 (void) {
> +    int type;
> +    int type_in = ODP_BUFFER_TYPE_INVALID;
> +    odp_buffer_pool_t msg_pool;
> +    odp_buffer_t mybuffer;
> +    void* pool_base;
> +
> +    printf("->%s:\n",__FUNCTION__);
> +
> +    odp_init_global();
> +
> +    pool_base = odp_shm_reserve("msg_pool",
> +                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
> +
> +    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
> +                                  sizeof(test_message_t),
> +                                  ODP_CACHE_LINE_SIZE, type_in);

This fails (on linux-generic at least) because it's not possible to
create a pool with buffers of type INVALID. I think this should be
converted into a test case that asserts that you can't create pools of
unknown or invalid buffer types and that the error is reported
correctly.

Unfortunately the check that's failing in platform/linux-generic/odp_buffer_pool.c
has an "exit(0);" which needs removing.

> +    mybuffer = odp_buffer_alloc(msg_pool);
> +
> +    type  = odp_buffer_type(mybuffer);
> +
> +    printf ("buffer type: %d\n",type);
> +
> +    printf("<-\n");
> +    printf("%s: Result:",__FUNCTION__);
> +
> +    if (type == type_in)
> +            printf("pass\n");
> +    else
> +            printf("fail\n");
> +
> +    return NULL;
> +}
> +
> +
> +static const char* test_odp_is_scatter (void) {
> +    int is_scatter;
> +    odp_buffer_pool_t msg_pool;
> +    odp_buffer_t mybuffer;
> +    void* pool_base;
> +    printf("->%s:\n",__FUNCTION__);
> +    odp_init_global();
> +
> +    pool_base = odp_shm_reserve("msg_pool",
> +                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
> +
> +    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
> +                                  sizeof(test_message_t),
> +                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
> +    mybuffer = odp_buffer_alloc(msg_pool);
> +
> +    is_scatter  = odp_buffer_size(mybuffer);
> +
> +    printf("<-\n");
> +    printf("%s: Result:",__FUNCTION__);
> +
> +    if ((is_scatter <0) || (is_scatter >1))
> +    {
> +            printf("fail \n");
> +            printf("is_scatter: %d \n",is_scatter);
> +    }
> +    else
> +            printf("pass\n");
> +
> +    return NULL;
> +}
> +
> +static const char* test_odp_is_valid (void) {
> +    int is_valid;
> +    odp_buffer_pool_t msg_pool;
> +    odp_buffer_t mybuffer;
> +    void* pool_base;
> +    printf("->%s:\n",__FUNCTION__);
> +    odp_init_global();
> +
> +    pool_base = odp_shm_reserve("msg_pool",
> +                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
> +
> +    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
> +                                  sizeof(test_message_t),
> +                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
> +    mybuffer = odp_buffer_alloc(msg_pool);
> +
> +    is_valid = odp_buffer_is_valid(mybuffer);
> +    if ((is_valid <0) || (is_valid >1))
> +    {
> +            printf("fail \n");
> +            printf("is_valid: %d \n",is_valid);
> +    }
> +    else
> +            printf("pass\n");
> +
> +    printf("<-\n");
> +    printf("%s: Result:",__FUNCTION__);
> +
> +    printf("pass\n");
> +
> +    return NULL;
> +}
> +
> +static const char* test_odp_buffer_print (void) {
> +    odp_buffer_pool_t msg_pool;
> +    odp_buffer_t mybuffer;
> +    void* pool_base;
> +    printf("->%s:\n",__FUNCTION__);
> +    odp_init_global();
> +
> +    pool_base = odp_shm_reserve("msg_pool",
> +                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
> +
> +    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
> +                                  sizeof(test_message_t),
> +                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
> +    mybuffer = odp_buffer_alloc(msg_pool);
> +
> +    odp_buffer_print(mybuffer);
> +
> +    printf("<-\n");
> +    printf("%s: Result:",__FUNCTION__);
> +
> +    printf("pass\n");
> +
> +    return NULL;
> +}
> +
> +static const char * all_tests(void) {
> +     mu_run_test(test_odp_buffer_addr);
> +     mu_run_test(test_odp_buffer_size);
> +     mu_run_test(test_odp_buffer_type1);
> +     mu_run_test(test_odp_buffer_type2);
> +     mu_run_test(test_odp_buffer_type3);
> +     mu_run_test(test_odp_buffer_type4);
> +     mu_run_test(test_odp_buffer_type5);
> +     mu_run_test(test_odp_is_scatter);
> +     mu_run_test(test_odp_is_valid);
> +     mu_run_test(test_odp_buffer_print);
> +     return NULL;
> + }
> +
> +int main(void) {
> +     const char *result = all_tests();
> +     if (result != 0) {
> +         printf("%s\n", result);
> +     }
> +     else {
> +         printf("ALL TESTS passED\n");
> +     }

all_tests() always returns NULL so this'll always claim success.

> +     printf("Tests run: %d\n", tests_run);
> +
> +     return result != 0;
> + }
diff mbox

Patch

diff --git a/test/api_test/Makefile.am b/test/api_test/Makefile.am
index 5104454..6fbf982 100644
--- a/test/api_test/Makefile.am
+++ b/test/api_test/Makefile.am
@@ -1,12 +1,14 @@ 
 include $(top_srcdir)/test/Makefile.inc
 
-bin_PROGRAMS = odp_atomic odp_shm odp_ring odp_timer_ping
+bin_PROGRAMS = odp_atomic odp_shm odp_ring odp_timer_ping odp_buffer
 odp_atomic_LDFLAGS = $(AM_LDFLAGS) -static
 odp_shm_LDFLAGS = $(AM_LDFLAGS) -static
 odp_ring_LDFLAGS = $(AM_LDFLAGS) -static
 odp_timer_ping_LDFLAGS = $(AM_LDFLAGS) -static
+odp_buffer_LDFLAGS = $(AM_LDFLAGS) -static
 
 dist_odp_atomic_SOURCES = odp_atomic_test.c odp_common.c
 dist_odp_shm_SOURCES = odp_shm_test.c odp_common.c
 dist_odp_ring_SOURCES = odp_ring_test.c odp_common.c
 dist_odp_timer_ping_SOURCES = odp_timer_ping.c odp_common.c
+dist_odp_buffer_SOURCES = odp_buffer.c
diff --git a/test/api_test/minunit.h b/test/api_test/minunit.h
new file mode 100644
index 0000000..d256ec1
--- /dev/null
+++ b/test/api_test/minunit.h
@@ -0,0 +1,4 @@ 
+/* file: minunit.h */
+#define mu_run_test(test) do { const char *message = test(); tests_run++; \
+if (message) return message; } while (0)
+extern int tests_run;
diff --git a/test/api_test/odp_buffer.c b/test/api_test/odp_buffer.c
new file mode 100644
index 0000000..57dcd3c
--- /dev/null
+++ b/test/api_test/odp_buffer.c
@@ -0,0 +1,365 @@ 
+#include <stdio.h>
+#include "minunit.h"
+#include "odp.h"
+
+
+int tests_run = 0;
+
+typedef struct {
+        int msg_id;
+        int seq;
+} test_message_t;
+
+#define DEFAULT_MSG_POOL_SIZE         (4*1024*1024)
+
+static const char* test_odp_buffer_addr(void) {
+    void* startaddress;
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+    printf("->%s:\n",__FUNCTION__);
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    startaddress  = odp_buffer_addr(mybuffer);
+
+    printf("<-\n");
+    printf("%s: Result:",__FUNCTION__);
+    if  (startaddress == NULL)
+    {
+        printf("fail\n");
+        printf("error, start address == NULL\n");
+    }
+    else
+        printf("pass\n");
+
+    return NULL;
+}
+
+static const char* test_odp_buffer_size(void) {
+    size_t size;
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+
+    printf("->%s:\n",__FUNCTION__);
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    size  = odp_buffer_size(mybuffer);
+
+    printf("<-\n");
+    printf("%s: Measurement: %lu Result:",__FUNCTION__, size);
+
+    if  (size != sizeof(test_message_t))
+    {
+        printf("fail\n");
+    }
+    else
+        printf("pass\n");
+
+    return NULL;
+}
+
+static const char* test_odp_buffer_type1 (void) {
+    int type;
+    int type_in = ODP_BUFFER_TYPE_ANY;
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+
+    printf("->%s:\n",__FUNCTION__);
+
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, type_in);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    type  = odp_buffer_type(mybuffer);
+
+    printf ("buffer type: %d\n",type);
+
+    printf("<-\n");
+    printf("%s: Result:",__FUNCTION__);
+
+    if (type == type_in)
+            printf("pass\n");
+    else
+            printf("fail\n");
+
+    return NULL;
+}
+
+static const char* test_odp_buffer_type2 (void) {
+    int type;
+    int type_in = ODP_BUFFER_TYPE_RAW;
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+
+    printf("->%s:\n",__FUNCTION__);
+
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, type_in);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    type  = odp_buffer_type(mybuffer);
+
+    printf ("buffer type: %d\n",type);
+
+    printf("<-\n");
+    printf("%s: Result:",__FUNCTION__);
+
+    if (type == type_in)
+            printf("pass\n");
+    else
+            printf("fail\n");
+
+    return NULL;
+}
+
+static const char* test_odp_buffer_type3 (void) {
+    int type;
+    int type_in = ODP_BUFFER_TYPE_PACKET;
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+
+    printf("->%s:\n",__FUNCTION__);
+
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, type_in);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    type  = odp_buffer_type(mybuffer);
+
+    printf ("buffer type: %d\n",type);
+
+    printf("<-\n");
+    printf("%s: Result:",__FUNCTION__);
+
+    if (type == type_in)
+            printf("pass\n");
+    else
+            printf("fail\n");
+
+    return NULL;
+}
+
+static const char* test_odp_buffer_type4 (void) {
+    int type;
+    int type_in = ODP_BUFFER_TYPE_TIMEOUT;
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+
+    printf("->%s:\n",__FUNCTION__);
+
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, type_in);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    type  = odp_buffer_type(mybuffer);
+
+    printf ("buffer type: %d\n",type);
+
+    printf("<-\n");
+    printf("%s: Result:",__FUNCTION__);
+
+    if (type == type_in)
+            printf("pass\n");
+    else
+            printf("fail\n");
+
+    return NULL;
+}
+
+
+static const char* test_odp_buffer_type5 (void) {
+    int type;
+    int type_in = ODP_BUFFER_TYPE_INVALID;
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+
+    printf("->%s:\n",__FUNCTION__);
+
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, type_in);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    type  = odp_buffer_type(mybuffer);
+
+    printf ("buffer type: %d\n",type);
+
+    printf("<-\n");
+    printf("%s: Result:",__FUNCTION__);
+
+    if (type == type_in)
+            printf("pass\n");
+    else
+            printf("fail\n");
+
+    return NULL;
+}
+
+
+static const char* test_odp_is_scatter (void) {
+    int is_scatter;
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+    printf("->%s:\n",__FUNCTION__);
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    is_scatter  = odp_buffer_size(mybuffer);
+
+    printf("<-\n");
+    printf("%s: Result:",__FUNCTION__);
+
+    if ((is_scatter <0) || (is_scatter >1))
+    {
+            printf("fail \n");
+            printf("is_scatter: %d \n",is_scatter);
+    }
+    else
+            printf("pass\n");
+
+    return NULL;
+}
+
+static const char* test_odp_is_valid (void) {
+    int is_valid;
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+    printf("->%s:\n",__FUNCTION__);
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    is_valid = odp_buffer_is_valid(mybuffer);
+    if ((is_valid <0) || (is_valid >1))
+    {
+            printf("fail \n");
+            printf("is_valid: %d \n",is_valid);
+    }
+    else
+            printf("pass\n");
+
+    printf("<-\n");
+    printf("%s: Result:",__FUNCTION__);
+
+    printf("pass\n");
+
+    return NULL;
+}
+
+static const char* test_odp_buffer_print (void) {
+    odp_buffer_pool_t msg_pool;
+    odp_buffer_t mybuffer;
+    void* pool_base;
+    printf("->%s:\n",__FUNCTION__);
+    odp_init_global();
+
+    pool_base = odp_shm_reserve("msg_pool",
+                                DEFAULT_MSG_POOL_SIZE, ODP_CACHE_LINE_SIZE);
+
+    msg_pool = odp_buffer_pool_create("msg_pool", pool_base, DEFAULT_MSG_POOL_SIZE,
+                                  sizeof(test_message_t),
+                                  ODP_CACHE_LINE_SIZE, ODP_BUFFER_TYPE_RAW);
+    mybuffer = odp_buffer_alloc(msg_pool);
+
+    odp_buffer_print(mybuffer);
+
+    printf("<-\n");
+    printf("%s: Result:",__FUNCTION__);
+
+    printf("pass\n");
+
+    return NULL;
+}
+
+static const char * all_tests(void) {
+     mu_run_test(test_odp_buffer_addr);
+     mu_run_test(test_odp_buffer_size);
+     mu_run_test(test_odp_buffer_type1);
+     mu_run_test(test_odp_buffer_type2);
+     mu_run_test(test_odp_buffer_type3);
+     mu_run_test(test_odp_buffer_type4);
+     mu_run_test(test_odp_buffer_type5);
+     mu_run_test(test_odp_is_scatter);
+     mu_run_test(test_odp_is_valid);
+     mu_run_test(test_odp_buffer_print);
+     return NULL;
+ }
+
+int main(void) {
+     const char *result = all_tests();
+     if (result != 0) {
+         printf("%s\n", result);
+     }
+     else {
+         printf("ALL TESTS passED\n");
+     }
+     printf("Tests run: %d\n", tests_run);
+
+     return result != 0;
+ }
diff --git a/test/api_test/odp_buffer.sh b/test/api_test/odp_buffer.sh
new file mode 100755
index 0000000..5dc4537
--- /dev/null
+++ b/test/api_test/odp_buffer.sh
@@ -0,0 +1,12 @@ 
+#!/bin/bash
+EXECUTABLE=$(basename $0 .sh)
+RESULT_FILE=$1
+
+if [[ ! -x "$TEST_PATH$EXECUTABLE" ]]
+then
+    echo "$EXECUTABLE" Result:fail >> $RESULT_FILE
+fi
+
+FULL_CASE="$TEST_PATH$EXECUTABLE"
+echo "Calling $FULL_CASE from $0"
+$FULL_CASE >> $RESULT_FILE