selftests: mqueue: delete RUN_TESTS and EMIT_TESTS overrides

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: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
Reviewed-by: default avatarAnders Roxell <anders.roxell@linaro.org>
Signed-off-by: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
parent addee42a
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
CFLAGS += -O2 CFLAGS += -O2
LDLIBS = -lrt -lpthread -lpopt LDLIBS = -lrt -lpthread -lpopt
TEST_GEN_PROGS := mq_open_tests mq_perf_tests TEST_GEN_PROGS := mq_open_tests mq_perf_tests
include ../lib.mk 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
...@@ -53,6 +53,7 @@ int saved_def_msgs, saved_def_msgsize, saved_max_msgs, saved_max_msgsize; ...@@ -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; int cur_def_msgs, cur_def_msgsize, cur_max_msgs, cur_max_msgsize;
FILE *def_msgs, *def_msgsize, *max_msgs, *max_msgsize; FILE *def_msgs, *def_msgsize, *max_msgs, *max_msgsize;
char *queue_path; char *queue_path;
char *default_queue_path = "/test1";
mqd_t queue = -1; mqd_t queue = -1;
static inline void __set(FILE *stream, int value, char *err_msg); static inline void __set(FILE *stream, int value, char *err_msg);
...@@ -238,10 +239,9 @@ int main(int argc, char *argv[]) ...@@ -238,10 +239,9 @@ int main(int argc, char *argv[])
struct mq_attr attr, result; struct mq_attr attr, result;
if (argc != 2) { if (argc != 2) {
fprintf(stderr, "Must pass a valid queue name\n\n"); printf("Using Default queue path - %s\n", default_queue_path);
fprintf(stderr, usage, argv[0]); queue_path = default_queue_path;
exit(1); } else {
}
/* /*
* Although we can create a msg queue with a non-absolute path name, * Although we can create a msg queue with a non-absolute path name,
...@@ -260,6 +260,7 @@ int main(int argc, char *argv[]) ...@@ -260,6 +260,7 @@ int main(int argc, char *argv[])
queue_path[1] = 0; queue_path[1] = 0;
strcat(queue_path, argv[1]); strcat(queue_path, argv[1]);
} }
}
if (getuid() != 0) { if (getuid() != 0) {
fprintf(stderr, "Not running as root, but almost all tests " fprintf(stderr, "Not running as root, but almost all tests "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment