All of lore.kernel.org
 help / color / mirror / Atom feed
From: anders.roxell at linaro.org (Anders Roxell)
Subject: [PATCH] selftests: mqueue: delete RUN_TESTS and EMIT_TESTS overrides
Date: Wed, 9 May 2018 11:49:36 +0200	[thread overview]
Message-ID: <20180509094936.GD10043@localhost.localdomain> (raw)
In-Reply-To: <20180502211848.22404-5-shuah@kernel.org>

On 2018-05-02 15:18, Shuah Khan (Samsung OSG) wrote:
> Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk.
> The overrides are in place to call mq_open_tests with queue name argument.
> The change to delete overrides is coupled with a change to mq_open_tests
> to use default queue name when it is called without one.
> 
> Signed-off-by: Shuah Khan (Samsung OSG) <shuah at kernel.org>

Reviewed-by: Anders Roxell <anders.roxell at linaro.org>

> ---
>  tools/testing/selftests/mqueue/Makefile        | 12 +----------
>  tools/testing/selftests/mqueue/mq_open_tests.c | 29 +++++++++++++-------------
>  2 files changed, 16 insertions(+), 25 deletions(-)
> 
> diff --git a/tools/testing/selftests/mqueue/Makefile b/tools/testing/selftests/mqueue/Makefile
> index 743d3f9e5918..8a58055fc1f5 100644
> --- a/tools/testing/selftests/mqueue/Makefile
> +++ b/tools/testing/selftests/mqueue/Makefile
> @@ -1,17 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
>  CFLAGS += -O2
>  LDLIBS = -lrt -lpthread -lpopt
> +
>  TEST_GEN_PROGS := mq_open_tests mq_perf_tests
>  
>  include ../lib.mk
> -
> -override define RUN_TESTS
> -	@$(OUTPUT)/mq_open_tests /test1 || echo "selftests: mq_open_tests [FAIL]"
> -	@$(OUTPUT)/mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]"
> -endef
> -
> -override define EMIT_TESTS
> -	echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests [FAIL]\""
> -	echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
> -endef
> -
> diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c
> index e0a74bd207a5..677140aa25fd 100644
> --- a/tools/testing/selftests/mqueue/mq_open_tests.c
> +++ b/tools/testing/selftests/mqueue/mq_open_tests.c
> @@ -53,6 +53,7 @@ int saved_def_msgs, saved_def_msgsize, saved_max_msgs, saved_max_msgsize;
>  int cur_def_msgs, cur_def_msgsize, cur_max_msgs, cur_max_msgsize;
>  FILE *def_msgs, *def_msgsize, *max_msgs, *max_msgsize;
>  char *queue_path;
> +char *default_queue_path = "/test1";
>  mqd_t queue = -1;
>  
>  static inline void __set(FILE *stream, int value, char *err_msg);
> @@ -238,27 +239,27 @@ int main(int argc, char *argv[])
>  	struct mq_attr attr, result;
>  
>  	if (argc != 2) {
> -		fprintf(stderr, "Must pass a valid queue name\n\n");
> -		fprintf(stderr, usage, argv[0]);
> -		exit(1);
> -	}
> +		printf("Using Default queue path - %s\n", default_queue_path);
> +		queue_path = default_queue_path;
> +	} else {
>  
>  	/*
>  	 * Although we can create a msg queue with a non-absolute path name,
>  	 * unlink will fail.  So, if the name doesn't start with a /, add one
>  	 * when we save it.
>  	 */
> -	if (*argv[1] == '/')
> -		queue_path = strdup(argv[1]);
> -	else {
> -		queue_path = malloc(strlen(argv[1]) + 2);
> -		if (!queue_path) {
> -			perror("malloc()");
> -			exit(1);
> +		if (*argv[1] == '/')
> +			queue_path = strdup(argv[1]);
> +		else {
> +			queue_path = malloc(strlen(argv[1]) + 2);
> +			if (!queue_path) {
> +				perror("malloc()");
> +				exit(1);
> +			}
> +			queue_path[0] = '/';
> +			queue_path[1] = 0;
> +			strcat(queue_path, argv[1]);
>  		}
> -		queue_path[0] = '/';
> -		queue_path[1] = 0;
> -		strcat(queue_path, argv[1]);
>  	}
>  
>  	if (getuid() != 0) {
> -- 
> 2.14.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Anders Roxell
anders.roxell at linaro.org
M: +46 709 71 42 85 | IRC: roxell
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: anders.roxell@linaro.org (Anders Roxell)
Subject: [PATCH] selftests: mqueue: delete RUN_TESTS and EMIT_TESTS overrides
Date: Wed, 9 May 2018 11:49:36 +0200	[thread overview]
Message-ID: <20180509094936.GD10043@localhost.localdomain> (raw)
Message-ID: <20180509094936.yNLrsC2Sl0JIIN57q6ZdY9_oG2OHVTuQWWROQe5TWOw@z> (raw)
In-Reply-To: <20180502211848.22404-5-shuah@kernel.org>

On 2018-05-02 15:18, Shuah Khan (Samsung OSG) wrote:
> Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk.
> The overrides are in place to call mq_open_tests with queue name argument.
> The change to delete overrides is coupled with a change to mq_open_tests
> to use default queue name when it is called without one.
> 
> Signed-off-by: Shuah Khan (Samsung OSG) <shuah at kernel.org>

Reviewed-by: Anders Roxell <anders.roxell at linaro.org>

> ---
>  tools/testing/selftests/mqueue/Makefile        | 12 +----------
>  tools/testing/selftests/mqueue/mq_open_tests.c | 29 +++++++++++++-------------
>  2 files changed, 16 insertions(+), 25 deletions(-)
> 
> diff --git a/tools/testing/selftests/mqueue/Makefile b/tools/testing/selftests/mqueue/Makefile
> index 743d3f9e5918..8a58055fc1f5 100644
> --- a/tools/testing/selftests/mqueue/Makefile
> +++ b/tools/testing/selftests/mqueue/Makefile
> @@ -1,17 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
>  CFLAGS += -O2
>  LDLIBS = -lrt -lpthread -lpopt
> +
>  TEST_GEN_PROGS := mq_open_tests mq_perf_tests
>  
>  include ../lib.mk
> -
> -override define RUN_TESTS
> -	@$(OUTPUT)/mq_open_tests /test1 || echo "selftests: mq_open_tests [FAIL]"
> -	@$(OUTPUT)/mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]"
> -endef
> -
> -override define EMIT_TESTS
> -	echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests [FAIL]\""
> -	echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
> -endef
> -
> diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c
> index e0a74bd207a5..677140aa25fd 100644
> --- a/tools/testing/selftests/mqueue/mq_open_tests.c
> +++ b/tools/testing/selftests/mqueue/mq_open_tests.c
> @@ -53,6 +53,7 @@ int saved_def_msgs, saved_def_msgsize, saved_max_msgs, saved_max_msgsize;
>  int cur_def_msgs, cur_def_msgsize, cur_max_msgs, cur_max_msgsize;
>  FILE *def_msgs, *def_msgsize, *max_msgs, *max_msgsize;
>  char *queue_path;
> +char *default_queue_path = "/test1";
>  mqd_t queue = -1;
>  
>  static inline void __set(FILE *stream, int value, char *err_msg);
> @@ -238,27 +239,27 @@ int main(int argc, char *argv[])
>  	struct mq_attr attr, result;
>  
>  	if (argc != 2) {
> -		fprintf(stderr, "Must pass a valid queue name\n\n");
> -		fprintf(stderr, usage, argv[0]);
> -		exit(1);
> -	}
> +		printf("Using Default queue path - %s\n", default_queue_path);
> +		queue_path = default_queue_path;
> +	} else {
>  
>  	/*
>  	 * Although we can create a msg queue with a non-absolute path name,
>  	 * unlink will fail.  So, if the name doesn't start with a /, add one
>  	 * when we save it.
>  	 */
> -	if (*argv[1] == '/')
> -		queue_path = strdup(argv[1]);
> -	else {
> -		queue_path = malloc(strlen(argv[1]) + 2);
> -		if (!queue_path) {
> -			perror("malloc()");
> -			exit(1);
> +		if (*argv[1] == '/')
> +			queue_path = strdup(argv[1]);
> +		else {
> +			queue_path = malloc(strlen(argv[1]) + 2);
> +			if (!queue_path) {
> +				perror("malloc()");
> +				exit(1);
> +			}
> +			queue_path[0] = '/';
> +			queue_path[1] = 0;
> +			strcat(queue_path, argv[1]);
>  		}
> -		queue_path[0] = '/';
> -		queue_path[1] = 0;
> -		strcat(queue_path, argv[1]);
>  	}
>  
>  	if (getuid() != 0) {
> -- 
> 2.14.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Anders Roxell
anders.roxell at linaro.org
M: +46 709 71 42 85 | IRC: roxell
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Anders Roxell <anders.roxell@linaro.org>
To: "Shuah Khan (Samsung OSG)" <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: mqueue: delete RUN_TESTS and EMIT_TESTS overrides
Date: Wed, 9 May 2018 11:49:36 +0200	[thread overview]
Message-ID: <20180509094936.GD10043@localhost.localdomain> (raw)
In-Reply-To: <20180502211848.22404-5-shuah@kernel.org>

On 2018-05-02 15:18, Shuah Khan (Samsung OSG) wrote:
> Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk.
> The overrides are in place to call mq_open_tests with queue name argument.
> The change to delete overrides is coupled with a change to mq_open_tests
> to use default queue name when it is called without one.
> 
> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>

Reviewed-by: Anders Roxell <anders.roxell@linaro.org>

> ---
>  tools/testing/selftests/mqueue/Makefile        | 12 +----------
>  tools/testing/selftests/mqueue/mq_open_tests.c | 29 +++++++++++++-------------
>  2 files changed, 16 insertions(+), 25 deletions(-)
> 
> diff --git a/tools/testing/selftests/mqueue/Makefile b/tools/testing/selftests/mqueue/Makefile
> index 743d3f9e5918..8a58055fc1f5 100644
> --- a/tools/testing/selftests/mqueue/Makefile
> +++ b/tools/testing/selftests/mqueue/Makefile
> @@ -1,17 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
>  CFLAGS += -O2
>  LDLIBS = -lrt -lpthread -lpopt
> +
>  TEST_GEN_PROGS := mq_open_tests mq_perf_tests
>  
>  include ../lib.mk
> -
> -override define RUN_TESTS
> -	@$(OUTPUT)/mq_open_tests /test1 || echo "selftests: mq_open_tests [FAIL]"
> -	@$(OUTPUT)/mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]"
> -endef
> -
> -override define EMIT_TESTS
> -	echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests [FAIL]\""
> -	echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
> -endef
> -
> diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c
> index e0a74bd207a5..677140aa25fd 100644
> --- a/tools/testing/selftests/mqueue/mq_open_tests.c
> +++ b/tools/testing/selftests/mqueue/mq_open_tests.c
> @@ -53,6 +53,7 @@ int saved_def_msgs, saved_def_msgsize, saved_max_msgs, saved_max_msgsize;
>  int cur_def_msgs, cur_def_msgsize, cur_max_msgs, cur_max_msgsize;
>  FILE *def_msgs, *def_msgsize, *max_msgs, *max_msgsize;
>  char *queue_path;
> +char *default_queue_path = "/test1";
>  mqd_t queue = -1;
>  
>  static inline void __set(FILE *stream, int value, char *err_msg);
> @@ -238,27 +239,27 @@ int main(int argc, char *argv[])
>  	struct mq_attr attr, result;
>  
>  	if (argc != 2) {
> -		fprintf(stderr, "Must pass a valid queue name\n\n");
> -		fprintf(stderr, usage, argv[0]);
> -		exit(1);
> -	}
> +		printf("Using Default queue path - %s\n", default_queue_path);
> +		queue_path = default_queue_path;
> +	} else {
>  
>  	/*
>  	 * Although we can create a msg queue with a non-absolute path name,
>  	 * unlink will fail.  So, if the name doesn't start with a /, add one
>  	 * when we save it.
>  	 */
> -	if (*argv[1] == '/')
> -		queue_path = strdup(argv[1]);
> -	else {
> -		queue_path = malloc(strlen(argv[1]) + 2);
> -		if (!queue_path) {
> -			perror("malloc()");
> -			exit(1);
> +		if (*argv[1] == '/')
> +			queue_path = strdup(argv[1]);
> +		else {
> +			queue_path = malloc(strlen(argv[1]) + 2);
> +			if (!queue_path) {
> +				perror("malloc()");
> +				exit(1);
> +			}
> +			queue_path[0] = '/';
> +			queue_path[1] = 0;
> +			strcat(queue_path, argv[1]);
>  		}
> -		queue_path[0] = '/';
> -		queue_path[1] = 0;
> -		strcat(queue_path, argv[1]);
>  	}
>  
>  	if (getuid() != 0) {
> -- 
> 2.14.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Anders Roxell
anders.roxell@linaro.org
M: +46 709 71 42 85 | IRC: roxell

  reply	other threads:[~2018-05-09  9:49 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 21:18 [PATCH] selftests: android: delete RUN_TESTS and EMIT_TESTS overrides shuah
2018-05-02 21:18 ` Shuah Khan (Samsung OSG)
2018-05-02 21:18 ` Shuah Khan (Samsung OSG)
2018-05-02 21:18 ` [PATCH] selftests: futex: " shuah
2018-05-02 21:18   ` Shuah Khan (Samsung OSG)
2018-05-02 21:18   ` Shuah Khan (Samsung OSG)
2018-05-09  9:46   ` anders.roxell
2018-05-09  9:46     ` Anders Roxell
2018-05-09  9:46     ` Anders Roxell
2018-05-11 15:13   ` dvhart
2018-05-11 15:13     ` Darren Hart
2018-05-11 15:13     ` Darren Hart
2018-05-11 15:25     ` shuah
2018-05-11 15:25       ` Shuah Khan
2018-05-11 15:25       ` Shuah Khan
2018-05-02 21:18 ` [PATCH] selftests: memory-hotplug: " shuah
2018-05-02 21:18   ` Shuah Khan (Samsung OSG)
2018-05-02 21:18   ` Shuah Khan (Samsung OSG)
2018-05-09  9:46   ` anders.roxell
2018-05-09  9:46     ` Anders Roxell
2018-05-09  9:46     ` Anders Roxell
2018-05-09 11:39   ` lei.yang
2018-05-09 11:39     ` lei yang
2018-05-09 11:39     ` lei yang
2018-05-02 21:18 ` [PATCH] selftests: mount: " shuah
2018-05-02 21:18   ` Shuah Khan (Samsung OSG)
2018-05-02 21:18   ` Shuah Khan (Samsung OSG)
2018-05-09  9:49   ` anders.roxell
2018-05-09  9:49     ` Anders Roxell
2018-05-09  9:49     ` Anders Roxell
2018-05-02 21:18 ` [PATCH] selftests: mqueue: " shuah
2018-05-02 21:18   ` Shuah Khan (Samsung OSG)
2018-05-02 21:18   ` Shuah Khan (Samsung OSG)
2018-05-09  9:49   ` anders.roxell [this message]
2018-05-09  9:49     ` Anders Roxell
2018-05-09  9:49     ` Anders Roxell
2018-05-12 16:12 ` [PATCH] selftests: android: " pintu.ping
2018-05-12 16:12   ` Pintu Kumar
2018-05-12 16:12   ` Pintu Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180509094936.GD10043@localhost.localdomain \
    --to=unknown@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.