Re: [PATCH 3/7] selftests: exec: fix for running and installing

From: Michael Ellerman
Date: Thu Aug 27 2015 - 06:55:37 EST


On Fri, 2015-08-14 at 21:43 +0800, Bamvor Jian Zhang wrote:
> Fix three issues in exec testcase:

In future please describe the issues you're trying to fix. Below you describe
only the *fixes*, which means I have to work backward to work out what the
issues were.

> Add RUN_TESTS rules in order to running the testcases in the build
> directory through "make TARGETS=exec kselftest"

OK so the problem here is that subdir isn't created when we're *not*
installing. It looks like we actually broke that in commit 84cbd9e4c457
("selftests/exec: do not install subdir as it is already created").

If so I think the fix is just to add subdir as a dependency of all isn't it?

> Copy symbol link and non-executable file instead of install it,
> otherwise this test will fail after installation.

And the problem here is that install wrecks the permissions, right?

> Exec testcases need a "Makefile" in line 346, otherwise it will
> be ENOENT instead of EACCES.

OK. It seems it would be cleaner to have the test create a specific test file,
rather than relying on the presence of the Makefile.


I've been wondering if we should just be using rsync to install the files,
rather than the current method. That way if the Makefile creates the correct
files, they should then appear exactly the same in the installed directory.

I had a quick look at it a while back, but didn't have time to test it 100%.
Does the patch below fix it for you?

cheers


diff --git a/tools/testing/selftests/ftrace/Makefile b/tools/testing/selftests/ftrace/Makefile
index 0acbeca47225..4e6ed13e7f66 100644
--- a/tools/testing/selftests/ftrace/Makefile
+++ b/tools/testing/selftests/ftrace/Makefile
@@ -1,7 +1,7 @@
all:

TEST_PROGS := ftracetest
-TEST_DIRS := test.d/
+TEST_DIRS := test.d

include ../lib.mk

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index ee412bab7ed4..7082b7e8a2ee 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -13,10 +13,7 @@ run_tests: all

define INSTALL_RULE
mkdir -p $(INSTALL_PATH)
- @for TEST_DIR in $(TEST_DIRS); do\
- cp -r $$TEST_DIR $(INSTALL_PATH); \
- done;
- install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
+ rsync -a $(TEST_DIRS) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/
endef

install: all





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/