diff mbox

[PATCHv2] test/api_test/odp_atomic: enable testcase 7

Message ID 1397558816-12035-1-git-send-email-anders.roxell@linaro.org
State Accepted
Headers show

Commit Message

Anders Roxell April 15, 2014, 10:46 a.m. UTC
wasn't able to run testcase 7, said:
"Invalid test case [7]"

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 test/api_test/odp_atomic_test.c |  4 +++-
 test/api_test/odp_atomic_test.h | 18 ++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)

Comments

Venkatesh Vivekanandan April 15, 2014, 11:22 a.m. UTC | #1
Hi Anders,

New patch looks fine to me.

Thanks,
Venkatesh.


On 15 April 2014 16:16, Anders Roxell <anders.roxell@linaro.org> wrote:

> wasn't able to run testcase 7, said:
> "Invalid test case [7]"
>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>  test/api_test/odp_atomic_test.c |  4 +++-
>  test/api_test/odp_atomic_test.h | 18 ++++++++++--------
>  2 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/test/api_test/odp_atomic_test.c
> b/test/api_test/odp_atomic_test.c
> index ea443a0..3f95d3d 100644
> --- a/test/api_test/odp_atomic_test.c
> +++ b/test/api_test/odp_atomic_test.c
> @@ -17,6 +17,7 @@ static odp_atomic_u64_t a64u;
>  static odp_atomic_int_t numthrds;
>
>  static const char * const test_name[] = {
> +       "dummy",
>         "test atomic basic ops add/sub/inc/dec",
>         "test atomic inc/dec of signed word",
>         "test atomic add/sub of signed word",
> @@ -334,10 +335,11 @@ int main(int argc, char *argv[])
>         thrdarg.testcase = test_type;
>         thrdarg.numthrds = pthrdnum;
>
> -       if ((test_type > 0) && (test_type < 7)) {
> +       if ((test_type > 0) && (test_type < TEST_MAX)) {
>                 printf("%s\n", test_name[test_type]);
>         } else {
>                 ODP_ERR("Invalid test case [%d]\n", test_type);
> +               usage();
>                 goto err_exit;
>         }
>         odp_test_thread_create(run_thread, &thrdarg);
> diff --git a/test/api_test/odp_atomic_test.h
> b/test/api_test/odp_atomic_test.h
> index 04dde72..d6eec04 100644
> --- a/test/api_test/odp_atomic_test.h
> +++ b/test/api_test/odp_atomic_test.h
> @@ -22,14 +22,16 @@
>  #define        U32_INIT_VAL    (1UL << 10)
>  #define        U64_INIT_VAL    (1ULL << 33)
>
> -#define        TEST_MIX                1 /* Must be first test case num */
> -#define        TEST_INC_DEC_S32        2
> -#define        TEST_ADD_SUB_S32        3
> -#define        TEST_INC_DEC_U32        4
> -#define        TEST_ADD_SUB_U32        5
> -#define        TEST_INC_DEC_64         6
> -#define        TEST_ADD_SUB_64         7
> -#define        TEST_MAX                7 /* This must match the last test
> case num */
> +typedef enum {
> +       TEST_MIX = 1, /* Must be first test case num */
> +       TEST_INC_DEC_S32,
> +       TEST_ADD_SUB_S32,
> +       TEST_INC_DEC_U32,
> +       TEST_ADD_SUB_U32,
> +       TEST_INC_DEC_64,
> +       TEST_ADD_SUB_64,
> +       TEST_MAX,
> +} odp_test_atomic_t;
>
>
>  void test_atomic_inc_dec_32(void);
> --
> 1.8.3.2
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/test/api_test/odp_atomic_test.c b/test/api_test/odp_atomic_test.c
index ea443a0..3f95d3d 100644
--- a/test/api_test/odp_atomic_test.c
+++ b/test/api_test/odp_atomic_test.c
@@ -17,6 +17,7 @@  static odp_atomic_u64_t a64u;
 static odp_atomic_int_t numthrds;
 
 static const char * const test_name[] = {
+	"dummy",
 	"test atomic basic ops add/sub/inc/dec",
 	"test atomic inc/dec of signed word",
 	"test atomic add/sub of signed word",
@@ -334,10 +335,11 @@  int main(int argc, char *argv[])
 	thrdarg.testcase = test_type;
 	thrdarg.numthrds = pthrdnum;
 
-	if ((test_type > 0) && (test_type < 7)) {
+	if ((test_type > 0) && (test_type < TEST_MAX)) {
 		printf("%s\n", test_name[test_type]);
 	} else {
 		ODP_ERR("Invalid test case [%d]\n", test_type);
+		usage();
 		goto err_exit;
 	}
 	odp_test_thread_create(run_thread, &thrdarg);
diff --git a/test/api_test/odp_atomic_test.h b/test/api_test/odp_atomic_test.h
index 04dde72..d6eec04 100644
--- a/test/api_test/odp_atomic_test.h
+++ b/test/api_test/odp_atomic_test.h
@@ -22,14 +22,16 @@ 
 #define	U32_INIT_VAL	(1UL << 10)
 #define	U64_INIT_VAL	(1ULL << 33)
 
-#define	TEST_MIX		1 /* Must be first test case num */
-#define	TEST_INC_DEC_S32	2
-#define	TEST_ADD_SUB_S32	3
-#define	TEST_INC_DEC_U32	4
-#define	TEST_ADD_SUB_U32	5
-#define	TEST_INC_DEC_64		6
-#define	TEST_ADD_SUB_64		7
-#define	TEST_MAX		7 /* This must match the last test case num */
+typedef enum {
+	TEST_MIX = 1, /* Must be first test case num */
+	TEST_INC_DEC_S32,
+	TEST_ADD_SUB_S32,
+	TEST_INC_DEC_U32,
+	TEST_ADD_SUB_U32,
+	TEST_INC_DEC_64,
+	TEST_ADD_SUB_64,
+	TEST_MAX,
+} odp_test_atomic_t;
 
 
 void test_atomic_inc_dec_32(void);