Re: [PATCH 1/3 v3] selftests: Add tests for efivarfs

From: Andrew Morton
Date: Thu Feb 07 2013 - 18:13:40 EST


On Wed, 06 Feb 2013 22:48:08 +0800
Jeremy Kerr <jk@xxxxxxxxxx> wrote:

> This change adds a few initial efivarfs tests to the
> tools/testing/selftests directory.
>
> The open-unlink test is based on code from
> Lingzhu Xiang <lxiang@xxxxxxxxxx>.
>
> ...
>
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -1,4 +1,4 @@
> -TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug
> +TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug efivarfs

bah. This sort of Makefile construct is a wonderful source of patch
rejects and fixups. I'll covert this to

--- a/tools/testing/selftests/Makefile~a
+++ a/tools/testing/selftests/Makefile
@@ -1,4 +1,11 @@
-TARGETS = breakpoints epoll kcmp mqueue vm cpu-hotplug memory-hotplug efivarfs
+TARGETS = breakpoints
+TARGETS += epoll
+TARGETS += kcmp
+TARGETS += mqueue
+TARGETS += vm
+TARGETS += cpu-hotplug
+TARGETS += memory-hotplug
+TARGETS += efivarfs

all:
for TARGET in $(TARGETS); do \

> new file mode 100644
> index 0000000..1a943ee
> --- /dev/null
> +++ b/tools/testing/selftests/efivarfs/Makefile
> @@ -0,0 +1,12 @@
> +CC = $(CROSS_COMPILE)gcc
> +CFLAGS = -Wall
> +
> +test_objs = open-unlink
> +
> +all: $(test_objs)
> +
> +run_tests: all
> + @./efivarfs.sh || echo "efivarfs selftests: [FAIL]"

Problem. When I apply the patch, ./efivarfs.sh doesn't have execute
permissions. I don't think there's a way of (reliably?) transporting
this with patch and diff.

So we should explicitly invoke sh or /bin/sh or $SHELL or whatever
here. This problem is common to several Makefiles in tools/testing/selftests/

I'll do this for now:

--- a/tools/testing/selftests/efivarfs/Makefile~selftests-add-tests-for-efivarfs-fix
+++ a/tools/testing/selftests/efivarfs/Makefile
@@ -6,7 +6,7 @@ test_objs = open-unlink
all: $(test_objs)

run_tests: all
- @./efivarfs.sh || echo "efivarfs selftests: [FAIL]"
+ @/bin/sh ./efivarfs.sh || echo "efivarfs selftests: [FAIL]"

clean:
rm -f $(test_objs)

but I'm not sure I did it right :(


The general ruleset for selftests is: do as much as you can if you're not
root and don't take too long and don't break the build on any
architecture and don't cause the top-level "make run_tests" to fail if
your feature is unconfigured.

Does this code pass all that?
--
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/