All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Shuah Khan <shuahkh@osg.samsung.com>
Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
	Brian Norris <computersforpeace@gmail.com>,
	Kees Cook <keescook@chromium.org>
Subject: [RFC] selftests: report proper exit statuses
Date: Fri, 11 Dec 2015 15:15:06 -0800	[thread overview]
Message-ID: <1449875706-106875-1-git-send-email-computersforpeace@gmail.com> (raw)

There are several places where we don't report proper exit statuses, and
this can have consequences -- for instance, the gen_kselftest_tar.sh
script might try to produce a tarball for you, even if the 'make' or
'make install' steps didn't complete properly.

This is only an RFC (and really, it's more like a bug report), since I'm
not really satisfied with my solution. It's probably not exhaustive, and
there seem to be some major other deficiencies (e.g., verbose/useless
output during build and run, non-paralle build, shell for-loops sidestep
some normal 'make' behavior). I could try to address them, but I'm not
sure how much effort I'd care to put in, and I'm not sure if there are
others who have a more comprehensive plan for cleaning up this
directory.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 tools/testing/selftests/Makefile             |  6 +++---
 tools/testing/selftests/gen_kselftest_tar.sh | 10 ++++++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index c8edff6803d1..f89893c590d5 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -44,7 +44,7 @@ endif
 
 all:
 	for TARGET in $(TARGETS); do \
-		make -C $$TARGET; \
+		make -C $$TARGET || exit 1; \
 	done;
 
 run_tests: all
@@ -54,7 +54,7 @@ run_tests: all
 
 hotplug:
 	for TARGET in $(TARGETS_HOTPLUG); do \
-		make -C $$TARGET; \
+		make -C $$TARGET || exit 1; \
 	done;
 
 run_hotplug: hotplug
@@ -79,7 +79,7 @@ ifdef INSTALL_PATH
 	@# Ask all targets to install their files
 	mkdir -p $(INSTALL_PATH)
 	for TARGET in $(TARGETS); do \
-		make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
+		make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install || exit 1; \
 	done;
 
 	@# Ask all targets to emit their test scripts
diff --git a/tools/testing/selftests/gen_kselftest_tar.sh b/tools/testing/selftests/gen_kselftest_tar.sh
index 17d5bd0c0936..160da4e82936 100755
--- a/tools/testing/selftests/gen_kselftest_tar.sh
+++ b/tools/testing/selftests/gen_kselftest_tar.sh
@@ -44,12 +44,14 @@ main()
 
 # Run install using INSTALL_KSFT_PATH override to generate install
 # directory
-./kselftest_install.sh
-tar $copts kselftest${ext} $install_dir
+./kselftest_install.sh || return
+tar $copts kselftest${ext} $install_dir || return
 echo "Kselftest archive kselftest${ext} created!"
+}
 
+main "$@"
+ret=$?
 # clean up install directory
 rm -rf kselftest
-}
 
-main "$@"
+exit $ret
-- 
2.6.0.rc2.230.g3dd15c0

WARNING: multiple messages have this Message-ID (diff)
From: Brian Norris <computersforpeace@gmail.com>
To: Shuah Khan <shuahkh@osg.samsung.com>
Cc: <linux-api@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Kees Cook <keescook@chromium.org>
Subject: [RFC] selftests: report proper exit statuses
Date: Fri, 11 Dec 2015 15:15:06 -0800	[thread overview]
Message-ID: <1449875706-106875-1-git-send-email-computersforpeace@gmail.com> (raw)

There are several places where we don't report proper exit statuses, and
this can have consequences -- for instance, the gen_kselftest_tar.sh
script might try to produce a tarball for you, even if the 'make' or
'make install' steps didn't complete properly.

This is only an RFC (and really, it's more like a bug report), since I'm
not really satisfied with my solution. It's probably not exhaustive, and
there seem to be some major other deficiencies (e.g., verbose/useless
output during build and run, non-paralle build, shell for-loops sidestep
some normal 'make' behavior). I could try to address them, but I'm not
sure how much effort I'd care to put in, and I'm not sure if there are
others who have a more comprehensive plan for cleaning up this
directory.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 tools/testing/selftests/Makefile             |  6 +++---
 tools/testing/selftests/gen_kselftest_tar.sh | 10 ++++++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index c8edff6803d1..f89893c590d5 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -44,7 +44,7 @@ endif
 
 all:
 	for TARGET in $(TARGETS); do \
-		make -C $$TARGET; \
+		make -C $$TARGET || exit 1; \
 	done;
 
 run_tests: all
@@ -54,7 +54,7 @@ run_tests: all
 
 hotplug:
 	for TARGET in $(TARGETS_HOTPLUG); do \
-		make -C $$TARGET; \
+		make -C $$TARGET || exit 1; \
 	done;
 
 run_hotplug: hotplug
@@ -79,7 +79,7 @@ ifdef INSTALL_PATH
 	@# Ask all targets to install their files
 	mkdir -p $(INSTALL_PATH)
 	for TARGET in $(TARGETS); do \
-		make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
+		make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install || exit 1; \
 	done;
 
 	@# Ask all targets to emit their test scripts
diff --git a/tools/testing/selftests/gen_kselftest_tar.sh b/tools/testing/selftests/gen_kselftest_tar.sh
index 17d5bd0c0936..160da4e82936 100755
--- a/tools/testing/selftests/gen_kselftest_tar.sh
+++ b/tools/testing/selftests/gen_kselftest_tar.sh
@@ -44,12 +44,14 @@ main()
 
 # Run install using INSTALL_KSFT_PATH override to generate install
 # directory
-./kselftest_install.sh
-tar $copts kselftest${ext} $install_dir
+./kselftest_install.sh || return
+tar $copts kselftest${ext} $install_dir || return
 echo "Kselftest archive kselftest${ext} created!"
+}
 
+main "$@"
+ret=$?
 # clean up install directory
 rm -rf kselftest
-}
 
-main "$@"
+exit $ret
-- 
2.6.0.rc2.230.g3dd15c0


             reply	other threads:[~2015-12-11 23:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11 23:15 Brian Norris [this message]
2015-12-11 23:15 ` [RFC] selftests: report proper exit statuses Brian Norris
     [not found] ` <1449875706-106875-1-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-14  3:19   ` Michael Ellerman
2015-12-14  3:19     ` Michael Ellerman
2015-12-14 19:15     ` Brian Norris
2015-12-17  9:26       ` Michael Ellerman
     [not found]         ` <1450344399.13536.2.camel-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>
2015-12-28 16:47           ` Shuah Khan
2015-12-28 16:47             ` Shuah Khan

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=1449875706-106875-1-git-send-email-computersforpeace@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shuahkh@osg.samsung.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.