diff mbox series

[v3,1/4] test: enable tests to run in no-huge mode

Message ID 20200313081614.195335-2-ruifeng.wang@arm.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers show
Series no-huge unit test | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Ruifeng Wang March 13, 2020, 8:16 a.m. UTC
When running with '--no-huge' flag, tests failed with messages as:
    ACL context creation with invalid NUMA should have failed!
    fbk hash creation should have failed
    test_table_pipeline: Check pipeline invalid params failed.

These cases test against invalid socket ID as input parameter, and
expect error return. But function calls return success because
invalid sock ID is overwritten to SOCKET_ID_ANY when in no-huge mode.

The tests against invalid socket ID are skipped in no-huge mode.

Fixes: 5640171c528a ("malloc: fix external heap allocation in no-huge mode")
Cc: stable@dpdk.org

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
---
 app/test/test_acl.c            | 22 ++++++++++++----------
 app/test/test_hash.c           |  7 +++++--
 app/test/test_table_pipeline.c | 12 +++++++-----
 3 files changed, 24 insertions(+), 17 deletions(-)

Comments

Aaron Conole March 17, 2020, 12:49 p.m. UTC | #1
Ruifeng Wang <ruifeng.wang@arm.com> writes:

> When running with '--no-huge' flag, tests failed with messages as:
>     ACL context creation with invalid NUMA should have failed!
>     fbk hash creation should have failed
>     test_table_pipeline: Check pipeline invalid params failed.
>
> These cases test against invalid socket ID as input parameter, and
> expect error return. But function calls return success because
> invalid sock ID is overwritten to SOCKET_ID_ANY when in no-huge mode.
>
> The tests against invalid socket ID are skipped in no-huge mode.
>
> Fixes: 5640171c528a ("malloc: fix external heap allocation in no-huge mode")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Gavin Hu <gavin.hu@arm.com>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>

>  app/test/test_acl.c            | 22 ++++++++++++----------
>  app/test/test_hash.c           |  7 +++++--
>  app/test/test_table_pipeline.c | 12 +++++++-----
>  3 files changed, 24 insertions(+), 17 deletions(-)
>
> diff --git a/app/test/test_acl.c b/app/test/test_acl.c
> index 501de35da..316bf4d06 100644
> --- a/app/test/test_acl.c
> +++ b/app/test/test_acl.c
> @@ -1397,16 +1397,18 @@ test_invalid_parameters(void)
>  	} else
>  		rte_acl_free(acx);
>  
> -	/* invalid NUMA node */
> -	memcpy(&param, &acl_param, sizeof(param));
> -	param.socket_id = RTE_MAX_NUMA_NODES + 1;
> -
> -	acx = rte_acl_create(&param);
> -	if (acx != NULL) {
> -		printf("Line %i: ACL context creation with invalid NUMA "
> -				"should have failed!\n", __LINE__);
> -		rte_acl_free(acx);
> -		return -1;
> +	if (rte_eal_has_hugepages()) {
> +		/* invalid NUMA node */
> +		memcpy(&param, &acl_param, sizeof(param));
> +		param.socket_id = RTE_MAX_NUMA_NODES + 1;
> +
> +		acx = rte_acl_create(&param);
> +		if (acx != NULL) {
> +			printf("Line %i: ACL context creation with invalid "
> +					"NUMA should have failed!\n", __LINE__);
> +			rte_acl_free(acx);
> +			return -1;
> +		}
>  	}
>  
>  	/* NULL name */
> diff --git a/app/test/test_hash.c b/app/test/test_hash.c
> index fbd5725c6..ab978ea68 100644
> --- a/app/test/test_hash.c
> +++ b/app/test/test_hash.c
> @@ -1136,8 +1136,11 @@ fbk_hash_unit_test(void)
>  	handle = rte_fbk_hash_create(&invalid_params_7);
>  	RETURN_IF_ERROR_FBK(handle != NULL, "fbk hash creation should have failed");
>  
> -	handle = rte_fbk_hash_create(&invalid_params_8);
> -	RETURN_IF_ERROR_FBK(handle != NULL, "fbk hash creation should have failed");
> +	if (rte_eal_has_hugepages()) {
> +		handle = rte_fbk_hash_create(&invalid_params_8);
> +		RETURN_IF_ERROR_FBK(handle != NULL,
> +					"fbk hash creation should have failed");
> +	}
>  
>  	handle = rte_fbk_hash_create(&invalid_params_same_name_1);
>  	RETURN_IF_ERROR_FBK(handle == NULL, "fbk hash creation should have succeeded");
> diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c
> index 441338ac0..bc412c308 100644
> --- a/app/test/test_table_pipeline.c
> +++ b/app/test/test_table_pipeline.c
> @@ -190,11 +190,13 @@ check_pipeline_invalid_params(void)
>  		goto fail;
>  	}
>  
> -	p = rte_pipeline_create(&pipeline_params_3);
> -	if (p != NULL) {
> -		RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with invalid "
> -			"socket\n", __func__);
> -		goto fail;
> +	if (rte_eal_has_hugepages()) {
> +		p = rte_pipeline_create(&pipeline_params_3);
> +		if (p != NULL) {
> +			RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with "
> +				"invalid socket\n", __func__);
> +			goto fail;
> +		}
>  	}
>  
>  	/* Check pipeline consistency */
Wang, Yipeng1 March 17, 2020, 7:15 p.m. UTC | #2
> -----Original Message-----
> From: Ruifeng Wang <ruifeng.wang@arm.com>
> Sent: Friday, March 13, 2020 1:16 AM
> To: aconole@redhat.com; maicolgabriel@hotmail.com; Richardson, Bruce
> <bruce.richardson@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Wang, Yipeng1
> <yipeng1.wang@intel.com>; Gobriel, Sameh <sameh.gobriel@intel.com>
> Cc: dev@dpdk.org; david.marchand@redhat.com; Burakov, Anatoly
> <anatoly.burakov@intel.com>; gavin.hu@arm.com;
> honnappa.nagarahalli@arm.com; juraj.linkes@pantheon.tech; nd@arm.com;
> Ruifeng Wang <ruifeng.wang@arm.com>; stable@dpdk.org
> Subject: [PATCH v3 1/4] test: enable tests to run in no-huge mode
> 
> When running with '--no-huge' flag, tests failed with messages as:
>     ACL context creation with invalid NUMA should have failed!
>     fbk hash creation should have failed
>     test_table_pipeline: Check pipeline invalid params failed.
> 
> These cases test against invalid socket ID as input parameter, and expect
> error return. But function calls return success because invalid sock ID is
> overwritten to SOCKET_ID_ANY when in no-huge mode.
> 
> The tests against invalid socket ID are skipped in no-huge mode.
> 
> Fixes: 5640171c528a ("malloc: fix external heap allocation in no-huge mode")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Gavin Hu <gavin.hu@arm.com>
> ---
>  app/test/test_acl.c            | 22 ++++++++++++----------
>  app/test/test_hash.c           |  7 +++++--
>  app/test/test_table_pipeline.c | 12 +++++++-----
>  3 files changed, 24 insertions(+), 17 deletions(-)
> 
> diff --git a/app/test/test_acl.c b/app/test/test_acl.c index
> 501de35da..316bf4d06 100644
> --- a/app/test/test_acl.c
> +++ b/app/test/test_acl.c
> @@ -1397,16 +1397,18 @@ test_invalid_parameters(void)
>  	} else
>  		rte_acl_free(acx);
> 
> -	/* invalid NUMA node */
> -	memcpy(&param, &acl_param, sizeof(param));
> -	param.socket_id = RTE_MAX_NUMA_NODES + 1;
> -
> -	acx = rte_acl_create(&param);
> -	if (acx != NULL) {
> -		printf("Line %i: ACL context creation with invalid NUMA "
> -				"should have failed!\n", __LINE__);
> -		rte_acl_free(acx);
> -		return -1;
> +	if (rte_eal_has_hugepages()) {
> +		/* invalid NUMA node */
> +		memcpy(&param, &acl_param, sizeof(param));
> +		param.socket_id = RTE_MAX_NUMA_NODES + 1;
> +
> +		acx = rte_acl_create(&param);
> +		if (acx != NULL) {
> +			printf("Line %i: ACL context creation with invalid "
> +					"NUMA should have failed!\n",
> __LINE__);
> +			rte_acl_free(acx);
> +			return -1;
> +		}
>  	}
> 
>  	/* NULL name */
> diff --git a/app/test/test_hash.c b/app/test/test_hash.c index
> fbd5725c6..ab978ea68 100644
> --- a/app/test/test_hash.c
> +++ b/app/test/test_hash.c
> @@ -1136,8 +1136,11 @@ fbk_hash_unit_test(void)
>  	handle = rte_fbk_hash_create(&invalid_params_7);
>  	RETURN_IF_ERROR_FBK(handle != NULL, "fbk hash creation should
> have failed");
> 
> -	handle = rte_fbk_hash_create(&invalid_params_8);
> -	RETURN_IF_ERROR_FBK(handle != NULL, "fbk hash creation should
> have failed");
> +	if (rte_eal_has_hugepages()) {
> +		handle = rte_fbk_hash_create(&invalid_params_8);
> +		RETURN_IF_ERROR_FBK(handle != NULL,
> +					"fbk hash creation should have
> failed");
> +	}
> 
>  	handle = rte_fbk_hash_create(&invalid_params_same_name_1);
>  	RETURN_IF_ERROR_FBK(handle == NULL, "fbk hash creation should

[Wang, Yipeng] 
For the hash table part:
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>

Just a side-note, not related to this patch,
should we add such info in programmer's guide for rte_malloc saying that if no-huge, then socket-id
Is not taken?
diff mbox series

Patch

diff --git a/app/test/test_acl.c b/app/test/test_acl.c
index 501de35da..316bf4d06 100644
--- a/app/test/test_acl.c
+++ b/app/test/test_acl.c
@@ -1397,16 +1397,18 @@  test_invalid_parameters(void)
 	} else
 		rte_acl_free(acx);
 
-	/* invalid NUMA node */
-	memcpy(&param, &acl_param, sizeof(param));
-	param.socket_id = RTE_MAX_NUMA_NODES + 1;
-
-	acx = rte_acl_create(&param);
-	if (acx != NULL) {
-		printf("Line %i: ACL context creation with invalid NUMA "
-				"should have failed!\n", __LINE__);
-		rte_acl_free(acx);
-		return -1;
+	if (rte_eal_has_hugepages()) {
+		/* invalid NUMA node */
+		memcpy(&param, &acl_param, sizeof(param));
+		param.socket_id = RTE_MAX_NUMA_NODES + 1;
+
+		acx = rte_acl_create(&param);
+		if (acx != NULL) {
+			printf("Line %i: ACL context creation with invalid "
+					"NUMA should have failed!\n", __LINE__);
+			rte_acl_free(acx);
+			return -1;
+		}
 	}
 
 	/* NULL name */
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index fbd5725c6..ab978ea68 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -1136,8 +1136,11 @@  fbk_hash_unit_test(void)
 	handle = rte_fbk_hash_create(&invalid_params_7);
 	RETURN_IF_ERROR_FBK(handle != NULL, "fbk hash creation should have failed");
 
-	handle = rte_fbk_hash_create(&invalid_params_8);
-	RETURN_IF_ERROR_FBK(handle != NULL, "fbk hash creation should have failed");
+	if (rte_eal_has_hugepages()) {
+		handle = rte_fbk_hash_create(&invalid_params_8);
+		RETURN_IF_ERROR_FBK(handle != NULL,
+					"fbk hash creation should have failed");
+	}
 
 	handle = rte_fbk_hash_create(&invalid_params_same_name_1);
 	RETURN_IF_ERROR_FBK(handle == NULL, "fbk hash creation should have succeeded");
diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c
index 441338ac0..bc412c308 100644
--- a/app/test/test_table_pipeline.c
+++ b/app/test/test_table_pipeline.c
@@ -190,11 +190,13 @@  check_pipeline_invalid_params(void)
 		goto fail;
 	}
 
-	p = rte_pipeline_create(&pipeline_params_3);
-	if (p != NULL) {
-		RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with invalid "
-			"socket\n", __func__);
-		goto fail;
+	if (rte_eal_has_hugepages()) {
+		p = rte_pipeline_create(&pipeline_params_3);
+		if (p != NULL) {
+			RTE_LOG(INFO, PIPELINE, "%s: Configure pipeline with "
+				"invalid socket\n", __func__);
+			goto fail;
+		}
 	}
 
 	/* Check pipeline consistency */