Commit Graph

237 Commits

Author SHA1 Message Date
Linus Torvalds
9697376759 These commits have either been sitting in my INBOX or have been
in my local tree for some time. I need to push them upstream:
 
  - Separate out config-bisect.pl from ktest.pl.
    This allows users to do config bisects without full ktest setup.
 
  - Email on status change.
    Allow the user to be emailed on test start, finish, failure, etc.
 
  - Other small fixes and enhancements
 -----BEGIN PGP SIGNATURE-----
 
 iQHIBAABCgAyFiEEPm6V/WuN2kyArTUe1a05Y9njSUkFAlrOCmcUHHJvc3RlZHRA
 Z29vZG1pcy5vcmcACgkQ1a05Y9njSUnVhAv/Xa30lY98HFbssw2dUcGEtbv16em6
 iqcExca3tDBRN0JRx299WEozjOANI5OUWcNZP0PcVBBRKdn0RvyAhxj76P7Y+8MH
 tFbkiLhQqxPrGq+VQdWnmqC3V8yHTFk4yMlwowTvH+6F6ev8YtQbOU6aNcRFcke1
 lFzYxpU3KqlS1zm23zjzKazKJJTfP7DVtEDkoNEBK6xlRDz0PAVd8ectSbAShBEl
 9xODhPDeVI4fAxxt1uK4rhHU17+XFIHHuuftetT5NNuPTnhsarfVOse+fJxvi0Gn
 Ijfgzutad5HERsMZWOhhPy9IZItGg+tHceXAbPx98stZrCeCxWHRVZ9R2uDxa/2J
 4/9dCcXxDcjCMyqMsEtwyyuJrK7Nslsn0VqcbVRS1ModlSfyqvy81neOZ3g9B7Dd
 0nSBh+5rOirI/X82Ye8lQnZN5CjEZsUrYwtSK1iKzBeGiitdD+GbI4AaWrzvAlUc
 VzvUJ45tmhnodETJ2emddgpEFjHU0JGjSL70
 =19bA
 -----END PGP SIGNATURE-----

Merge tag 'ktest-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest

Pull ktest updates from Steven Rostedt:
 "These commits have either been sitting in my INBOX or have been in my
  local tree for some time. I need to push them upstream:

   - Separate out config-bisect.pl from ktest.pl.

     This allows users to do config bisects without full ktest setup.

   - Email on status change.

     Allow the user to be emailed on test start, finish, failure, etc.

   - Other small fixes and enhancements"

* tag 'ktest-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest: (24 commits)
  ktest: Take submenu into account for grub2 menus
  ktest.pl: Add MAIL_COMMAND option to define how to send email
  ktest.pl: Use run_command to execute sending mail
  ktest.pl: Allow dodie be recursive
  ktest.pl: Kill test if mailer is not supported
  ktest.pl: Add MAIL_PATH option to define where to find the mailer
  ktest.pl: No need to print no mailer is specified when mailto is not
  Ktest: add email options to sample.config
  Ktest: Use dodie for critical falures
  Ktest: Add SigInt handling
  Ktest: Add email support
  ktest.pl: Detect if a config-bisect was interrupted
  ktest.pl: Make finding config-bisect.pl dynamic
  ktest.pl: Have ktest.pl pass -r to config-bisect.pl to reset bisect
  ktest.pl: Use diffconfig if available for failed config bisects
  ktest.pl: Allow for the config-bisect.pl output to display to console
  ktest: Use config-bisect.pl in ktest.pl
  ktest: Add standalone config-bisect.pl program
  ktest: Set do_not_reboot=y for CONFIG_BISECT_TYPE=build
  ktest: Set buildonly=1 for CONFIG_BISECT_TYPE=build
  ...
2018-04-11 16:42:27 -07:00
Satoru Takeuchi
6cd110a91f ktest: Take submenu into account for grub2 menus
grub-reboot selects the submenu's first menuentry (title is "1>0") rather than ktest's
menuentry (title is "2") by mistake.

===
$ sudo cat /boot/grub/grub.cfg  | grep -E "^menuentry|^submenu"
...
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option '...' {
...
submenu 'Advanced options for Ubuntu' $menuentry_id_option '...' {
...
menuentry 'ktest' {
...
===

Correct it by taking submenu entries into account in get_grub2_index().

Link: http://lkml.kernel.org/r/87poaje4as.wl-satoru.takeuchi@gmail.com

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-10 15:49:14 -04:00
Steven Rostedt (VMware)
c2d84ddb33 ktest.pl: Add MAIL_COMMAND option to define how to send email
Allow the user to override the default way to send email. This will allow
the user to add their own mailer and format for sending email.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-07 20:21:06 -04:00
Steven Rostedt (VMware)
59f89eb1e3 ktest.pl: Use run_command to execute sending mail
Instead of open coding system() call, use run_command which will log the
sending of email as well.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-07 20:19:42 -04:00
Steven Rostedt (VMware)
255769a17b ktest.pl: Allow dodie be recursive
If dodie cause a function that itself will call dodie, then be able to
handle that. This will allow dodie functions to call run_command, which
could possibly call dodie. If dodie is called again, simply ignore it.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-07 20:18:26 -04:00
Steven Rostedt (VMware)
8604b0c4bc ktest.pl: Kill test if mailer is not supported
If the user specifies a MAILTO, but the MAILER is not supported, then
kill the test.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-07 20:18:25 -04:00
Steven Rostedt (VMware)
be1546b87f ktest.pl: Add MAIL_PATH option to define where to find the mailer
The option MAIL_PATH lets the user decide how to find the mailer they are
using. For example, sendmail is usually located in /usr/sbin but is not
always in the path of non admin users. Have ktest look through the user's
PATH environment variable (adding /usr/sbin) as well, but if that's not good
enough, allow the user to define where to find the mailer.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

squash to mail exec

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-07 20:16:08 -04:00
Steven Rostedt (VMware)
f5ef488557 ktest.pl: No need to print no mailer is specified when mailto is not
If the user doesn't want to send mail, then don't bother them with output
that says they didn't specify a mailer. That can be annoying.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 16:32:51 -04:00
Tim Tianyang Chen
eaaa1e283a Ktest: add email options to sample.config
A block of email options is added under the optional config section.

Link: http://lkml.kernel.org/r/1522094884-22718-5-git-send-email-tianyang.chen@oracle.com

Suggested-by: Dhaval Giani <dhaval.giani@oracle.com>
Signed-off-by: Tim Tianyang Chen <tianyang.chen@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:30:18 -04:00
Tim Tianyang Chen
df46fce692 Ktest: Use dodie for critical falures
Users should get emails when the script dies because of a critical failure.
Critical failures are defined as any errors that could abnormally terminate
the script.

In order to add email support, this patch converts all die() to dodie() except:
 * when '-v' is used as an option to get the version of the script.
 * in Sig-Int handeler because it's not a fatal error to cancel the script.
 * errors happen during parsing config

Link: http://lkml.kernel.org/r/1522094884-22718-4-git-send-email-tianyang.chen@oracle.com

Suggested-by: Dhaval Giani <dhaval.giani@oracle.com>
Signed-off-by: Tim Tianyang Chen <tianyang.chen@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:27:29 -04:00
Tim Tianyang Chen
92db453e7e Ktest: Add SigInt handling
User can cancel tests and specify handler's behavior using option
'EMAIL_WHEN_CANCELED'.

Link: http://lkml.kernel.org/r/1522094884-22718-3-git-send-email-tianyang.chen@oracle.com

Suggested-by: Dhaval Giani <dhaval.giani@oracle.com>
Signed-off-by: Tim Tianyang Chen <tianyang.chen@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:26:29 -04:00
Tim Tianyang Chen
2ceb2d85b6 Ktest: Add email support
Users can define optional variables to get email notifications.
Ktest can send emails when the script:
 * was started
 * failed with fatal errors and called dodie()
 * completed all testing

Users have to setup the mailer provided in config prior to using this script.
Supported mailers: mailx, mail, sendmail
mailer specific routines are _sendmail_send(), _mailx_send()

Link: http://lkml.kernel.org/r/1522094884-22718-2-git-send-email-tianyang.chen@oracle.com

Suggested-by: Dhaval Giani <dhaval.giani@oracle.com>
Signed-off-by: Tim Tianyang Chen <tianyang.chen@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:24:49 -04:00
Steven Rostedt (VMware)
5a57299a1f ktest.pl: Detect if a config-bisect was interrupted
If a config-bisect was interrupted, then allow the user to continue, or
restart a new config-bisect.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:08:22 -04:00
Steven Rostedt (VMware)
40667fb5fd ktest.pl: Make finding config-bisect.pl dynamic
Just looking for config-bisect.pl in the source tree can be risky,
especially, if the source tree being tested doesn't have config-bisect.pl in
place. Instead, allow the user to set where to find config-bisect.pl with a
new option CONFIG_BISECT_EXEC.

If this option is not set, by default, ktest.pl will look for
config-bisect.pl in the following locations:

 `pwd`/config-bisect.pl # where ktest.pl was called from
 `dirname /path/to/ktest.pl`/config-bisect.pl # where ktest.pl exists
 ${BUILD_DIR}/tools/testing/ktest/config-bisect.pl
   # where config-bisect.pl exists in the source tree.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:08:11 -04:00
Steven Rostedt (VMware)
133087f062 ktest.pl: Have ktest.pl pass -r to config-bisect.pl to reset bisect
If config-bisect.pl sees that a config_bisect has already been started, it
will ask on the command line if it should bisect or not. This will mess up
running config_bisect from ktest.pl.

Have ktest.pl pass in '-r' to config-bisect.pl and have config-bisect.pl
recognize that to reset without asking.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:08:03 -04:00
Steven Rostedt (VMware)
b2b07ea282 ktest.pl: Use diffconfig if available for failed config bisects
Check to see if diffconfig is available and use that to diff the configs
instead of using 'diff -u', as diffconfig produces much better output of
kernel config files. It checks the source directory for the executable.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:05:39 -04:00
Steven Rostedt (VMware)
b337f9790a ktest.pl: Allow for the config-bisect.pl output to display to console
When commands are run in ktest, they are only displayed in the ktest log
file, but that is not sufficient for outputting the display for config
bisects. The result of a config bisect is not shown.

Add a way to display the output of "run_command" which is the subroutine
used by ktest to execute commands. Use this feature to display the output of
config-bisect.pl executions to see the progress as well as the result.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:05:24 -04:00
Scott Wood
a9adc261e9 ktest: Use config-bisect.pl in ktest.pl
Reduce code duplication and take advantage of bisection logic
improvements by calling config-bisect.pl.

The output of make oldconfig is now copied directly to the desired file,
rather than doing assign_configs+save_config, in order to preserve the
ordering so that diffing the configs at the end will provide useful
output.

Link: http://lkml.kernel.org/r/20170717001630.10518-8-swood@redhat.com

Signed-off-by: Scott Wood <swood@redhat.com>
[ Modified to use with new version of config-bisect.pl ]
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-04-06 14:05:13 -04:00
Steven Rostedt (Red Hat)
0f0db06599 ktest: Add standalone config-bisect.pl program
Started working on a stand alone program that can do a config bisect. It is
based on the config bisect code of ktest.pl. Instead of needing all the
infrastructure of ktest.pl, all that is required for config-bisect.pl is two
config files. One that works, and one that does not. The goal is to pass in
the two files, and it will create a new "good" and a new "bad" config file
based on input from the user. After several iterations (calls to this
program), it will eventually end with a minimum config value that allows one
config to work and the other config to break.

The program uses a technique that takes the good config and then makes half
of the configs that differ from the bad config just like the bad config.
The code will use make oldconfig to make sure the configs that are set are
not all converted back due to incorrect dependencies on other configs set in
the bad config but not in the new test config.

This is still a work in progress, but as it was written while I was working
at Red Hat, I want this code to be submitted as such.

Signed-off-by: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
2018-04-06 14:04:57 -04:00
Arnd Bergmann
4aaacfc669 ktest: remove obsolete architectures
A number of architectures are being removed from the kernel, so
we no longer need to test them.

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-03-26 15:56:13 +02:00
Scott Wood
649c0f12de ktest: Set do_not_reboot=y for CONFIG_BISECT_TYPE=build
Currently setting do_not_reboot is triggered by simple builds and bisect
builds, but not config bisect builds.

Link: http://lkml.kernel.org/r/20170717001630.10518-3-swood@redhat.com

Signed-off-by: Scott Wood <swood@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-03-21 12:19:01 -04:00
Scott Wood
25bc70fa09 ktest: Set buildonly=1 for CONFIG_BISECT_TYPE=build
Rather than adding a third copy of the same logic, rework it to cover
all three buildonly cases at once.

In the future, please consider using the same variable to perform the
same function regardless of context...

Link: http://lkml.kernel.org/r/20170717001630.10518-2-swood@redhat.com

Signed-off-by: Scott Wood <swood@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-03-21 12:18:18 -04:00
Steven Rostedt (VMware)
6dd3791dcf ktest: Comment about other names than just ktest.conf
ktest.pl will read any file as long as its name is specified as the first
argument on the command line. Comment this fact in sample.conf.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-03-21 12:08:02 -04:00
Scott Wood
edbd0ede00 ktest: Clarify config file usage
Simply telling a new user to edit "the config file" without giving any
hints on where that file should go, what it should be named, or where
a template can be found, is not particularly helpful.

Link: http://lkml.kernel.org/r/20170717001630.10518-1-swood@redhat.com

Signed-off-by: Scott Wood <swood@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-03-21 12:06:25 -04:00
Steven Rostedt (VMware)
3e1d367884 ktest: Add CONNECT_TIMEOUT to change the connection timeout time
Before ktest issues a reboot, it will try to connect to the target machine
to make sure that it is still alive. If the target does not respond within 5
seconds, it will power cycle the box instead of issuing a reboot.

Five seconds may be too short, and ktest may unnecessarially power cycle the
box. I have found 25 seconds seems to be a better timeout for this purpose.
But even 25 may be too arbitrary. Add a CONNECT_TIMEOUT option to let the
user determine the timeout time before rebooting. By default, it has been
raised to 25 seconds.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-03-21 10:36:08 -04:00
Steven Rostedt (VMware)
9f23b129eb ktest: Wait for console process to exit
To clean up the console processes that are forked to monitor the console,
there needs to be a waitpid().

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-03-21 10:24:20 -04:00
Arnd Bergmann
bb9d812643 arch: remove tile port
The Tile architecture port was added by Chris Metcalf in 2010, and
maintained until early 2018 when he orphaned it due to his departure
from Mellanox, and nobody else stepped up to maintain it. The product
line is still around in the form of the BlueField SoC, but no longer
uses the Tile architecture.

There are also still products for sale with Tile-GX SoCs, notably the
Mikrotik CCR router family. The products all use old (linux-3.3) kernels
with lots of patches and won't be upgraded by their manufacturers. There
have been efforts to port both OpenWRT and Debian to these, but both
projects have stalled and are very unlikely to be continued in the future.

Given that we are reasonably sure that nobody is still using the port
with an upstream kernel any more, it seems better to remove it now while
the port is in a good shape than to let it bitrot for a few years first.

Cc: Chris Metcalf <chris.d.metcalf@gmail.com>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: http://www.mellanox.com/page/npu_multicore_overview
Link: https://jenkins.debian.net/view/rebootstrap/job/rebootstrap_tilegx_gcc7/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-03-16 10:56:03 +01:00
Greg Kroah-Hartman
b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Linus Torvalds
8557b8e43a Greg Kroah-Hartman reported to me that the ktest of v4.10 locked up in an
infinite loop while doing the make mrproper. Looking into the cause I noticed
 that a recent update to the function run_command (used for running all
 shell commands, including "make mrproper") changed the internal loop to
 use the function wait_for_input. The wait_for_input uses select to look
 at two file descriptors. One is the file descriptor of the command it is
 running, the other is STDIN. The STDIN check was not checking the return
 status of the sysread call, and was also just writing a lot of data into
 syswrite without regard to the size of the data read.
 
 Changing the code to check the return status of sysread, and also to still
 process the passed in descriptor data without looping back to the select
 fixed Greg's problem.
 
 While looking at this code I also realized that the loop did not honor
 the timeout if STDIN always had input (or for some reason return error).
 this could prevent wait_for_input to timeout on the file descriptor it
 is suppose to be waiting for. That is fixed too.
 -----BEGIN PGP SIGNATURE-----
 
 iQExBAABCAAbBQJYwChiFBxyb3N0ZWR0QGdvb2RtaXMub3JnAAoJEMm5BfJq2Y3L
 0vwH/0gxaT134N6lkZ5Bdv2RJNVUu8mvAbjnXNPpUz1XSBd4zUVpfKONhxc7O50V
 mNb9WfmJ4nhcjp4qeEIhdpJvO2Fjm1grIVWcvnT6FwNfvGG9S73OYyRdK0ggcYhE
 gFRsdXBipVNL0pNlJhl1//XHq644IMhqDGRBQmR+eKUym2iiJHYhgteeGOQ3PHg1
 L5MW1zORbPzeuVPDKGBVA4LDqlu3/gwJSIGZyYivAJp7f5Q5+t+1FPfUMdhodvps
 XiNsgHkHSpjhcCKxbjgSFrIX52AyrciYt+ZlIDps97R+IRk671BFHoOEcSZDux9O
 Cm3L3eBA8zIJQn9yXjlVvHfbVxU=
 =sGdD
 -----END PGP SIGNATURE-----

Merge tag 'ktest-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest

Pull ktest fixes from Steven Rostedt:
 "Greg Kroah-Hartman reported to me that the ktest of v4.11-rc1 locked
  up in an infinite loop while doing the make mrproper.

  Looking into the cause I noticed that a recent update to the function
  run_command (used for running all shell commands, including "make
  mrproper") changed the internal loop to use the function
  wait_for_input.

  The wait_for_input function uses select to look at two file
  descriptors. One is the file descriptor of the command it is running,
  the other is STDIN. The STDIN check was not checking the return status
  of the sysread call, and was also just writing a lot of data into
  syswrite without regard to the size of the data read.

  Changing the code to check the return status of sysread, and also to
  still process the passed in descriptor data without looping back to
  the select fixed Greg's problem.

  While looking at this code I also realized that the loop did not honor
  the timeout if STDIN always had input (or for some reason return
  error). this could prevent wait_for_input to timeout on the file
  descriptor it is suppose to be waiting for. That is fixed too"

* tag 'ktest-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
  ktest: Make sure wait_for_input does honor the timeout
  ktest: Fix while loop in wait_for_input
2017-03-08 11:06:05 -08:00
Steven Rostedt (VMware)
f7c6401ff8 ktest: Make sure wait_for_input does honor the timeout
The function wait_for_input takes in a timeout, and even has a default
timeout. But if for some reason the STDIN descriptor keeps sending in data,
the function will never time out. The timout is to wait for the data from
the passed in file descriptor, not for STDIN. Adding a test in the case
where there's no data from the passed in file descriptor that checks to see
if the timeout passed, will ensure that it will timeout properly even if
there's input in STDIN.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-03-08 10:41:37 -05:00
Steven Rostedt (VMware)
99c014a879 ktest: Fix while loop in wait_for_input
The run_command function was changed to use the wait_for_input function to
allow having a timeout if the command to run takes too much time. There was
a bug in the wait_for_input where it could end up going into an infinite
loop. There's two issues here. One is that the return value of the sysread
wasn't used for the write (to write a proper size), and that it should
continue processing the passed in file descriptor too even if there was
input. There was no check for error, if for some reason STDIN returned an
error, the function would go into an infinite loop and never exit.

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 6e98d1b441 ("ktest: Add timeout to ssh command")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-03-08 10:16:17 -05:00
Linus Torvalds
1ac884f173 These are various fixes that I have made and never got around to pushing.
I've been asked to get the upstream repo back up-to-date.
 -----BEGIN PGP SIGNATURE-----
 
 iQExBAABCAAbBQJYtD0iFBxyb3N0ZWR0QGdvb2RtaXMub3JnAAoJEMm5BfJq2Y3L
 7E0H/0Sg5YxCH3iaKyZ0Z6vj9k09wBcXpzBLtUKrCiK46XEhvXCkh7vFJSY5AmGO
 TcIsSBwmCdHWT5M5jM2n0j2GdxJOE0jXHlbnMvXob5EjW6QAw+mRI+KK0KGzmQIq
 M4cYxrmD+HDwgulaFkF3P/nQ64wU35zaUQxFAmh0SY2xNUTg/BL8BMebfH9BauFB
 SWBWF156kon0+eXvqLDfgfRyWiDH4IB65CEu9N+1ubJPWKrHoqHTopMW+jsqbVeu
 qEEiigfmRlPiCOEiD4LQn+4qdmTji4dR/ZRvOCEGBGXtJPtqvI275m3/UxDvp9jx
 07hZ+1701J+aPaYx0hS5iPegFq4=
 =P7wC
 -----END PGP SIGNATURE-----

Merge tag 'ktest-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest

Pull ktest updates from Steven Rostedt:
 "These are various fixes that I have made and never got around to
  pushing. I've been asked to get the upstream repo back up-to-date"

* tag 'ktest-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
  ktest: Add variable run_command_status to save status of commands executed
  ktest.pl: Powercycle the box on reboot if no connection can be made
  ktest: Add timeout to ssh command
  ktest: Fix child exit code processing
  ktest: Have POST_TEST run after the test has totally completed
2017-02-27 23:07:59 -08:00
Steven Rostedt (VMware)
5739438b72 ktest: Add variable run_command_status to save status of commands executed
Create a variable called run_command_status that saves the status of the
executed commands and can be used by other functions later to test for
status.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-02-07 14:50:03 -05:00
Steven Rostedt (VMware)
6474ace999 ktest.pl: Powercycle the box on reboot if no connection can be made
When performing a reboot of the test box, try to ssh to it. If it can't
connect for 5 seconds, then powercycle the box. This is useful because the
reboot is done via ssh, and if you can't ssh to the box because it is hung,
the reboot fails to reboot.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-02-07 12:23:38 -05:00
Steven Rostedt (VMware)
6e98d1b441 ktest: Add timeout to ssh command
Add a timeout to performing an ssh command. This will let testing if a
machine is alive or not, or if something else may be amiss. A timeout can be
passed to ssh, where ssh will fail if it does not complete within the given
timeout.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-02-07 12:23:38 -05:00
Steven Rostedt (VMware)
32677207dc ktest: Fix child exit code processing
The child_exit errno needs to be shifted by 8 bits to compare against the
return values for the bisect variables.

Fixes: c5dacb88f0 ("ktest: Allow overriding bisect test results")
Cc: stable@vger.kernel.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-02-07 12:05:25 -05:00
Steven Rostedt (VMware)
2e07c9f55e ktest: Have POST_TEST run after the test has totally completed
The POST_TEST config is to be executed after a test has fully compeleted,
whether the test passed or failed. It currently is executed at the moment
that the test has been decided if it failed or not. As the test does other
clean ups, it isn't truly finished. Move the POST_TEST execution to after
all the test cleanups have been done.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-02-07 11:49:21 -05:00
Pavel Machek
22722799de ktest.pl: fix english
Ajdust spelling to more common "mandatory".  Variant "mandidory" is
certainly wrong.

Link: http://lkml.kernel.org/r/20161011073003.GA19476@amd
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-14 16:04:08 -08:00
Steven Rostedt (Red Hat)
7c2c49eceb ktest: Place quotes around item variable
Seems that some of the new console logic causes doprint to possibly
get evaluated. When printing a commit message that contains parenthesis,
it fails with a shell parsing error.

This gets fixed when we add quotes around the $item variable, and prevent
it from being evaluated by any shell commands.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-03 15:45:13 -05:00
Josh Poimboeuf
1cb9e64298 ktest: Cleanup terminal on dodie() failure
If dodie() is called with the console open, restore the terminal's
original settings before dying.

Link: http://lkml.kernel.org/r/20150130025453.GB20952@treble.redhat.com

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-02 10:43:39 -05:00
Steven Rostedt (Red Hat)
4bf6e1fc99 ktest: Print build,install,boot,test times at success and failure
Since both success and failure may shortcut and exit ktest, it is better
to print the status times there too. Once times are printed, the values
for the times are reset, so they will not print more than once.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-02 10:43:30 -05:00
Josh Poimboeuf
9d2f7f051b ktest: Enable user input to the console
Allow the user to send input to the console by putting the terminal in
cbreak mode (to allow reading stdin one character at a time) and copying
all stdin data to the console's pty.

Link: http://lkml.kernel.org/r/bb1bbe7d202c95a3ce7894cfffdd8c725875978e.1422473610.git.jpoimboe@redhat.com

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-02 10:43:24 -05:00
Josh Poimboeuf
9f2cdcbbb9 ktest: Give console process a dedicated tty
Create a pseudoterminal (pty pair) to give the console a dedicated tty
so it doesn't mess with ktest's terminal settings.

Link: http://lkml.kernel.org/r/37b0127f9efad09ff4fc994334db998141e4f6ca.1422473610.git.jpoimboe@redhat.com

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-02-02 10:43:12 -05:00
Steven Rostedt (Red Hat)
64d982838e ktest: Rename start_monitor_and_boot to start_monitor_and_install
The function start_monitor_and_boot is a misnomer. It use to, but
now it starts the monitor and installs. It does not boot. Rename it
before I get confused by it again.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-01-29 09:02:07 -05:00
Steven Rostedt (Red Hat)
38fa3dc15c ktest: Show times for build, install, boot and test
Seeing the times for how long a build, install, reboot and the
test takes is helpful for analyzing the test process. Seeing
how different changes affect the timings.

Show the build, install, boot and test times when at the end of
the test, or between each interval for tests that do those
mulitple times (like bisect and patchcheck).

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-01-29 09:02:06 -05:00
Josh Poimboeuf
988427829b ktest: Restore tty settings after closing console
When ktest runs the console program as a child process, the parent and
child share the same tty for stdin and stderr.  This is problematic when
using a libvirt target.  The "virsh console" program makes a lot of
changes to the tty settings, making ktest's output hard to read
(carriage returns don't work).  After ktest exits, the terminal is
unusable (CRs broken, stdin isn't echoed).

I think the best way to fix this issue would be to create a
pseudoterminal (pty pair) so the child process would have a dedicated
tty, and then use pipes to connect the two ttys.  I'm not sure if that's
overkill, but it's far beyond my current Perl abilities.

This patch is a much easier way to (partially) fix this issue.  It saves
the tty settings before opening the console and restores them after
closing it.  There are still a few places where ktest prints mangled
output while the console is open, but the output is much more legible
overall, and the terminal works just fine after ktest exits.

Link: http://lkml.kernel.org/r/1bb89abc0025cf1d6da657c7ba58bbeb4381a515.1422382008.git.jpoimboe@redhat.com

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-01-27 17:44:57 -05:00
Steven Rostedt (Red Hat)
b53486e083 ktest: Add timings for commands
I find that I usually like to see how long a make or other command takes,
and adding a start and end time and reporting how long each command runs
(in seconds) is helpful.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-01-27 17:44:56 -05:00
Steven Rostedt (Red Hat)
17150fef4a ktest: Add back "tail -1" to kernelrelease make
Commit 52d21580b3 "ktest: Use make -s kernelrelease" fixed commit
7ff525712a "kbuild: fake the "Entering directory ..." message more simply"
as that commit added output after the make kernelrelease. But there's still
some build scripts that are used by ktest that has output before the make
is executed, and requires that only the last line is printed.

Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-11-23 15:13:44 -05:00
Steven Rostedt (Red Hat)
18656c7099 ktest: Add name to running title
Instead of just showing the test type of test in the start of the
test, like this:

  RUNNING TEST 1 of 26 with option build defconfig

Add the name (if it is defined) as well, like this:

  RUNNING TEST 1 of 26 (arm64 aarch64-linux) with option build defconfig

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-11-21 19:38:58 -05:00
Steven Rostedt (Red Hat)
22c37a9ac4 ktest: Allow tests to undefine default options
Tests can set options that override the default ones. But if a test
tries to undefine a default option, it is simply ignored and the
default option stays as is.

For example, if you want to have a test that defines no MIN_CONFIG
then the test should be able to do that with:

   TEST_START
   MIN_CONFIG =

Which should make MIN_CONFIG not defined for that test. But the way
the code currently works, undefined options in tests are dropped.
This is because the NULL options are evaluated during the reading of
the config file and since one can disable default options in the default
section with this method, it is evaluated there (the option turns to a
undef). But undef options in the test section mean to use the default
option.

To fix this, keep the empty string in the option during the reading
of the config file, and then evaluate it when running the test. This
will allow tests to null out default options.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-11-21 19:38:57 -05:00