Skip to contentSkip to conversation

selftests: android: delete RUN_TESTS and EMIT_TESTS overrides

PATCH In review Shuah Khan (Samsung OSG) 5 participants 13 messages May 2, 2018 – May 12, 2018

Subsystems (3)
lore
Share & tools
lore

Shuah Khan (Samsung OSG)

author maintainer
#0 lore raw

PATCH 1/1 selftests: android: delete RUN_TESTS and EMIT_TESTS overrides

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Common defines work just fine and there is no need to define custom overrides.

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>
---
 tools/testing/selftests/android/Makefile | 8 --------
 1 file changed, 8 deletions(-)
tools/testing/selftests/android/Makefile +0 -8
index f6304d2be90c..72c25a3cb658 100644
@@ -18,10 +18,6 @@ all:
 		fi \
 	done
 
-override define RUN_TESTS
-	@cd $(OUTPUT); ./run.sh
-endef
-
 override define INSTALL_RULE
 	mkdir -p $(INSTALL_PATH)
 	install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
@@ -33,10 +29,6 @@ override define INSTALL_RULE
 	done;
 endef
 
-override define EMIT_TESTS
-	echo "./run.sh"
-endef
-
 override define CLEAN
 	@for DIR in $(SUBDIRS); do		\
 		BUILD_TARGET=$(OUTPUT)/$$DIR;	\
Signature · 6 lines
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
author maintainer
#1 lore raw

PATCH 1/1 selftests: futex: delete RUN_TESTS and EMIT_TESTS overrides

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Common defines work just fine and there is no need to define custom overrides.

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>
---
 tools/testing/selftests/futex/Makefile | 12 ------------
 1 file changed, 12 deletions(-)
tools/testing/selftests/futex/Makefile +0 -12
index 8497a376ef9d..12631f0076a1 100644
@@ -17,14 +17,6 @@ all:
 		fi \
 	done
 
-override define RUN_TESTS
-	@export KSFT_TAP_LEVEL=`echo 1`;
-	@echo "TAP version 13";
-	@echo "selftests: futex";
-	@echo "========================================";
-	@cd $(OUTPUT); ./run.sh
-endef
-
 override define INSTALL_RULE
 	mkdir -p $(INSTALL_PATH)
 	install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
@@ -36,10 +28,6 @@ override define INSTALL_RULE
 	done;
 endef
 
-override define EMIT_TESTS
-	echo "./run.sh"
-endef
-
 override define CLEAN
 	@for DIR in $(SUBDIRS); do		\
 		BUILD_TARGET=$(OUTPUT)/$$DIR;	\
Signature · 6 lines
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
Reviewed-by on v1 1/1
#2 lore raw

Re: [PATCH] selftests: futex: delete RUN_TESTS and EMIT_TESTS overrides

Quoted 5 lines · Shuah Khan (Samsung OSG)

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Common defines work just fine and there is no need to define custom overrides.

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>
Reviewed-by Anders Roxell <anders.roxell at linaro.org>
Quoted 37 lines
---
 tools/testing/selftests/futex/Makefile | 12 ------------
 1 file changed, 12 deletions(-)
tools/testing/selftests/futex/Makefile +0 -12
index 8497a376ef9d..12631f0076a1 100644
@@ -17,14 +17,6 @@ all:
 		fi \
 	done
 
-override define RUN_TESTS
-	@export KSFT_TAP_LEVEL=`echo 1`;
-	@echo "TAP version 13";
-	@echo "selftests: futex";
-	@echo "========================================";
-	@cd $(OUTPUT); ./run.sh
-endef
-
 override define INSTALL_RULE
 	mkdir -p $(INSTALL_PATH)
 	install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
@@ -36,10 +28,6 @@ override define INSTALL_RULE
 	done;
 endef
 
-override define EMIT_TESTS
-	echo "./run.sh"
-endef
-
 override define CLEAN
 	@for DIR in $(SUBDIRS); do		\
 		BUILD_TARGET=$(OUTPUT)/$$DIR;	\
Signature · 1 line
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

reviewer Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH] selftests: futex: delete RUN_TESTS and EMIT_TESTS overrides

In reply to Shuah Khan (Samsung OSG)
Quoted 5 lines · Shuah Khan (Samsung OSG)

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Common defines work just fine and there is no need to define custom overrides.

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>

I was concerned because this override was a deliberate decision made in:

9705315b7562 selftests/futex: Update Makefile to use lib.mk

But reviewing lib.mk today, the RUN_TESTS and EMIT_TESTS perform the same function running TEST_PROGS.

Reviewed-by Darren Hart (VMware) <dvhart at infradead.org>
Signature · 6 lines
Darren Hart
VMware Open Source Technology Center
--
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
author maintainer
#4 lore raw

Re: [PATCH] selftests: futex: delete RUN_TESTS and EMIT_TESTS overrides

Quoted 10 lines · Darren Hart
Quoted 5 lines · Shuah Khan (Samsung OSG)

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Common defines work just fine and there is no need to define custom overrides.

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>

I was concerned because this override was a deliberate decision made in:

9705315b7562 selftests/futex: Update Makefile to use lib.mk

Yes I had the same concern.

Quoted 6 lines

But reviewing lib.mk today, the RUN_TESTS and EMIT_TESTS perform the same function running TEST_PROGS.

Reviewed-by Darren Hart (VMware) <dvhart at infradead.org>

Thanks. Yes I was surprised as well. I ran a few times to make sure. :)

-- Shuah
--
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

author maintainer
#5 lore raw

PATCH 1/1 selftests: memory-hotplug: delete RUN_TESTS and EMIT_TESTS overrides

In reply to Shuah Khan (Samsung OSG)

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Common defines work after making the change the test to run with ratio=2 as the default mode to be able to invoke the test without the "-r 2" argument from the common RUN_TESTS and EMIT_TESTS.

The run_full_tests target now calls the test with "-r 10".

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>
---
 tools/testing/selftests/memory-hotplug/Makefile           | 5 +----
 tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 3 ++-
 2 files changed, 3 insertions(+), 5 deletions(-)
tools/testing/selftests/memory-hotplug/Makefile +1 -4
index 686da510f989..e0a625e34f40 100644
@@ -4,11 +4,8 @@ all:
 include ../lib.mk
 
 TEST_PROGS := mem-on-off-test.sh
-override RUN_TESTS := @./mem-on-off-test.sh -r 2 && echo "selftests: memory-hotplug [PASS]" || echo "selftests: memory-hotplug [FAIL]"
-
-override EMIT_TESTS := echo "$(subst @,,$(RUN_TESTS))"
 
 run_full_test:
-	@/bin/bash ./mem-on-off-test.sh && echo "memory-hotplug selftests: [PASS]" || echo "memory-hotplug selftests: [FAIL]"
+	@/bin/bash ./mem-on-off-test.sh -r 10 && echo "memory-hotplug selftests: [PASS]" || echo "memory-hotplug selftests: [FAIL]"
 
 clean:
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +2 -1
index ae2c790d0880..ff4991704d07 100755
@@ -133,7 +133,8 @@ offline_memory_expect_fail()
 
 error=-12
 priority=0
-ratio=10
+# Run with default of ratio=2 for Kselftest run
+ratio=2
 retval=0
 
 while getopts e:hp:r: opt; do
Signature · 6 lines
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
Reviewed-by on v1 1/1
#6 lore raw

Re: [PATCH] selftests: memory-hotplug: delete RUN_TESTS and EMIT_TESTS overrides

Quoted 8 lines · Shuah Khan (Samsung OSG)

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Common defines work after making the change the test to run with ratio=2 as the default mode to be able to invoke the test without the "-r 2" argument from the common RUN_TESTS and EMIT_TESTS.

The run_full_tests target now calls the test with "-r 10".

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>
Reviewed-by Anders Roxell <anders.roxell at linaro.org>
Quoted 39 lines
---
 tools/testing/selftests/memory-hotplug/Makefile           | 5 +----
 tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 3 ++-
 2 files changed, 3 insertions(+), 5 deletions(-)
tools/testing/selftests/memory-hotplug/Makefile +1 -4
index 686da510f989..e0a625e34f40 100644
@@ -4,11 +4,8 @@ all:
 include ../lib.mk
 
 TEST_PROGS := mem-on-off-test.sh
-override RUN_TESTS := @./mem-on-off-test.sh -r 2 && echo "selftests: memory-hotplug [PASS]" || echo "selftests: memory-hotplug [FAIL]"
-
-override EMIT_TESTS := echo "$(subst @,,$(RUN_TESTS))"
 
 run_full_test:
-	@/bin/bash ./mem-on-off-test.sh && echo "memory-hotplug selftests: [PASS]" || echo "memory-hotplug selftests: [FAIL]"
+	@/bin/bash ./mem-on-off-test.sh -r 10 && echo "memory-hotplug selftests: [PASS]" || echo "memory-hotplug selftests: [FAIL]"
 
 clean:
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +2 -1
index ae2c790d0880..ff4991704d07 100755
@@ -133,7 +133,8 @@ offline_memory_expect_fail()
 
 error=-12
 priority=0
-ratio=10
+# Run with default of ratio=2 for Kselftest run
+ratio=2
 retval=0
 
 while getopts e:hp:r: opt; do
Signature · 1 line
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

Reviewed-by on v1 1/1
#7 lore raw

Re: [PATCH] selftests: memory-hotplug: delete RUN_TESTS and EMIT_TESTS overrides

In reply to Shuah Khan (Samsung OSG)
Quoted 8 lines · Shuah Khan (Samsung OSG)

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Common defines work after making the change the test to run with ratio=2 as the default mode to be able to invoke the test without the "-r 2" argument from the common RUN_TESTS and EMIT_TESTS.

The run_full_tests target now calls the test with "-r 10".

Reviewed-by [email protected]

Lei

Quoted 36 lines
---
  tools/testing/selftests/memory-hotplug/Makefile           | 5 +----
  tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 3 ++-
  2 files changed, 3 insertions(+), 5 deletions(-)
tools/testing/selftests/memory-hotplug/Makefile +1 -4
index 686da510f989..e0a625e34f40 100644
@@ -4,11 +4,8 @@ all:
  include ../lib.mk
 
  TEST_PROGS := mem-on-off-test.sh
-override RUN_TESTS := @./mem-on-off-test.sh -r 2 && echo "selftests: memory-hotplug [PASS]" || echo "selftests: memory-hotplug [FAIL]"
-
-override EMIT_TESTS := echo "$(subst @,,$(RUN_TESTS))"
 
  run_full_test:
-	@/bin/bash ./mem-on-off-test.sh && echo "memory-hotplug selftests: [PASS]" || echo "memory-hotplug selftests: [FAIL]"
+	@/bin/bash ./mem-on-off-test.sh -r 10 && echo "memory-hotplug selftests: [PASS]" || echo "memory-hotplug selftests: [FAIL]"
 
  clean:
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +2 -1
index ae2c790d0880..ff4991704d07 100755
@@ -133,7 +133,8 @@ offline_memory_expect_fail()
 
  error=-12
  priority=0
-ratio=10
+# Run with default of ratio=2 for Kselftest run
+ratio=2
  retval=0
 
  while getopts e:hp:r: opt; do
author maintainer
#8 lore raw

PATCH 1/1 selftests: mount: delete RUN_TESTS and EMIT_TESTS overrides

In reply to Shuah Khan (Samsung OSG)

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Add new run_tests.sh to do the dependency checks the custom RUN_TESTS did. Common defines work with the run_tests.sh set as the TEST_PROGS and defining unprivileged-remount-test in TEST_GEN_FILES.

Kselftest framework builds and installs TEST_GEN_FILES and doesn't run them via RUN_TESTS and include it in EMIT_TESTS. With this change the new run_tests.sh runs the test after checking dependencies.

This change also adds Skip handling to return kselftest skip code when test is skipped to clearly identify when the test is skipped instead of reporting it as failed.

Output with this change:

TAP version 13
selftests: mount: run_tests.sh
========================================
WARN: No /proc/self/uid_map exist, test skipped.
not ok 1..1 selftests: mount: run_tests.sh [SKIP]

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>
---
 tools/testing/selftests/mount/Makefile     | 12 ++----------
 tools/testing/selftests/mount/run_tests.sh | 12 ++++++++++++
 2 files changed, 14 insertions(+), 10 deletions(-)
 create mode 100755 tools/testing/selftests/mount/run_tests.sh
tools/testing/selftests/mount/Makefile +2 -10
index e094f71c6dbc..026890744215 100644
@@ -3,15 +3,7 @@
 CFLAGS = -Wall \
          -O2
 
-TEST_GEN_PROGS := unprivileged-remount-test
+TEST_PROGS := run_tests.sh
+TEST_GEN_FILES := unprivileged-remount-test
 
 include ../lib.mk
-
-override RUN_TESTS := if [ -f /proc/self/uid_map ] ; \
-		      then	\
-				./unprivileged-remount-test ; \
-		      else	\
-				echo "WARN: No /proc/self/uid_map exist, test skipped." ; \
-		      fi
-override EMIT_TESTS := echo "$(RUN_TESTS)"
-
tools/testing/selftests/mount/run_tests.sh new file +12 -0
new file mode 100755
index 000000000000..4ab8f507dcba
@@ -0,0 +1,12 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
+# Run mount selftests
+if [ -f /proc/self/uid_map ] ; then
+	./unprivileged-remount-test ;
+else
+	echo "WARN: No /proc/self/uid_map exist, test skipped." ;
+	exit $ksft_skip
+fi
Signature · 6 lines
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
Reviewed-by on v1 1/1
#9 lore raw

Re: [PATCH] selftests: mount: delete RUN_TESTS and EMIT_TESTS overrides

Quoted 15 lines · Shuah Khan (Samsung OSG)

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Add new run_tests.sh to do the dependency checks the custom RUN_TESTS did. Common defines work with the run_tests.sh set as the TEST_PROGS and defining unprivileged-remount-test in TEST_GEN_FILES.

Kselftest framework builds and installs TEST_GEN_FILES and doesn't run them via RUN_TESTS and include it in EMIT_TESTS. With this change the new run_tests.sh runs the test after checking dependencies.

This change also adds Skip handling to return kselftest skip code when test is skipped to clearly identify when the test is skipped instead of reporting it as failed.

Output with this change:

Quoted 7 lines

TAP version 13
selftests: mount: run_tests.sh
========================================
WARN: No /proc/self/uid_map exist, test skipped.
not ok 1..1 selftests: mount: run_tests.sh [SKIP]

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>
Reviewed-by Anders Roxell <anders.roxell at linaro.org>
Quoted 49 lines
---
 tools/testing/selftests/mount/Makefile     | 12 ++----------
 tools/testing/selftests/mount/run_tests.sh | 12 ++++++++++++
 2 files changed, 14 insertions(+), 10 deletions(-)
 create mode 100755 tools/testing/selftests/mount/run_tests.sh
tools/testing/selftests/mount/Makefile +2 -10
index e094f71c6dbc..026890744215 100644
@@ -3,15 +3,7 @@
 CFLAGS = -Wall \
          -O2
 
-TEST_GEN_PROGS := unprivileged-remount-test
+TEST_PROGS := run_tests.sh
+TEST_GEN_FILES := unprivileged-remount-test
 
 include ../lib.mk
-
-override RUN_TESTS := if [ -f /proc/self/uid_map ] ; \
-		      then	\
-				./unprivileged-remount-test ; \
-		      else	\
-				echo "WARN: No /proc/self/uid_map exist, test skipped." ; \
-		      fi
-override EMIT_TESTS := echo "$(RUN_TESTS)"
-
tools/testing/selftests/mount/run_tests.sh new file +12 -0
new file mode 100755
index 000000000000..4ab8f507dcba
@@ -0,0 +1,12 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
+# Run mount selftests
+if [ -f /proc/self/uid_map ] ; then
+	./unprivileged-remount-test ;
+else
+	echo "WARN: No /proc/self/uid_map exist, test skipped." ;
+	exit $ksft_skip
+fi
Signature · 1 line
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

author maintainer
#10 lore raw

PATCH 1/1 selftests: mqueue: delete RUN_TESTS and EMIT_TESTS overrides

In reply to Shuah Khan (Samsung OSG)

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>
---
 tools/testing/selftests/mqueue/Makefile        | 12 +----------
 tools/testing/selftests/mqueue/mq_open_tests.c | 29 +++++++++++++-------------
 2 files changed, 16 insertions(+), 25 deletions(-)
tools/testing/selftests/mqueue/Makefile +1 -11
index 743d3f9e5918..8a58055fc1f5 100644
@@ -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
-
tools/testing/selftests/mqueue/mq_open_tests.c +15 -14
index e0a74bd207a5..677140aa25fd 100644
@@ -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) {
Signature · 6 lines
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
Reviewed-by on v1 1/1
#11 lore raw

Re: [PATCH] selftests: mqueue: delete RUN_TESTS and EMIT_TESTS overrides

Quoted 6 lines · Shuah Khan (Samsung OSG)

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>
Quoted 89 lines
---
 tools/testing/selftests/mqueue/Makefile        | 12 +----------
 tools/testing/selftests/mqueue/mq_open_tests.c | 29 +++++++++++++-------------
 2 files changed, 16 insertions(+), 25 deletions(-)
tools/testing/selftests/mqueue/Makefile +1 -11
index 743d3f9e5918..8a58055fc1f5 100644
@@ -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
-
tools/testing/selftests/mqueue/mq_open_tests.c +15 -14
index e0a74bd207a5..677140aa25fd 100644
@@ -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) {
Signature · 6 lines
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
Signature · 7 lines
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
Acked-by on v1 1/1
#12 lore raw
In reply to Shuah Khan (Samsung OSG)
Quoted 36 lines · Shuah Khan (Samsung OSG)

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in lib.mk. Common defines work just fine and there is no need to define custom overrides.

Signed-off-by Shuah Khan (Samsung OSG) <shuah at kernel.org>
---
 tools/testing/selftests/android/Makefile | 8 --------
 1 file changed, 8 deletions(-)
tools/testing/selftests/android/Makefile +0 -9
index f6304d2be90c..72c25a3cb658 100644
@@ -18,10 +18,6 @@ all:
                fi \
        done
 
-override define RUN_TESTS
-       @cd $(OUTPUT); ./run.sh
-endef
-
 override define INSTALL_RULE
        mkdir -p $(INSTALL_PATH)
        install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
@@ -33,10 +29,6 @@ override define INSTALL_RULE
        done;
 endef
 
-override define EMIT_TESTS
-       echo "./run.sh"
-endef
-
 override define CLEAN
        @for DIR in $(SUBDIRS); do              \
                BUILD_TARGET=$(OUTPUT)/$$DIR;   \
--
Quoted 2 lines

2.14.1

OK.

Acked-by Pintu Agarwal <pintu.ping at gmail.com>

---

Note: This mail goes into my spam email box.
--
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