History log of /linux-master/tools/testing/ktest/ktest.pl
Revision Date Author Comments
# 07283c18 14-Mar-2024 Ricardo B. Marliere <ricardo@marliere.net>

ktest: force $buildonly = 1 for 'make_warnings_file' test type

The test type "make_warnings_file" should have no mandatory configuration
parameters other than the ones required by the "build" test type, because
its purpose is to create a file with build warnings that may or may not be
used by other subsequent tests. Currently, the only way to use it as a
stand-alone test is by setting POWER_CYCLE, CONSOLE, SSH_USER,
BUILD_TARGET, TARGET_IMAGE, REBOOT_TYPE and GRUB_MENU.

Link: https://lkml.kernel.org/r/20240315-ktest-v2-1-c5c20a75f6a3@marliere.net

Cc: John Hawley <warthog9@eaglescrag.net>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# ca8edb78 10-Dec-2022 Steven Rostedt <rostedt@goodmis.org>

ktest.pl: Process variables within variables

Allow a variable to contain another variable. This will allow the
${shell <command>} to have its command include variables.

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


# 7dc8e24f 20-Jan-2023 Masami Hiramatsu (Google) <mhiramat@kernel.org>

ktest: Restore stty setting at first in dodie

The do_send_email() will call die before restoring stty if sendmail
setting is not correct or sendmail is not installed. It is safer to
restore it in the beginning of dodie().

Link: https://lkml.kernel.org/r/167420617635.2988775.13045295332829029437.stgit@devnote3

Cc: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 4e7d2a8f 18-Jan-2023 Steven Rostedt <rostedt@goodmis.org>

ktest.pl: Add RUN_TIMEOUT option with default unlimited

There is a disconnect between the run_command function and the
wait_for_input. The wait_for_input has a default timeout of 2 minutes. But
if that happens, the run_command loop will exit out to the waitpid() of
the executing command. This fails in that it no longer monitors the
command, and also, the ssh to the test box can hang when its finished, as
it's waiting for the pipe it's writing to to flush, but the loop that
reads that pipe has already exited, leaving the command stuck, and the
test hangs.

Instead, make the default "wait_for_input" of the run_command infinite,
and allow the user to override it if they want with a default timeout
option "RUN_TIMEOUT".

But this fixes the hang that happens when the pipe is full and the ssh
session never exits.

Cc: stable@vger.kernel.org
Fixes: 6e98d1b4415fe ("ktest: Add timeout to ssh command")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 83d29d43 18-Jan-2023 Steven Rostedt <rostedt@goodmis.org>

ktest.pl: Give back console on Ctrt^C on monitor

When monitoring the console output, the stdout is being redirected to do
so. If Ctrl^C is hit during this mode, the stdout is not back to the
console, the user does not see anything they type (no echo).

Add "end_monitor" to the SIGINT interrupt handler to give back the console
on Ctrl^C.

Cc: stable@vger.kernel.org
Fixes: 9f2cdcbbb90e7 ("ktest: Give console process a dedicated tty")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# e8bf9b98 18-Jan-2023 Steven Rostedt <rostedt@goodmis.org>

ktest.pl: Fix missing "end_monitor" when machine check fails

In the "reboot" command, it does a check of the machine to see if it is
still alive with a simple "ssh echo" command. If it fails, it will assume
that a normal "ssh reboot" is not possible and force a power cycle.

In this case, the "start_monitor" is executed, but the "end_monitor" is
not, and this causes the screen will not be given back to the console. That
is, after the test, a "reset" command needs to be performed, as "echo" is
turned off.

Cc: stable@vger.kernel.org
Fixes: 6474ace999edd ("ktest.pl: Powercycle the box on reboot if no connection can be made")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 88a51b4f 07-Dec-2022 Steven Rostedt (Google) <rostedt@goodmis.org>

ktest.pl: Add shell commands to variables

Allow variables to execute shell commands. Note, these are processed when
they are first seen while parsing the config file. This is useful if you
have the same config file used for multiple hosts (as they may be in a git
repository).

HOSTNAME := ${shell hostname}
DEFAULTS IF "${HOSTNAME}" == "frodo"

Link: https://lkml.kernel.org/r/20221207212944.277ee850@gandalf.local.home

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


# 26df05a8 30-Nov-2022 Steven Rostedt <rostedt@goodmis.org>

kest.pl: Fix grub2 menu handling for rebooting

grub2 has submenus where to use grub-reboot, it requires:

grub-reboot X>Y

where X is the main index and Y is the submenu. Thus if you have:

menuentry 'Debian GNU/Linux' --class debian --class gnu-linux ...
[...]
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option ...
menuentry 'Debian GNU/Linux, with Linux 6.0.0-4-amd64' --class debian --class gnu-linux ...
[...]
}
menuentry 'Debian GNU/Linux, with Linux 6.0.0-4-amd64 (recovery mode)' --class debian --class gnu-linux ...
[...]
}
menuentry 'Debian GNU/Linux, with Linux test' --class debian --class gnu-linux ...
[...]
}

And wanted to boot to the "Linux test" kernel, you need to run:

# grub-reboot 1>2

As 1 is the second top menu (the submenu) and 2 is the third of the sub
menu entries.

Have the grub.cfg parsing for grub2 handle such cases.

Cc: stable@vger.kernel.org
Fixes: a15ba91361d46 ("ktest: Add support for grub2")
Reviewed-by: John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# ef784eeb 02-Dec-2022 Steven Rostedt <rostedt@goodmis.org>

ktest.pl minconfig: Unset configs instead of just removing them

After a full run of a make_min_config test, I noticed there were a lot of
CONFIGs still enabled that really should not be. Looking at them, I
noticed they were all defined as "default y". The issue is that the test
simple removes the config and re-runs make oldconfig, which enables it
again because it is set to default 'y'. Instead, explicitly disable the
config with writing "# CONFIG_FOO is not set" to the file to keep it from
being set again.

With this change, one of my box's minconfigs went from 768 configs set,
down to 521 configs set.

Link: https://lkml.kernel.org/r/20221202115936.016fce23@gandalf.local.home

Cc: stable@vger.kernel.org
Fixes: 0a05c769a9de5 ("ktest: Added config_bisect test type")
Reviewed-by: John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>


# 6a0f3652 19-Apr-2021 John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>

ktest: Re-arrange the code blocks for better discoverability

Perl, as with most scripting languages, is fairly flexible in how /
where you can define things, and it will (for the most part) do what you
would expect it to do. This however can lead to situations, like with
ktest, where things get muddled over time.

This pushes the variable definitions back up to the top, followed by
functions, with the main script executables down at the bottom, INSTEAD
of being somewhat mish-mashed together in certain places. This mostly
has the advantage of making it more obvious where things are initially
defined, what functions are there, and ACTUALLY where the main script
starts executing, and should make this a little more approachable.

Signed-off-by: John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# c043ccbf 19-Apr-2021 John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>

ktest: Further consistency cleanups

This cleans up some additional whitespace pieces that to be more
consistent, as well as moving a curly brace around, and some 'or'
statements to match the rest of the file (usually or goes at the
end of the line vs. at the beginning)

Signed-off-by: John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 12d4cddd 19-Apr-2021 John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>

ktest: Fixing indentation to match expected pattern

This is a followup to "ktest: Adding editor hints to improve
consistency" to actually adjust the existing indentation to match
the, now, expected pattern (first column 4 spaces, 2nd tab, 3rd
tab + 4 spaces, etc). This should, at least help, keep things
consistent going forward now.

Signed-off-by: John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# becdd17b 19-Apr-2021 John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>

ktest: Adding editor hints to improve consistency

Emacs and Vi(m) have different styles of dealing with perl syntax
which can lead to slightly inconsistent indentation, and makes the
code slightly harder to read. Emacs assumes a more perl recommended
standard of 4 spaces (1 column) or tab (two column) indentation.

Vi(m) tends to favor just normal spaces or tabs depending on what
was being used.

This gives the basic hinting to Emacs and Vim to do what is
expected to be basically consistent.

Emacs:
- Explicitly flip into perl mode, cperl would require
more adjustments

Vi(m):
- Set softtabs=4 which will flip it over to doing
indentation the way you would expect from Emacs

Signed-off-by: John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# da2e5663 19-Apr-2021 John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>

ktest: Minor cleanup with uninitialized variable $build_options

Signed-off-by: John 'Warthog9' Hawley (VMware) <warthog9@eaglescrag.net>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 170f4869 30-Nov-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Fix the logic for truncating the size of the log file for email

The logic for truncating the log file for emailing based on the
MAIL_MAX_SIZE option is confusing and incorrect. Simplify it and have the
tail of the log file truncated to the max size specified in the config.

Cc: stable@vger.kernel.org
Fixes: 855d8abd2e8ff ("ktest.pl: Change the logic to control the size of the log file emailed")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 8cd6bc03 30-Nov-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: If size of log is too big to email, email error message

If the size of the error log is too big to send via email, and the sending
fails, it wont email any result. This can be confusing for the user who is
waiting for an email on the completion of the tests.

If it fails to send email, then try again without the log file stating that
it failed to send an email. Obviously this will not be of use if the sending
of email failed for some other reasons, but it will at least give the user
some information when it fails for the most common reason.

Cc: stable@vger.kernel.org
Fixes: c2d84ddb338c8 ("ktest.pl: Add MAIL_COMMAND option to define how to send email")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 271e0c9d 20-Nov-2020 Libo Chen <libo.chen@oracle.com>

ktest.pl: Fix incorrect reboot for grub2bls

This issue was first noticed when I was testing different kernels on
Oracle Linux 8 which as Fedora 30+ adopts BLS as default. Even though a
kernel entry was added successfully and the index of that kernel entry was
retrieved correctly, ktest still wouldn't reboot the system into
user-specified kernel.

The bug was spotted in subroutine reboot_to where the if-statement never
checks for REBOOT_TYPE "grub2bls", therefore the desired entry will not be
set for the next boot.

Add a check for "grub2bls" so that $grub_reboot $grub_number can
be run before a reboot if REBOOT_TYPE is "grub2bls" then we can boot to
the correct kernel.

Link: https://lkml.kernel.org/r/20201121021243.1532477-1-libo.chen@oracle.com

Cc: stable@vger.kernel.org
Fixes: ac2466456eaa ("ktest: introduce grub2bls REBOOT_TYPE option")
Signed-off-by: Libo Chen <libo.chen@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# ff131eff 10-Aug-2020 Colin Ian King <colin.king@canonical.com>

ktest.pl: Fix spelling mistake "Cant" -> "Can't"

There is a spelling mistake in an error message. Fix it.

Link: https://lkml.kernel.org/r/20200810100750.61475-1-colin.king@canonical.com

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 855d8abd 02-Jul-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Change the logic to control the size of the log file emailed

If the log file for a given test is larger than the max size given then use
set the seek from the end of the log file instead of from the start of the
test.

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


# f9869002 01-Jul-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Add MAIL_MAX_SIZE to limit the amount of log emailed

Add the ktest config option MAIL_MAX_SIZE that will limit the size of the
log file that is placed into the email on failure.

Link: https://lore.kernel.org/r/20200701231756.790637968@goodmis.org

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 34148b13 01-Jul-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Add the log of last test in email on failure

If a failure happens and an email is sent, show the contents of the log of
the last test that failed in the email.

Link: http://lore.kernel.org/r/20200701231756.619246244@goodmis.org

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# eefb9d2b 01-Jul-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Turn off buffering to the log file

The log file should be up to date to whatever is happening in ktest.
Disable buffering to the LOG output file handle.

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


# d6bc29d9 01-Jul-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Just open up the log file once

Currently, every write to the log file is done by opening the file, writing
to it, then closing the file. This rather expensive. Just open it at the
beginning and close it at the end.

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


# 16723426 01-Jul-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Add a NOT operator

There is a NOT DEFINED operator, but there is not an operator that can
negate any other expression.

For example: NOT (${FOO} == boot || ${BAR} == run)

Add the keyword NOT to allow the ktest.pl config files to negate operators.

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


# d53cdda3 01-Jul-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Define PRE_TEST_DIE to kill the test if the PRE_TEST fails

Currently, if a PRE_TEST is defined and ran, but fails, there's nothing
currently available to make the test fail too. Add a PRE_TEST_DIE option that
when set, if a PRE_TEST is defined and fails, the test will die too.

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


# 2f059db0 01-Jul-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Always show log file location if defined even on success

If a log file is defined and the test were to error, a print statement is
made that shows the user where the log file is to examine it further. But
this is not done if the test were to succeed.

I find it annoying that it does not show where the log file is on success,
as I run several different tests that place their log files in various
locations, and even though the test pass, there's things I want to look at
in the log file (like warnings). It is much easier to find where the log
file is, if it is displayed at the end of a test.

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


# 9dce29e6 01-Jul-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest.pl: Have config-bisect save each config used in the bisect

When performing a automatic config bisect via ktest.pl, it is very useful to
have a copy of each of the bisects used. This way, if a bisect were to go
wrong, it is possible to retrace the steps and continue at the location
before the error was made.

The ktest.pl will make a copy of the good and bad configs, labeled as such,
as well as a number attached to it that represents the iteration of the
bisect. These files are saved in the ktest temp directory where it currently
stores the good and bad config files.

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


# 1091c8fc 09-Mar-2020 Masanari Iida <standby24x7@gmail.com>

ktest: Fix typos in ktest.pl

This patch fixes multipe spelling typo found in ktest.pl.

Link: http://lkml.kernel.org/r/20200309115430.57540-1-standby24x7@gmail.com

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 4d00fc47 09-Mar-2020 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest: Add timeout for ssh sync testing

Before rebooting the box, a "ssh sync" is called to the test machine to see
if it is alive or not. But if the test machine is in a partial state, that
ssh may never actually finish, and the ktest test hangs.

Add a 10 second timeout to the sync test, which will fail after 10 seconds
and then cause the test to reboot the test machine.

Cc: stable@vger.kernel.org
Fixes: 6474ace999edd ("ktest.pl: Powercycle the box on reboot if no connection can be made")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 791dc9d6 13-Nov-2019 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest: Make default build option oldconfig not randconfig

For the last time, I screwed up my ktest config file, and the build went
into the default "randconfig", blowing away the .config that I had set up.
The reason for the default randconfig was because when this was first
written, I wanted to do a bunch of randconfigs. But as time progressed,
ktest isn't about randconfig anymore, and because randconfig destroys the
config in the build directory, it's a dangerous default to have. Use
oldconfig as the default.

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


# 4f19048f 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166

Based on 1 normalized pattern(s):

licensed under the terms of the gnu gpl license version 2

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 62 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.929121379@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 00603cd6 09-May-2019 Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>

ktest: remove get_grub2_index

Remove get_grub2_index() because it isn't used anywhere.

Link: http://lkml.kernel.org/r/20190509213647.6276-6-msys.mizuma@gmail.com

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# cc2eb3a2 09-May-2019 Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>

ktest: pass KERNEL_VERSION to POST_KTEST

For BLS, kernel entry is added by kernel-install command through
POST_INSALL, for example,

POST_INSTALL = ssh root@Test "/usr/bin/kernel-install \
add $KERNEL_VERSION /boot/vmlinuz-$KERNEL_VERSION"

The entry is removed by kernel-install command and the kernel
version is needed for the argument.

Pass KERNEL_VERSION variable to POST_KTEST so that kernel-install
command can remove the entry like as follows:

POST_KTEST = ssh root@Test "/usr/bin/kernel-install remove $KERNEL_VERSION"

Link: http://lkml.kernel.org/r/20190509213647.6276-5-msys.mizuma@gmail.com

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# ac246645 09-May-2019 Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>

ktest: introduce grub2bls REBOOT_TYPE option

Fedora 30 introduces Boot Loader Specification (BLS),
it changes around grub entry configuration.

kernel entries aren't in grub.cfg. We can get the entries
by "grubby --info=ALL" command.

Introduce grub2bls as REBOOT_TYPE option for BLS.

Link: http://lkml.kernel.org/r/20190509213647.6276-4-msys.mizuma@gmail.com

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 38891392 09-May-2019 Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>

ktest: cleanup get_grub_index

Cleanup get_grub_index().

Link: http://lkml.kernel.org/r/20190509213647.6276-3-msys.mizuma@gmail.com

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# f824b686 09-May-2019 Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>

ktest: introduce _get_grub_index

Introduce _get_grub_index() to deal with Boot Loader
Specification (BLS) and cleanup.

Link: http://lkml.kernel.org/r/20190509213647.6276-2-msys.mizuma@gmail.com

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 37e16773 18-Apr-2019 Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>

ktest: introduce REBOOT_RETURN_CODE to confirm the result of REBOOT

Unexpected power cycle occurs while the installation of the
kernel.

ssh root@Test sync ... [0 seconds] SUCCESS
ssh root@Test reboot ... [1 second] FAILED!
virsh destroy Test; sleep 5; virsh start Test ... [6 seconds] SUCCESS

That is because REBOOT, the default is "ssh $SSH_USER@$MACHINE
reboot", exits as 255 even if the reboot is successfully done,
like as:

]# ssh root@Test reboot
Connection to Test closed by remote host.
]# echo $?
255
]#

To avoid the unexpected power cycle, introduce a new parameter,
REBOOT_RETURN_CODE to judge whether REBOOT is successfully done
or not.

Link: http://lkml.kernel.org/r/20190418135943.12640-1-msys.mizuma@gmail.com

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 68911069 17-Apr-2019 Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>

ktest: Add support for meta characters in GRUB_MENU

ktest fails if meta characters are in GRUB_MENU, for example
GRUB_MENU = 'Fedora (test)'

The failure happens because the meta characters are not escaped,
so the menu doesn't match in any entries in GRUB_FILE.

Use quotemeta() to escape the meta characters.

Link: http://lkml.kernel.org/r/20190417235823.18176-1-msys.mizuma@gmail.com

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# fca797f1 17-Apr-2019 Steven Rostedt (VMware) <rostedt@goodmis.org>

ktest: Show name and iteration on errors

If a test has an error, display not only the what type of test failed, but
if the test was giving a name, display that too, as well as the current
iteration of the tests. Each test has an iteration number associated to it.
For error messages display that iteration number along with the test type
and test name. This includes the message that gets sent via email.

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


# 6cd110a9 21-Sep-2017 Satoru Takeuchi <satoru.takeuchi@gmail.com>

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>


# c2d84ddb 07-Apr-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 59f89eb1 06-Apr-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 255769a1 06-Apr-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 8604b0c4 06-Apr-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# be1546b8 06-Apr-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# f5ef4885 06-Apr-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# df46fce6 26-Mar-2018 Tim Tianyang Chen <tianyang.chen@oracle.com>

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>


# 92db453e 26-Mar-2018 Tim Tianyang Chen <tianyang.chen@oracle.com>

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>


# 2ceb2d85 26-Mar-2018 Tim Tianyang Chen <tianyang.chen@oracle.com>

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>


# 5a57299a 05-Apr-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 40667fb5 04-Apr-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 133087f0 04-Apr-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# b2b07ea2 22-Mar-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# b337f979 22-Mar-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# a9adc261 16-Jul-2017 Scott Wood <swood@redhat.com>

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>


# 649c0f12 16-Jul-2017 Scott Wood <swood@redhat.com>

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>


# 25bc70fa 16-Jul-2017 Scott Wood <swood@redhat.com>

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>


# edbd0ede 16-Jul-2017 Scott Wood <swood@redhat.com>

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>


# 3e1d3678 21-Mar-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 9f23b129 21-Mar-2018 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# bb9d8126 09-Mar-2018 Arnd Bergmann <arnd@arndb.de>

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>


# f7c6401f 08-Mar-2017 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 99c014a8 08-Mar-2017 Steven Rostedt (VMware) <rostedt@goodmis.org>

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: 6e98d1b4415f ("ktest: Add timeout to ssh command")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 5739438b 07-Feb-2017 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 6474ace9 06-Feb-2017 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 6e98d1b4 06-Feb-2017 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 32677207 06-Feb-2017 Steven Rostedt (VMware) <rostedt@goodmis.org>

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: c5dacb88f0a64 ("ktest: Allow overriding bisect test results")
Cc: stable@vger.kernel.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>


# 2e07c9f5 07-Feb-2017 Steven Rostedt (VMware) <rostedt@goodmis.org>

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>


# 22722799 14-Dec-2016 Pavel Machek <pavel@ucw.cz>

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>


# 7c2c49ec 03-Feb-2015 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

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>


# 1cb9e642 29-Jan-2015 Josh Poimboeuf <jpoimboe@redhat.com>

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>


# 4bf6e1fc 29-Jan-2015 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

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>


# 9d2f7f05 28-Jan-2015 Josh Poimboeuf <jpoimboe@redhat.com>

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>


# 9f2cdcbb 28-Jan-2015 Josh Poimboeuf <jpoimboe@redhat.com>

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>


# 64d98283 28-Jan-2015 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

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>


# 38fa3dc1 28-Jan-2015 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

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>


# 98842782 26-Jan-2015 Josh Poimboeuf <jpoimboe@redhat.com>

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>


# b53486e0 27-Jan-2015 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

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>


# 17150fef 23-Nov-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Add back "tail -1" to kernelrelease make

Commit 52d21580b362 "ktest: Use make -s kernelrelease" fixed commit
7ff525712acf "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>


# 18656c70 21-Nov-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

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>


# 22c37a9a 21-Nov-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

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>


# 9972fc0b 22-Oct-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Fix make_min_config to handle new assign_configs call

Commit 6071c22e1755 "ktest: Rewrite the config-bisect to actually work"
fixed the config-bisect to work nicely but in doing so it broke
make_min_config by changing the way assign_configs works.

The assign_configs function now adds the config to the hash even if
it is disabled, but changes the hash value to be that of the
line "# CONFIG_FOO is not set". Unfortunately, the make_min_config
test only checks to see if the config is removed. It now needs to
check if the config is in the hash and not set to be disabled.

Cc: stable@vger.kernel.org # 3.17+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 52d21580 22-Oct-2014 Michal Marek <mmarek@suse.cz>

ktest: Use make -s kernelrelease

The previous tail -1 broke with commit 7ff525712acf ("kbuild: fake the
"Entering directory ..." message more simply")

Link: http://lkml.kernel.org/r/20141022194408.GA20989@pobox.suse.cz

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# d832d743 07-Oct-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Don't bother with bisect good or bad on replay

If git bisect reply is being used in the bisect tests, don't bother
doing the git bisect good or git bisect bad calls. The git bisect
reply will override them anyway, and that's called immediately
after the other two. Going the git bisect (good|bad) is just a
waste of time.

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


# 995bc431 07-Oct-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Fix check for new kernel success on rebooting to good kernel

The reboot function when rebooting back to a good kernel has a check
to make sure that a new kernel was indeed booted. But that check
uses a timeout value, which when calling the monitor will still
return success if the timeout is hit (no bug was found). It should
return an error to let the reboot code know that a new kernel was
not reached. Only the reboot code checks the return value of the
monitor.

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


# fee9d3e6 27-Aug-2014 Chris J Arges <chris.j.arges@canonical.com>

ktest: add ability to skip during BISECT_MANUAL

When doing a manual bisect, a build can fail or a test can be inconclusive.
In these cases it would be helpful to be able to skip the test entirely.

Link: http://lkml.kernel.org/r/1409164021-2136-1-git-send-email-chris.j.arges@canonical.com

Reviewed-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 23a0e161 19-Sep-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Add PATCHCHECK_CHERRY

Add a way to run a patchcheck test on the commits that are in one branch
but not in another. This uses git cherry to find a list of commits to
test each one with.

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


# 4cc559bd 23-Apr-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Add the config bisect manual back

After the rewrite of the config bisect, the bisect manual was
removed. Add it back.

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


# 4186cb45 23-Apr-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Remove unused functions

After the rewrite of the config bisect, there were several unused
functions that can be removed.

One of the unused functions printed out the failed config nicer than
what the rewrite did, so I kept that and used it to output the
bad config.

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


# c4d1d11f 23-Apr-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Put back in the CONFIG_BISECT_CHECK

The new rewrite left out the CONFIG_BISECT_CHECK, which allows the
user to test that their "bad" config still is bad and their "good"
config still is good. This is especially important as the configs
are passed through a "make oldconfig" to update them with the lastest
kernel. Things could change that causes a bad config to work, or a
good config to break. The check is done after the configs have run
through the oldconfig processing.

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


# 6071c22e 23-Apr-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Rewrite the config-bisect to actually work

I never liked the way config-bisect worked. I would assume the bad config
had some config that broke the system. But it would not work if the bad
config just happened to be missing something that the good config had.

I rewrote the config-bisect to do this properly. It does a diff of the two
configs, and sets half of the configs that are in one and not the other.
The way it works is that when it "sets", it really just makes one copy
what the other has. That is, a "set" can be setting a:

# CONFIG_FOO is not set

Basically, it looks at the differences between the two files and makes
them similar until it comes down to one config that makes it work or
not work depending on if it is set or not.

Note, if more than one config change makes the bad config not work, it
will only find one of them. But this is true with all bisect logic.

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


# 5269faad 09-Mar-2014 Satoru Takeuchi <satoru.takeuchi@gmail.com>

ktest: Some cleanup for improving readability

Some cleanup for improving readability as follows.

- Initialize $ktest_config at its definition.
- Put parentheses around the `config-file' argument in the usage message
because it's a optional one.
- Rename get_ktest_config{,s} to more descriptive get_mandatory_config{,s}.

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

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# f983a2bc 02-Mar-2014 Satoru Takeuchi <satoru.takeuchi@gmail.com>

ktest: add 2nd parameter of run_command() to set the redirect target file

If we'd like to set the redirect target file of run_command(),
we should define $redirect before calling this function and should undef it
after calling this function. Since it's user-unfriendly, add 2nd parameter of
run_command() for this purpose.

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

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 961d9cac 18-Jan-2014 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Add BISECT_TRIES to bisect test

For those cases that it takes several tries to hit a bug, it would be
useful for ktest.pl to try a test multiple times before it considers
the test as a pass. To accomplish this, BISECT_TRIES ktest config
option has been added. It is default to one, as most of the time a
bisect only needs to try a test once. But the user can now up this
to make ktest run a given test multiple times. The first failure
that is detected will set a bisect bad. It only repeats on success.

Note, as with all race bugs, there's no guarantee that if it succeeds,
it is really a good bisect. But it helps in case the bug is somewhat
reliable.

You can set BISECT_TRIES to zero, and all tests will be considered
good, unless you also set BISECT_MANUAL.

Suggested-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# c75d22d9 11-Dec-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Add eval '=~' command to modify variables in config file

With the added variable ${KERNEL_VERSION}, it is useful to be
able to use parts of it for other variables.

For example, if you want to create a warnings file for each major
kernel version to test sub versions against you can create
your warnings file with like this:

WARNINGS_FILE = warnings-file-${KERNEL_VERSION}

But this may add 3.8.12 or something, and we want all 3.8.* to
use the same file, and 3.10.* to use another file, and so on.
With the eval command we can, by adding:

WARNINGS_FILE =~ s/(-file-\d+\.\d+).*/$1/

Which will chop off the extra characters after the 3.8.

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


# 8e80bf05 11-Dec-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Add special variable ${KERNEL_VERSION}

Add a special variable that can be used in other variables called
${KERNEL_VERSION}. This will embed the current kernel version into
the variable. For example:

WARNINGS_FILE = ${OUTPUT_DIR}/warnings-${KERNEL_VERSION}

If the current version is v3.8 then the WARNINGS_FILE will become

${OUTPUT_DIR}/warnings-v3.8

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


# 5a5d8e48 30-Nov-2013 Satoru Takeuchi <satoru.takeuchi@gmail.com>

ktest: Make the signal to terminate the console configurable

Currently ktest sends SIGINT to terminate the console.
However, there are consoles which do not exit by this signal, for example,
in my case, "virsh console <guest OS>". In such case, ktest is blocked in
close_console(). It prevents this automate test.

This patch adds new option CLOSE_CONSOLE_SIGNAL which mean the
signal to terminate the console. Since its default value is "INT",
the original behavior isn't changed.

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

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 8b513d0c 21-May-2013 Masanari Iida <standby24x7@gmail.com>

treewide: Fix typo in printk

Correct spelling typo in various part of drivers

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# df5f7c66 24-Apr-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Reset grub menu cache with different machines

Different tests may use a different machine. In such cases, we need to
try to get the current grub menu index. If the same grub menu is used
for two different machines, it may not be at the same index on the
second machine. A search for the index must be performed again.

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


# 752d9665 08-Mar-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Allow tests to use different GRUB_MENUs

To save connecting and searching for a given grub menu for each test,
ktest.pl will cache the grub number it found. The problem is that
different tests might use a different grub menu, but ktest.pl will
ignore it.

Instead, have ktest.pl check if the grub menu it used to cache the
content is the same as when it grabbed the menu. If not, grab it again,
otherwise just return the cached value.

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


# 7328735c 18-Feb-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Remove indexes from warnings check

The index of a line where a warning is tested can be returned
differently on different versions of gcc (or same version compiled
differently). That is, a tab + space can give different results. This
causes the warning check to produce a false positive. Removing the
index from the check fixes this issue.

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


# 4c0b67a2 05-Feb-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Ignore warnings during reboot

The reboot just wants to get to the next kernel. But if a warning (Call
Trace) appears, the monitor will report an error, and the reboot will
think something went wrong and power cycle the box, even though we
successfully made it to the next kernel.

Ignore warnings during the reboot until we get to the next kernel. It
will still timeout if we never get to the next kernel and then a power
cycle will happen. That's what we want it to do.

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


# d6845536 04-Feb-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Search for linux banner for successful reboot

Sometimes when a test kernel passed fine, but on reboot it crashed,
ktest could get stuck and not proceed. This would be frustrating if you
let a test run overnight to find out the next morning that it was stuck
on the first test.

To fix this, I made reboot check for the REBOOT_SUCCESS_LINE. If the
line was not detected, then it would power cycle the box.

What it didn't cover was if the REBOOT_SUCCESS_LINE wasn't defined or if
a 'good' kernel did not display the line. Instead have it search for the
Linux banner "Linux version". The reboot just needs to get to the start
of the next kernel, it does not need to test if the next kernel makes it
to a boot prompt.

After we find the next kernel has booted, then we just wait for either
the REBOOT_SUCCESS_LINE to appear or the timeout.

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


# 4283b169 30-Jan-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Add make_warnings_file and process full warnings

Although the patchcheck test checks for warnings in the files that were
changed, this check does not catch warnings that were caused by header
file changes and the warnings appear in C files not touched by the
commit.

Add a new option called WARNINGS_FILE. If this option is set, then the
file it points to is read before bulid, and the file should contain a
list of known warnings. If a warning appears in the build, this file is
checked, and if the warning does not exist in this file, then it fails
the build showing the new warning.

If the WARNINGS_FILE points to a file that does not exist, this will
cause any warning in the build to fail.

A new test is also added called "make_warnings_file". This test will
create do a build and record any warnings it finds into the
WARNINGS_FILE. This test is something that can be run before other tests
to build a warnings file of "known warnings", ie, warnings that were
there before your changes.

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


# 04262be3 31-Jan-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Allow a test option to use its default option

Options are allowed to use other options, for example:

LOG_FILE = ${OUTPUT_DIR}/${MACHINE}.log

where the option LOG_FILE used the options OUTPUT_DIR and MACHINE.

But if a test option were to use a default option, it will not get
substituted:

OUTPUT_DIR = ${THIS_DIR}/${MACHINE}

TEST_START
OUTPUT_DIR = ${OUTPUT_DIR}/t1

For the above test, OUTPUT_DIR will stay literally "${OUTPUT_DIR}/t1"
and not be converted to "${THIS_DIR}/${MACHINE}/t1". When the test runs,
it will pass the ${OUTPUT_DIR} to the shell, which would probaly
interpret it as "", and the output directory will end up as "/t1".

Change the code where if a test option has its own option name in
its defined field, and a default option exists, then substitute the
default option in its place.

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


# 35275685 29-Jan-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Strip off '\n' when reading which files were modified

The patchcheck test looks at what files are modified for each patch it
checks and makes sure that those files do not produce any warnings.

Unfortunately, when it read the diffstat, the newlines were added on the
files and this made compares miss warnings, and commits that should not
have passed, ktest let pass.

Fix this by using the perl command "chomp" that strips off whitespace at
the end of lines.

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


# 319ab14f 29-Jan-2013 Steven Rostedt (Red Hat) <rostedt@goodmis.org>

ktest: Do not require CONSOLE for build or install bisects

If the user is doing a build or install bisect, there's no reason to
have them define CONSOLE, as the console does not need to be read. The
console only needs to be read for boot tests.

CONSOLE is not required for normal build or install tests, let's not
require it for bisect tests with BISECT_TYPE of build or install.

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


# e1a6c3d7 11-Dec-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Test if target machine is up before install

Sometimes a test kernel will crash or hang on reboot (this is even more
apparent when testing a config without CGROUPS on a box running
systemd). When this happens, on the next iteration of installing a
kernel, ktest will fail when it tries to install.

Have ktest do a check to see if the target can be connected to via ssh
before it tries to install. If it can't connect, then reboot again.
This time the reboot will fail because it can't connect and will force a
power cycle.

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


# 18925170 11-Dec-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Fix breakage from change of oldnoconfig to olddefconfig

Commit fb16d891 "kconfig: replace 'oldnoconfig' with 'olddefconfig', and
keep the old name", changed ktest's default config update from
oldnoconfig to olddefconfig without adding oldnoconfig as a backup.
The make oldnoconfig works much better than its backup of:
yes '' | make oldconfig

But due to this change, and the fact that ktest is used to build lots of
older kernels (and for bisects), it forgoes the oldnoconfig completely.

Cc: Adam Lee <adam8157@gmail.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 7786954c 11-Dec-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add native support for syslinux boot loader

I installed Fedora 17 which no longer supports grub v1. I worked
with grub2 for a while, but there's so many issues with it and automated
rebooting, that I decided to switch to syslinux. Instead of using
the REBOOT_SCRIPT and add customized changes to get syslinux booted,
I thought it better to make ktest aware of syslinux and add options
to simplify the use of syslinux on a target test box.

Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# a4968722 11-Dec-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Sync before reboot

Before rebooting the target, run the sync command, as it seems that
either Grub2 or systemd gets screwed up if you update to reboot a kernel
once and do a reboot without doing a sync.

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


# a15ba913 13-Nov-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add support for grub2

As only grub or 'script' is supported for rebooting to a new kernel,
and Fedora 17 has dropped support for grub, I decided to add grub2
support as well (I also plan on adding syslinux/extlinux support too).

The options GRUB_FILE and GRUB_REBOOT were added to allow the user
to specify where to find the grub.cfg and what tool to use to reboot
into the next kernel respectively.

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


# 8bc5e4ea 25-Oct-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Fix ktest confusion with CONFIG_MODULES_USE_ELF_RELA

In order to decide if ktest should bother installing modules on the
target box, it checks if the config file has CONFIG_MODULES=y. But it
also checks if the '=y' part exists. It only will install modules if the
config exists and is set with '=y'. But as the regex that was used
tests:

/^CONFIG_MODULES(=y)?/

this will also match:

CONFIG_MODULES_USE_ELF_RELA

as the '=y' part was optional and it did not test the rest of the line.
When this happens, ktest will stop checking the rest of the configs but
it will also think that no modules are needed to be installed. What it
should do is only jump out of the loop if it actually found a
CONFIG_MODULES that is set to true.

Otherwise, ktest wont install the necessary modules needed for proper
booting of the test target.

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


# fb16d891 31-Aug-2012 Adam Lee <adam8157@gmail.com>

kconfig: replace 'oldnoconfig' with 'olddefconfig', and keep the old name as an alias

As 67d34a6a391369269a2e5dba8a5f42cc4cd50231 said, 'oldnoconfig' doesn't
set new symbols to 'n', but instead sets it to their default values.

So, this patch replaces 'oldnoconfig' with 'olddefconfig', stop making
people confused, and keep the old name 'oldnoconfig' as an alias,
because people already are dependent on its behavior with the
counter-intuitive name.

Signed-off-by: Adam Lee <adam8157@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>


# 95f57838 26-Sep-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Fix ELSE IF statements

The ELSE IF statements do not work as expected if another ELSE statement
follows. This is because the $if_set is not set. If the ELSE IF
condition is true, the following ELSE should be ignored. But because the
$if_set is not set, the following ELSE will also be executed.

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


# 8fddbe9b 30-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Allow perl regex expressions in conditional statements

Add '=~' and '!~' to the list of allowed conditionals for DEFAULT and
TEST_START section if statements.

ie.

TEST_START IF TEST =~ .*test$

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


# 9b1d367d 30-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Ignore errors it tests if IGNORE_ERRORS is set

The option IGNORE_ERRORS is used to allow a test to succeed even if a
warning appears from the kernel. Sometimes kernels will produce warnings
that are not associated with a test, and the user wants to test
something else.

The IGNORE_ERRORS works for boot up, but was not preventing test runs to
succeed if the kernel produced a warning.

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


# c1434dcc 20-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Reset saved min (force) configs for each test

The min configs are saved in a perl hash called force_configs, and this
hash is used to add configs to the .config file. But it was not being
reset between tests and a min config from a previous test would affect
the min config of the next test causing undesirable results.

Reset the force_config hash at the start of each test.

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


# 8a80c727 19-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add check for bug or panic during reboot

Usually the target is booted into a dependable kernel when a test
starts. The test will install the test kernel and reboot the box. But
there may be a time that the kernel is running an unreliable kernel and
the reboot may crash.

Have ktest detect crashes on a reboot and force a power-cycle instead.

This can usually happen if a test kernel was installed to run manual
tests, but the user forgot to reboot to the known good kernel.

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


# 407b95b7 19-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add MAX_MONITOR_WAIT option

If the console is constantly outputting content, this can cause ktest
to get stuck waiting on the monitor to settle down.

The option MAX_MONITOR_WAIT is the maximum time (in seconds) for ktest
to wait for the console to flush.

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


# cf79fab6 19-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Fix config bisect with how make oldnoconfig works

With a name like 'oldnoconfig' one may think that the config generated
would disable all configs that were not defined (selecting "no" for all
options). But this is not the case. It selects the default. If a config
has a 'default y', then it is added if not specified.

This broke the config bisect, because options not specified by a config
will just use the default, where it expected to turn off. This caused an
option to be enabled that disabled an option that would break the build.
The end result was that we never found the bad config at the end of the
test.

Instead of using 'make oldnoconfig', ktest now builds the options it
expects enabled and disabled. When it turns off an option, it will no
longer remove it, but actually set it to:

# CONFIG_FOO is not set.

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


# b0918612 19-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add CONFIG_BISECT_CHECK option

The config-bisect can take a bad config and bisect it down to find out
what config actually breaks the config. But as all tests will apply a
minconfig (defined by a user) to apply before booting, it is possible
that the minconfig could actually make the bad config work (minconfigs
can disable configs). The end result is that the config bisect test will
not find a config that breaks. This can be rather frustrating to the
user.

The CONFIG_BISECT_CHECK option, when set to 1, will make sure that the
bad config (with the minconfig applied) still fails before trying to
bisect.

And yes, I did get burned by this.

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


# e5c2ec11 19-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add PRE_INSTALL option

Add the PRE_INSTALL option that will allow a user to specify a shell
command to be executed before the install operation executes.

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


# 921ed4c7 19-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add PRE/POST_KTEST and TEST options

In order to let the user add commands before and after ktest runs, the
PRE_KTEST and POST_KTEST options are defined. They hold shell commands
that will execute befor ktest runs its first test, as well as when it
completed its last test.

The PRE_TEST and POST_TEST will be run befor and after (respectively)
for a given test. They can either be global (done for all tests) or
defined by a single test.

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


# 958d8435 19-Jul-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Remove commented exit

A debug 'exit' was left in ktest.pl. Remove it.

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


# 43de3316 21-May-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add USE_OUTPUT_MIN_CONFIG to avoid prompt on make_min_config

If the file that OUTPUT_MIN_CONFIG exists then ktest.pl will prompt the
user and ask them if the OUTPUT_MIN_CONFIG should be used as the
starting point for make_min_config instead of MIN_CONFIG.

This is usually the case, and to allow the user to do so, which is
helpful if the user is creating different min configs based on tests,
and they know one is a superset of another test, they can set
USE_OUTPUT_MIN_CONFIG to one, which will prevent kest.pl from prompting
to use the OUTPUT_MIN_CONFIG and it will just use it.

If USE_OUTPUT_MIN_CONIFG is set to zero, then ktest.pl will continue to
use MIN_CONFIG instead.

The default is that USE_OUTPUT_MIN_CONFIG is undefined.

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


# ccc513b6 21-May-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add MIN_CONFIG_TYPE to allow making a minum .config that has network

Add a MIN_CONFIG_TYPE that can be set to 'test' or 'boot'. The default
is 'boot' which is what make_min_config has done previously: makes a
config file that is the minimum needed to boot the target.

But when MIN_CONFIG_TYPE is set to 'test', not only must the target
boot, but it must also successfully run the TEST. This allows the
creation of a config file that is the minimum to boot and also
perform ssh to the target, or anything else a developer wants.

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


# 683a3e64 18-May-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Fix kernelrevision with POST_BUILD

The PRE_BUILD and POST_BUILD options of ktest are added to allow the
user to add temporary patch to the system and remove it on builds. This
is sometimes use to take a change from another git branch and add it to
a series without the fix so that this series can be tested, when an
unrelated bug exists in the series.

The problem comes when a tagged commit is being used. For example, if
v3.2 is being tested, and we add a patch to it, the kernelrelease for
that commit will be 3.2.0+, but without the patch the version will be
3.2.0. This can cause problems when the kernelrelease is determined for
creating the /lib/modules directory. The kernel booting has the '+' but
the module directory will not, and the modules will be missing for that
boot, and may not allow the kernel to succeed.

The fix is to put the creation of the kernelrelease in the POST_BUILD
logic, before it applies the POST_BUILD operation. The POST_BUILD is
where the patch may be removed, removing the '+' from the kernelrelease.

The calculation of the kernelrelease will also stay in its current
location but will be ignored if it was already calculated previously.

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


# 759a3cc6 01-May-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Fix reboot on success stopping all reboots

The change to let individual tests decide to reboot the machine on
success of the entire test also prevented errors from rebooting
when an error was detected.

The "no_reboot" variable was only cleared if the test had
reboot_on_success set. But the no_reboot variable also prevents the test
rebooting when an error was detected even when REBOOT_ON_ERROR was set.

Add a new "reboot_success" variable that is used to determine if the
test should reboot on success and not touch the no_reboot variable.

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


# 5158ba3e 23-Apr-2012 Russ Dill <Russ.Dill@ti.com>

ktest.pl: Fix combined usage of BISECT_REVERSE and BISECT_SKIP

When BISECT_REVERSE and BISECT_SKIP are used together with boot or test
testing, build failures are treated as boot or test failures and
'git bisect bad' is executed instead of 'git bisect skip'. This is because
the $ret value of -1 is treated as a build failure, but the $reverse_bisect
logic does not properly handle this.

Simple fix, only invert it if it is positive.

Link: http://lkml.kernel.org/r/1335235380-8509-1-git-send-email-Russ.Dill@ti.com

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 648a182c 21-Mar-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Allow a test to override REBOOT_ON_SUCCESS

The option REBOOT_ON_SUCCESS is global, and will have the machine reboot
the the box if all tests are successful. But a test may not want the
machine to reboot, and perhaps have the kernel it loaded be used to
install the next kernel. Or the last test may set up a kernel that the
user may want to look at. In this case, the user could have the global
option REBOOT_ON_SUCCESS be true, but if a test is defined to run at the
end, that test can override the global option and keep the kernel it
installed for the user to log in with.

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


# 769df641 21-Mar-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Fix SWITCH_TO_GOOD to also reboot the machine

When the option SWITCH_TO_GOOD is set, it will be called when the system
needs to reboot to the good server. But currently, this keeps the reboot
from happening. The SWITCH_TO_GOOD is just a way to get to a new kernel,
it may not mean to not reboot.

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


# 02ad2617 21-Mar-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add SCP_TO_TARGET_INSTALL option

Currently the option used to scp both the modules to the target as well
as the kernel image are the same (SCP_TO_TARGET). But some embedded
boards may require them to be different. The modules may need to be put
directly on the board, but the kernel image may need to go to a
tftpserver.

Add the option SCP_TO_TARGET_INSTALL that will allow the user to change
the config so that they may have the modules and image got to different
machines.

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


# 6ca996cc 21-Mar-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add warning when bugs are ignored

When IGNORE_ERRORS is set, ktest will not fail a test if a backtrace
is detected. But this can be an issue if the user added it in the
config but forgot to remove it. They may be left wondering why their
test did not fail, or even worse, why their bisect gave the wrong
commit.

Add a warning in the output if IGNORE_WARNINGS is set, and ktest detects
a kernel error.

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


# 627977d8 21-Mar-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add INSTALL_MOD_STRIP=1 when installing modules

To keep the modules from bloating the target's filesystem
strip them during the install.

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


# bf1c95ab 27-Feb-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Fix make_min_config test when build fails

The make_min_config does not take into account when the build fails,
resulting in a invalid MIN_CONFIG .config file. When the build fails,
it is ignored and the boot test is executed, using the previous built
kernel. The configs that should be tested are not tested and they may
be added or removed depending on the result of the last kernel that
succeeded to be built.

If the build fails, mark the current config as a failure and the
configs that were disabled may still be needed.

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


# f9dee311 11-Feb-2012 Masanari Iida <standby24x7@gmail.com>

tools: Fix typo in ktest.pl

Correct spelling "faied" to "failed" in
tools/testing/ktest/ktest.pl

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# be405f95 04-Jan-2012 Steven Rostedt <srostedt@redhat.com>

ktest: Add INGORE_ERRORS to ignore warnings in boot up

When testing a kernel that has warnings, ktest.pl will fail the test
when it sees the warning. If you need to test the the kernel and want
to ignore the errors that are produced, the option IGNORE_ERRORS has
been added. When IGNORE_ERRORS is set to something other than 0, it will
ignore call traces due to WARN_ON().

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


# 96f6a0df 22-Dec-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Still do reboot even for REBOOT_TYPE = script

The REBOOT_TYPE may be either grub or script, if it is script
it is expected that a REBOOT_SCRIPT is defined.

With the SWITCH_TO_TEST which is the complement of SWITCH_TO_GOOD,
which does basically the same thing as REBOOT_SCRIPT and but for
both grub and script, the REBOOT_SCRIPT does not need to be mandatory
anymore.

Do not require the REBOOT_SCRIPT and always run the reboot code
for both grub and script.

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


# 9cc9e091 22-Dec-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Detect typos in option names

It becomes quite annoying when you go to run a test and then
realize that you typed an option name wrong, and the test starts
doing the default action and not what you expected it to do.

It is even more annoying when you wake up the next day after
running the test over night when you discover this.

By testing if all options specified in a config file are
used by either ktest or were used in one of the option's values
we can see if there are any dangling options that were not used.
In such a case, show the user the options that were not used
and ask them if they want to continue or not.

The option IGNORE_UNUSED was also added to allow the user to
override this feature.

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


# b5f4aea6 22-Dec-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Have all values be set by defaults

Currently the patchcheck, bisect, and config_bisect variables
are only able to be set per test. You can not set a default
value for them.

By letting default values be set, it makes some config files
a bit easier, and also makes it easier to find typos in the
option names.

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


# 4f43e0dc 22-Dec-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Change initialization of defaults hash to perl format

Initializing each default value by specifying the hash name is
ugly. This is one of the rare cases that the "perl way" is actually
much cleaner and easier to read.

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


# bc7c5803 22-Dec-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add options SWITCH_TO_GOOD and SWITCH_TO_TEST

For machines that do no use grub, it may be needed to update an
external image (tftp) before doing a reboot into either the
test image or the known good image.

The option SWITCH_TO_GOOD is added, where if it is defined, the
command that is specified as its value will be executed before
doing a reboot into a known good image.

The option SWITCH_TO_TEST is added, where if it is defined, the
command that is specified as its value will be executed before
doing a reboot into the test image.

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


# c5dacb88 21-Dec-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Allow overriding bisect test results

When running the ktest git bisect test, if the BISECT_TYPE is "test",
the bisect is determined to be good or bad based off of the error
code of the test that is run. Currently, if the test returns 0,
it is considered a pass (good), a non-zero is considered a fail (bad).

But it has been requested to add more options, and also change
the meanings of the error codes of the test. For example, one may
want the test to detect if the commit is not good or bad,
(maybe the bisect came to a point where the code in question
does not exist). The test could report an error code that should tell
ktest to skip the commit.

Also, a test could detect that something is horribly wrong and the
biscet should just be aborted.

The new options:

BISECT_RET_GOOD
BISECT_RET_BAD
BISECT_RET_SKIP
BISECT_RET_ABORT
BISECT_RET_DEFAULT

have been added. The first 4 take an integer value that will
represent if the test should be considered a pass, fail, neither
good nor bad, or abort respectively.

The BISECT_RET_DEFAULT will bo whatever is not defined by the
above codes. If only BISECT_RET_DEFAULT is defined, then all tests
will do the default.

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


# cad96669 22-Dec-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Evaluate options before processing them

All options can take variables "${var}". Before doing any processing
or decision making on the content of an option, evaluate it incase
there are variables that may change the outcome.

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


# 2b29b2f8 22-Dec-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Evaluate $KERNEL_VERSION in both install and post install

The install process may also need to know what the kernel version
is, to add it to the name. Evaluate it for both install and
post install.

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


# 165708b2 26-Nov-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Only ask options needed for install

If all the tests are only for build or install, do not ask
for options not needed to do the install, if the options do
not exist.

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


# dbd3783b 23-Nov-2011 Steven Rostedt <srostedt@redhat.com>

ktest: When creating a new config, ask for BUILD_OPTIONS

When creating a new config, ask for the BUILD_OPTIONS variable
that lets users add things like -j20 to the make.

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


# bb8474b1 23-Nov-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Do not ask for some options if the only test is build

When creating a ktest config or if te config only has build only
tests, some of the manditory config options are not needed.

Do not ask for them if all tests in the config file are just build
tests.

Suggested-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# c4261d0f 23-Nov-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Ask for type of test when creating a new config

When no argument is supplied to ktest, or the config applied does
not exist and a new config is being created, instead of just using
the default test type, give the user an option to pick the test type
of either 'build, install, or boot'. Other options may be added later
but then those would require more questions as they require more
fields. But that's for another release of ktest to add that feature.

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


# dad98754 22-Nov-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Allow bisect test to restart where it left off

If a bisect is killed for some reason, have ktest detect that a bisect
is in progress and if so, allow the user to start the bisect where
it left off.

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


# 0e7a22de 21-Nov-2011 Steven Rostedt <srostedt@redhat.com>

ktest: When creating new config, allow the use of ${THIS_DIR}

Typing in a full path when you know that the path exists within
the directory your are running is tedious and unnecessary.

Allow the user to use ${PWD} if they want a dynamic path name
which will be the path that ktest.pl is executed from
or use ${THIS_DIR} which is a variable assigned `pwd` and
the the variable will exist within the config, allowing the user
to change it and affect all other paths using this variable as well

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


# 600bbf0a 21-Nov-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add default for ssh-user, build-target and target-image

When a user runs ktest without an argument, or the argument given
is not a config file that exists, ktest will ask the user a few
questions to create a simple ktest config file.

A few of the questions should have a default value set, that if anything
it will make it easier for the user to know what is suppose to
be in that value.

These new values are:

SSH_USER, BUILD_TARGET and TARGET_IMAGE

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


# de5b6e3b 18-Nov-2011 Rabin Vincent <rabin@rab.in>

ktest: Allow success logs to be stored

Add a STORE_SUCCESSES option, to allow success logs to be stored, for
example to double-check or otherwise post-process the test logs.

Link: http://lkml.kernel.org/r/1321616131-21352-3-git-send-email-rabin@rab.in

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# a9dd5d63 18-Nov-2011 Rabin Vincent <rabin@rab.in>

ktest: Save test output

The test output may contain useful information; save it along with the
already-saved buildlog, dmesg, and .config.

Link: http://lkml.kernel.org/r/1321616131-21352-1-git-send-email-rabin@rab.in

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# f9dfb65b 18-Nov-2011 Rabin Vincent <rabin@rab.in>

ktest: Check parent options for iterated tests

Let's say we have "OUTPUT_DIR = build/${TEST_NAME}", and we're iterating
a test. In the second iteration of a test, the TEST_NAME of the test
we're repeating is not used. Instead, ${TEST_NAME} appears literally:

touch /home/rabin/kernel/test/build/${TEST_NAME}/.config ... SUCCESS

Fix this by making __eval_option() check the parent test options
for a repeated test.

Link: http://lkml.kernel.org/r/1321616131-21352-2-git-send-email-rabin@rab.in

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 815e2bd7 28-Oct-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Evaluate variables entered on the command line

When ktest.pl is called without any arguments, or if the config
file does not exist, ktest.pl will ask the user for some information.
Some of these questions are code paths. Allowing the user to type
${PWD} for the current directory greatly simplifies these entries.

Add variable processing to the entered values.

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


# 7bf51073 22-Oct-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add variable ${PWD}

Adding the variable ${PWD} that equals `pwd` makes the config files
much simpler.

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


# 9f7424cc 22-Oct-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add another monitor flush before installing kernel

On some tests that do multiple boots (patchcheck, bisect, etc), the build
of the next kernel to run may finish before the stable kernel has finished
booting. Then the install of the new kernel will fail when it tries to connect
as the machine has not finished the boot process.

Do one more monitor flush to make sure the machine is up and running before
trying to connect to it again.

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


# c54367f9 20-Oct-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Do not opencode reboot in grub setting

When setting the next kernel to boot to with grub, do not opencode
the reboot operation. The normal reboot operation can be modified by
config options (namely POWERCYCLE_AFTER_REBOOT). This needs to affect
all reboots. Remove the opencoded reboot to make sure that any changes
to the reboot code also affect all reboots.

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


# 8d735212 17-Oct-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add processing of complex conditionals

The IF statements for DEFAULTS and TEST_START sections now handle
complex statements (&&,||)

Example:

TEST_START IF (DEFINED ALL_TESTS || ${MYTEST} == boottest) && ${MACHINE} == gandalf

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


# a9f84424 17-Oct-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Fix parsing of config section lines

The order for some of the keywords on a section line
(TEST_START or DEFAULTS) does not really matter. Simply need
to remove the keyword from the line as we process it and
evaluate the next keyword in the line. By removing the keywords
as we find them, we do not need to keep track of where on the
line they were found.

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


# ac6974c7 04-Oct-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Sort make_min_config configs by dependecies

The make_min_config test will turn off one config at a time and check
if the config boots or not, and if it does, it will remove that config
plus any config that depended on that config.

ktest already looks if a config has a dependency and will try the
dependency config first. But by sorting the configs and trying the
config with the most configs dependent on it, we can shrink the
minconfig faster.

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


# 9900b5dc 30-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add DEFINED keyword for IF statements

Have IF statements process if a config variable or option has been
defined or not. Can use NOT DEFINED in the case for telling if
a variable or option has not been defined.

DEFAULTS IF NOT DEFINED SSH_USER
SSH_USER = root

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


# 3d1cc414 30-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add OVERRIDE keyword to DEFAULTS section

The OVERRIDE keyword will allow options defined in the given
DEFAULTS section to override options defined in previous DEFAULT
sections.

Normally, options will error if they were previous defined.
The OVERRIDE keyword allows options that have been previously
defined to be changed in the given section.

Note, the same option can not be defined in the same DEFAULT section
even if that section is marked as OVERRIDE.

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


# 0050b6bb 30-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Consolidate TEST_TYPE and DEFAULT code

The code that handles parsing the TEST_TYPE and DEFAULT code share
a lot of common functionality. Combine the two and add a if statement
that does what is different between them.

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


# 2ed3b161 30-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add INCLUDE keyword to include other config files

Have the reading of the config file allow reading of other config
files using the INCLUDE keyword. This allows multiple config files
to share config options.

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


# ab7a3f52 30-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Let IF keyword take comparisons

Allow ==, !=, <=, >=, <, and > to be used in IF statements
to compare if a section should be processed or not.

For example:

BITS := 32

DEFAULTS IF ${BITS} == 32
MIN_CONFIG = ${CONFIG_DIR}/config-32
ELSE
MIN_CONFIG = ${CONFIG_DIR}/config-64

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


# 45d73a5d 30-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add IF and ELSE to config sections

Add IF keyword to sections within the config. Also added an ELSE
keyword that allows different config options to be set for a given
section.

For example:

TYPE := 1
STATUS := 0

DEFAULTS IF ${TYPE}
[...]
ELSE IF ${STATUS}
[...]
ELSE
[...]

The above will process the first section as $TYPE is true. If it
was false, it would process the last section as $STATUS is false.

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


# 4ab1cce5 30-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Do not reboot on config or build issues

Even if REBOOT_ON_ERROR is set, it becomes annoying that the target
machine is rebooted when a config option is incorrect or a build
fails. There's no reason to reboot the target for host only issues.

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


# 2b803365 30-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add option REBOOT_SUCCESS_LINE to stop waiting after a reboot

When ktest.pl reboots, it will usuall wait SLEEP_TIME seconds of idle
console before starting the next test. By setting the
REBOOT_SUCCESS_LINE, ktest will not wait SLEEP_TIME when it detects the
line while rebooting to a new kernel.

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


# e0a8742e 30-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add NO_INSTALL option to not install for a test

There's cases where running the same kernel over and over again
is useful, and being able to not install the same kernel can
save time between tests.

Add a NO_INSTALL option that tells ktest.pl to not install the
new kernel.

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


# eaa1fe25 14-Sep-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Fail when grub menu not found

Currently if the grub menu that is supplied is not found, it will
just boot into the last grub menu in menu.lst. Fail instead of
confusing the user why their kernel is not booting.

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


# 2728be41 12-Aug-2011 Andrew Jones <drjones@redhat.com>

ktest: Include monitor in reboot code

Several places that call reboot do the same thing with respect to the
monitor. By adding this code into the reboot code, redundant code is
removed and it paves the way for the the reset time patch.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Link: http://lkml.kernel.org/r/1313155932-20092-4-git-send-email-drjones@redhat.com
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 13488231 12-Aug-2011 Andrew Jones <drjones@redhat.com>

ktest: Only need to save .config when doing mrproper

Only save the .config file if we're doing mrproper

Signed-off-by: Andrew Jones <drjones@redhat.com>
Link: http://lkml.kernel.org/r/1313155932-20092-3-git-send-email-drjones@redhat.com
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# a908a665 12-Aug-2011 Andrew Jones <drjones@redhat.com>

ktest: Create outputdir if it does not exist

Signed-off-by: Andrew Jones <drjones@redhat.com>
Link: http://lkml.kernel.org/r/1313155932-20092-2-git-send-email-drjones@redhat.com
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# cd8e368f 18-Aug-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add TEST_TYPE install option

In testing one of my boxes, I found that I only wanted to build and
install the kernel. I wanted to manually reboot the box and test it.
Adding a TEST_TYPE option "install" allows this to happen.

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


# 250bae8b 15-Jul-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Fix bug when ADD_CONFIG is set but MIN_CONFIG is not

The MIN_CONFIG is a single config that is considered to have all the
configs that are required to boot the box.

ADD_CONFIG is a list of configs that we add that may contain configs
known to be broken (set off) or just configs that we want every box to
have and this can include shared configs.

If a config has no MIN_CONFIG defined, but has multiple files defined
for the ADD_CONFIG, the test will die, because the MIN_CONFIG will
default to ADD_CONFIG. The problem is the code to open MIN_CONFIG
expects a string of one file, not multiple, and the open will fail.

Since the real minconfig that is used is a concatination of MIN_CONFIG
and ADD_CONFIG files, we change the code to open that instead of
whatever MIN_CONFIG defaults to.

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


# 43d1b651 15-Jul-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Keep fonud configs separate from default configs

The IGNORE_CONFIG file holds the configs that we don't want to change
(with their proper settings). But on start up, the make noconfig is
executed, and the configs that are on are also put into the ignore
config category. But these are configs that were forced on by the
kconfig scripts and not something that we found must be enabled to boot
our machine. By keeping the configs that are forced on by default,
separate from the configs we found that are required to boot the box, we
can get a much more interesting IGNORE_CONFIG. In fact, the
IGNORE_CONFIG can usually end up being the must have configs to boot,
and only have 6 or 7 configs set.

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


# 35ce5952 15-Jul-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add prompt to use OUTPUT_MIN_CONFIG

If the defined OUTPUT_MIN_CONFIG in the make_min_config test exists,
then give a prompt to ask the user if they want to use that config
instead, as it is very often the case, especially when the test has been
interrupted. The OUTPUT_MIN_CONFIG is usually the config that one wants
to use to continue the test where they left off.

But if START_MIN_CONFIG is defined (thus the MIN_CONFIG is not the
default), then do not prompt, as it will be annoying if the user has
this as one of many tests, and the test pauses waiting for input, while
the user is sleeping.

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


# b9066f6c 15-Jul-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Use Kconfig dependencies to shorten time to make min_config

To save time, the test does not just grab any option and test
it. The Kconfig files are examined to determine the dependencies
of the configs. If a config is chosen that depends on another
config, that config will be checked first. By checking the
parents first, we can eliminate whole groups of configs that
may have been enabled.

For example, if a USB device config is chosen and depends on
CONFIG_USB, the CONFIG_USB will be tested before the device.
If CONFIG_USB is found not to be needed, it, as well as all
configs that depend on it, will be disabled and removed from
the current min_config.

Note, the code from streamline_config (make localmodconfig)
was copied and used to find the dependencies in the Kconfig file.

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


# 4c4ab120 15-Jul-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add test type make_min_config

After doing a make localyesconfig, your kernel configuration may
not be the most useful minimum configuration. Having a true minimum
config that you can use against other configs is very useful if
someone else has a config that breaks on your code. By only forcing
those configurations that are truly required to boot your machine
will give you less of a chance that one of your set configurations
will make the bug go away. This will give you a better chance to
be able to reproduce the reported bug matching the broken config.

Note, this does take some time, and may require you to run the
test over night, or perhaps over the weekend. But it also allows
you to interrupt it, and gives you the current minimum config
that was found till that time.

Note, this test automatically assumes a BUILD_TYPE of oldconfig
and its test type acts like boot.

TODO: add a test version that makes the config do more than just
boot, like having network access.

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


# 0df213ca 14-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Require one TEST_START in config file

There has been too many times that I put in one too many SKIP
TEST_STARTs and start the test with the default randconfig by accident
that I added this to have ktest ask the user for which test they want to
run if no TEST_START is specified.

Now if I accidently start the test with all TEST_STARTs skipped, ktest
asks what test do I want to run, and I now have a chance to kill it
before it does a make mrproper on my build directory.

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


# ddf607e5 14-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add helper function to avoid duplicate code

Several places had the following code:

get_grub_index;
get_version;
install;

start_monitor;
return monitor;

Creating a function "start_monitor_and_boot()" replaces these mulitple
uses with a single call.

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


# 1990207d 14-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add IGNORE_WARNINGS to ignore warnings in some patches

Doing a patchcheck test, there may be warnings that gcc produces which
may be OK, and the test should not fail on that commit. By adding a
IGNORE_WARNINGS option to list a space delimited SHA1s that are ignored
lets the user avoid having the test fail on certain commits.

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


# e7b13441 14-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Fix tar extracting of modules to target

The tar command to create the module directory is cjf, but the
extraction only had xf. This works on most versions of tar, but some
versions of tar require xjf for extraction as well.

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


# 48920630 14-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Have the testing tmp dir include machine name

As multiple tests may be executed by the same server, have the test
machine name add uniqueness to the value of the temp directory.
Otherwise the temp directories may overwrite each other's tests.

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


# 0bd6c1a3 14-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add POST/PRE_BUILD options

There are some cases that a patch may be needed to apply to the kernel
in patchcheck or bisect tests. Adding a PRE_BUILD option to apply the
patch and POST_BUILD to remove it, allows for this to be done easily.

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


# db05cfef 13-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Allow initrd processing without modules defined

When a config is set with CONFIG_MODULES=n, it does not mean that the
kernel does not need an initrd to boot. For systems that depend on LVM
and such, an initrd must run first.

If POST_INSTALL is defined, then run the post install regardless if
modules are needed or not.

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


# 23715c3c 13-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Have LOG_FILE evaluate options as well

The LOG_FILE variable needs to evaluate the $ options as well.

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


# ecaf8e52 13-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Have wait on stdio honor bug timeout

After a bug is found, the STOP_AFTER_FAILURE timeout is used to
determine how much output should be printed before breaking out
of the monitor loop. This is to get things like call traces and
enough infromation about the bug to help determine what caused it.

The STOP_AFTER_FAILURE is usually much shorter than the TIMEOUT
that is used to determine when to quit after no more stdio is given.

But since the stdio read uses a wait on I/O, the STOP_AFTER_FAILURE is
only checked after we get something from I/O. But if the I/O does
not return any more data, we wait the TIMEOUT period instead, even
though we already triggered a bug report.

The wait on I/O should honor the STOP_AFTER_FAILURE time if a bug has
been found.

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


# fcb3f16a 13-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Implement our own force min config

Using the build KCONFIG_ALLCONFIG environment variable to force
the min config may not always work properly. Since ktest is
written in perl, it is trivial to read and replace the current
config with the configs specified by the min config.

Now the min config (and add configs) are read by perl and before
a make is done, these configs in the .config file are replaced
by the version in the min config.

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


# 9064af52 13-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add TEST_NAME option

Searching through several tests, it gets confusing which test result
is for which test. By adding the TEST_NAME option, the user can tell
which test result belongs to which test.

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


# 30f75da5 13-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add CONFIG_BISECT_GOOD option

Currently the config_bisect compares the min config with the
CONFIG_BISECT config. There may be another config that we know
is good that we want to ignore configs on. By passing in this
config it will ignore the options that are set in the good config.

Note: This only ignores the config, it does not (yet) handle
options that are different between the two configs. If the good
config has "SLAB" set and the bad config has "SLUB" it will not
find the bug if the bug had to do with changing these two options.

This is something that I intend to implement in the future.

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


# f1a5b962 13-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add detection of triple faults

When a triple fault happens in a test, no call trace nor panic
is displayed. Instead, the system reboots to the good kernel.
Since the good kernel may display a boot prompt that matches the
success string, ktest may think that the test succeeded, when it
did not.

Detecting triple faults is tricky because it is hard to generalize
what a reboot looks like. The best that we can come up with for now
is to examine the Linux banner. If we detect that the Linux banner
matches the test we want to test, then look to see if we hit another
Linux banner with a different kernel is booted. This can be assumed
to be a triple fault.

We can't just check for two Linux banners because things like
early printk may cause the Linux banner to be displayed twice. Checking
for different kernel versions should be the safe bet.

If this for some reason detects a false triple boot. A new ktest
config option is also created:

DETECT_TRIPLE_FAULT

This can be set to 0 to disable this checking.

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


# cd4f1d53 13-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Notify reason to break out of monitoring boot

Different timeouts can cause the ktest monitor to break out of the
loop. It becomes annoying that one does not know the reason why
it exited the monitor loop. Display the cause of the reason why
the loop was exited.

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


# 9bf71749 01-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Ignore unset values of the minconfig in config_bisect

By ignoring the unset values of the minconfig in deciding
what to test in the config_bisect can cause the problem
config from being tested too.

Just do not test the configs that are set in the minconfig.

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


# 4da46da2 01-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Fix result of rebooting the kernel

The command that is called that reboots the kernel may fail
but the return code is not passed back to the ktest.pl script.
This is because a ';' is used between the two commands and
if the second command fails, only the first command's return
code is returned. Using a '&&' between the two commands fixes
this.

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


# 4c8cc55b 01-Jun-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Fix off-by-one in config bisect result

Because in perl the array size returned by $#arr, is the last
index and not the actually size of the array, we end the config
bisect early, thinking there is only one config left when there
are in fact two. Thus the result has a 50% chance of picking
the correct config that caused the problem.

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


# 2a62512b 20-May-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Allow options to be used by other options

There are cases where one ktest option may be used within another
ktest option. Allow them to be reused just like config variables
but there are evaluated at time of test not config processing time.

Thus having something like:

MAKE_CMD = make ARCH=${ARCH}

TEST_START
ARCH = powerpc

TEST_START
ARCH = arm

Will have the arch defined for each test iteration.

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


# 77d942ce 20-May-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Create variables for the ktest config files

I found that I constantly reuse information for each test case.
It would be nice to just define a variable to reuse.

For example I may have:

TEST_START
[...]
TEST = ssh root@mybox /path/to/my/script

TEST_START
[...]
TEST = ssh root@mybox /path/to/my/script

[etc]

The issue is, I may wont to change that script or one of the other
fields. Then I need to update each line individually.

With the addition of config variables (variables only used during parsing
the config) we can simplify the config files. These variables can
also be defined multiple times and each time the new value will
overwrite the old value.

The convention to use a config variable over a ktest option is to use :=
instead of =.

Now we could do:

USER := root
TARGET := mybox
TEST_SCRIPT := /path/to/my/script
TEST_CASE := ${USER}@${TARGET} ${TEST_SCRIPT}

TEST_START
[...]
TEST = ${TEST_CASE}

TEST_START
[...]
TEST = ${TEST_CASE}

[etc]

Now we just need to update the variables at the top.

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


# 27d934b2 20-May-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Reboot after each patchcheck run

The patches being checked may not leave the kernel in a state
that the next run will allow the new kernel to be copied to the
machine. Reboot to a known good kernel before continuing to the
next kernel to test.

Added option PATCHCHECK_SLEEP_TIME for the max time to sleep between
patchcheck reboots.

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


# 4025bc62 20-May-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Reboot to good kernel after every bisect run

Reboot after each bisect run regardless if the bisect passed
or failed. The test may just be to boot the kernel and that kernel
may not have a way to copy the next kerne to it. Reboot to a known
good kernel after each bisect run.

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


# 4d62bf51 20-May-2011 Steven Rostedt <srostedt@redhat.com>

ktest: If test failed due to timeout, print that

If the test failed due to timeout for boot, print a message saying
so. Otherwise the user will be confused to why their test just failed.

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


# ca6a21f8 25-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Fix post install command

The command to run post install (for those that want initrds) was
broken. Instead of doing a substitution for the $KERNEL_VERSION
variable. It was replacing the entire command with nothing.

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


# 2d01b26a 08-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add STOP_TEST_AFTER to stop the test after a period of time

Currently, if a test causes constant output but never reaches a
boot prompt, or crashes, the test will never stop. Add STOP_TEST_AFTER
to create a variable that will stop (and fail) the test after it has run
for this amount of time. The default is 10 minutes. Setting this
variable to -1 will disable it.

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


# 8ea0e063 08-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Monitor kernel while running of user tests

Record the console of tests to both the console and the log.
Also, record the bug reports afte the test has completed.
Currently, if a kernel bug happens while running the userland
test, the test stops and will not record the kernel bug. This
makes it difficult to solve what happened.

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


# 4651920e 08-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Fix bug where the test would not end after failure

The config STOP_AFTER_FAILURE is the number of seconds to continue
the test when a failure is detected. This lets the monitor record
more data to the logs and console that may be helpful in solving
the bug that was found.

But the test had a bug. If the failure caused multiple
"Call Trace" stack dumps, the start time to compare the
STOP_AFTER_FAILURE would constantly be reset. Only update the start
time at the first "Call Trace" instance.

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


# 3410f6fd 08-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add BISECT_FILES to run git bisect on paths

Add the config option BISECT_FILES that allows the user to
specify what path in the kernel to run the git bisect on.

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


# c23dca7c 08-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add BISECT_SKIP

If a during a git bisect, ktest fails on something other than
what it is testing (if BISECT_TYPE is test but it fails on build),
if BISECT_SKIP is set, then it will do a "git bisect skip" instead
of just failing the bisect and letting the user find a good commit
to test.

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


# c960bb9f 08-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Add manual bisect

For both git bisect and config bisect, if BISECT_MANUAL is set to 1,
then bisect will stop between iterations and ask the user for the
result. The actual result is ignored. This makes it possible to
use ktest.pl for bisecting configs and git and let the user examine
the results themselves and enter their own results.

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


# 612b9e9b 07-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Handle kernels before make oldnoconfig

When bisecting, one may come across a kernel that does not have
make oldnoconfig. In this case, we need to run the command "yes"
into a make oldconfig. This will select defaults instead of 'n'
into each command, but it works as a work around.

Note, "yes n" will not work because a config may have a value that
"n" is not acceptable for.

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


# 10abf118 07-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Start failure timeout on panic too

Currently we just look for a Call Trace to start the time out
when to reboot the box. But if the kernel panics and does not
show a Call Trace, the test will not reboot the box after
the specified timeout.

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


# f80802cb 07-Mar-2011 Steven Rostedt <srostedt@redhat.com>

ktest: Print logfile name on failure

If the test fails and a logfile was specified. Print the name to
let the user know where to look for more information on the
failure.

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


# cce1dac8 24-Jan-2011 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

trivial: Fix Steven's Copyright typos

OK, the copyright allows you to write a copy, still I think the lawyers
prefer the correct spelling.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
LKML-Reference: <1295899921-11333-1-git-send-email-u.kleine-koenig@pengutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 8d1491ba 18-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Ask for the manditory config options instead of just failing

In keeping with the notion that all tools should be simple for
all to use. I've changed ktest.pl to ask for mandatory options
instead of just failing. It will append (or create) the options
the user types in, onto the config file.

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


# f1a27850 11-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Copy the last good and bad configs in config_bisect

During the config_bisect, in case of failure, it is nice to have
the last good and bad .configs that were used. This would let
us restart the config_bisect from those configs.

Copy the last good config into the output dir as config_good,
and the last bad config as config_bad.

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


# eec56460 10-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: For grub reboot, use run_ssh instead of run_command

The run_ssh handles the ssh variable $SSH_COMMAND, which was not
being used by the run_command in reboot_to function.

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


# 1c8a617a 08-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Added force stop after success and failure

Added the options STOP_AFTER_SUCCESS and STOP_AFTER_FAILURE to
allow the user to give a time (in seconds) to stop the monitor
after a stack trace or login has been detected. Sometimes the
kernel constantly prints out to the console and this may cause
the test to run indefinitely.

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


# cccae1a6 08-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Parse off the directory name in useconfig for failures

When we store failures, we create a directory that has the build_type
in it. For useconfig, it also contains the name path of the config
file it uses. This unfortunately gets its own directory on failure.
Parse off the directory name when creating the directory to store
the failures.

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


# 9be2e6b5 08-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Use different temp config name for minconfig

By using the "use_config" for minconfig and addconfig we risk
trying to copy itself to itself, which will cause an unexpected failure.

Use a different name instead.

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


# 0a05c769 08-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Added config_bisect test type

Added the ability to do a config_bisect. It starts with a bad
config and does the following loop.

Enable half the configs.
if none of the configs to check are not enabled
(caused by missing dependencies) enable the other half.
Run the test
if the test passes, remove the configs from the check
but enabled them for further tests (to satisfy
dependencies).
else
Remove any config that was not enabled, as we have found
a new config that can cause a failure.
loop till we have only one config left.

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


# e48c5293 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest/cleanups: Added version 0.2, ssh as options

Updated to version 0.2.

Now have SSH_EXEC options.

Also added some cleanups for keeping track of success and
reading the config file.

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


# 7a849cd9 08-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Output something easy to parse for failure or success

Have a easy way to parse the log file for success or failure.

KTEST RESULT: ...

Suggested-by: Tim Bird <tim.bird@am.sony.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


# 21a9679f 08-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Allow a test case to undefine a default value

Allow a test case in the config file to undefine a default
value by specifying the option and equal sign but not assigning
it a value:

OPTION =

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


# 51ad1dd1 08-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Use $output_config instead of typing $outputdir/.config

To help prevent typos, use $output_config as the reference to
"$outputdir/.config".

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


# d1e2f22a 08-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Write to stdout if no log file is given

If no LOG_FILE option is set, then write what would be logged to
that file to standard output.

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


# 9386c6ab 08-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Use oldnoconfig instead of yes command

Running the command "yes ''" through the make oldconfig may enable
things we do not want enabled. If something is default enabled, the
yes command with '' as an argument will enable it.

Use oldnoconfig, which runs everything as if 'no' was used.

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


# a57419b3 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: New TEST_START instead of using [], and use real SHA1s

Change the config to use TEST_START where the options after a
TEST_START automatically get the [] as it is read and they do
not need to exist in the config file;

TEST_START
MIN_CONFIG = myconfig

is the same as

MIN_CONFIG[1] = myconfig

The benefit is that you no longer need to keep track of test numbers
with tests.

Also process the commit ids that are passed to the options
to get the actually SHA1 so it is no longer relative to the branch.
Ie, saying HEAD will get the current SHA1 and then that will
be used, and will work even if another branch is checked out.

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


# 576f627c 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Add poweroff after halt and powercycle after reboot

Added the options POWEROFF_AFTER_HALT to handle boxes that do not
really shut off after a halt is called.

Added POWERCYCLE_AFTER_REBOOT to force a power cycle for boxes that
don't reboot but get stuck during the reboot.

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


# 8b37ca8c 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Add POST_INSTALL to allow initrds to be created

Add a POST_INSTALL option that runs after the build and install
but before rebooting to the test kernel. This alls the user to
run a script that will install an initrd (or anything else that may
be special) before booting.

An environment variable KERNEL_VERSION is set.

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


# a75fecec 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Added sample.conf, new %default option format

Added sample.conf as a nice document to show new users.

Use a %default hash to separate out the options that are default
and allow us to complain about options being set twice.

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


# 7faafbd6 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Add open and close console and start stop monitor

It is much better to keep the monitor running throughout a
test than to constantly start and stop it. Some console readers
will show everything that has happened before when opening the
console, and by opening it several times, causes the old content to
be read multiple times in a single test.

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


# 2b7d9b21 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Added continuing on success, clear log and timeout

Add option to continue after a test fails.

Add option to reset the log at start of running ktest.

Update default timeout to 2 minutes.

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


# d6ce2a0b 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Add reverse bisect, better logging, copyright

Added the ability to do a reverse bisect.

Better logging of running commands.

Added the copyright statement.

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


# 6c5ee0be 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Added patchcheck

Added patchcheck functionality. It will checkout a given SHA1
and test that commit and all commits to another given SHA1.

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


# 1a5cfce3 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Added reboot on success

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


# 5a391fbf 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Added better console, add test build

Better reading of the console.

Added running a script to do testing after build succeeds.

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


# 5f9b6ced 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: Bisecting, install modules, add logging

Added bisecting, modules, logging of the output.
Banners that show success.

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


# 75c3fda7 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: New features reboot on error, make options

REBOOT_ON_ERROR to reboot the box on error

BUILD_OPTIONS to add options to the make build (like -j40)

Added "useconfig:<config>".

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


# 5c42fc5b 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

ktest: New features: noclean, dodie, poweroff on error and success

Added dodie function to have a bit more control over die calls.

BUILD_NOCLEAN to not run make mrproper or remove .config.

POWEROFF_ON_{SUCCESS,ERROR} to turn off the power after tests.

Skip backtrace calls that were done by the backtrace tests.

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


# 2545eb61 02-Nov-2010 Steven Rostedt <srostedt@redhat.com>

Initial start of ktest.pl

Originally named autotest.pl, but renamed to ktest.pl now because
the autotest name is used by other projects.

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