aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/power/cpupower/man/cpupower-set.19
-rw-r--r--tools/power/cpupower/utils/helpers/sysfs.c35
-rw-r--r--tools/testing/ktest/examples/README32
-rw-r--r--tools/testing/ktest/examples/crosstests.conf260
-rw-r--r--tools/testing/ktest/examples/include/bisect.conf90
-rw-r--r--tools/testing/ktest/examples/include/defaults.conf157
-rw-r--r--tools/testing/ktest/examples/include/min-config.conf60
-rw-r--r--tools/testing/ktest/examples/include/patchcheck.conf74
-rw-r--r--tools/testing/ktest/examples/include/tests.conf74
-rw-r--r--tools/testing/ktest/examples/kvm.conf88
-rw-r--r--tools/testing/ktest/examples/snowball.conf53
-rw-r--r--tools/testing/ktest/examples/test.conf62
-rwxr-xr-xtools/testing/ktest/ktest.pl36
-rw-r--r--tools/testing/ktest/sample.conf18
-rw-r--r--tools/usb/ffs-test.c2
-rw-r--r--tools/usb/testusb.c5
-rw-r--r--tools/virtio/linux/virtio.h1
-rw-r--r--tools/virtio/virtio_test.c26
18 files changed, 1033 insertions, 49 deletions
diff --git a/tools/power/cpupower/man/cpupower-set.1 b/tools/power/cpupower/man/cpupower-set.1
index c4954a9fe4e7..9dbd536518ab 100644
--- a/tools/power/cpupower/man/cpupower-set.1
+++ b/tools/power/cpupower/man/cpupower-set.1
@@ -85,15 +85,6 @@ Possible values are:
85savings 85savings
86.RE 86.RE
87 87
88sched_mc_power_savings is dependent upon SCHED_MC, which is
89itself architecture dependent.
90
91sched_smt_power_savings is dependent upon SCHED_SMT, which
92is itself architecture dependent.
93
94The two files are independent of each other. It is possible
95that one file may be present without the other.
96
97.SH "SEE ALSO" 88.SH "SEE ALSO"
98cpupower-info(1), cpupower-monitor(1), powertop(1) 89cpupower-info(1), cpupower-monitor(1), powertop(1)
99.PP 90.PP
diff --git a/tools/power/cpupower/utils/helpers/sysfs.c b/tools/power/cpupower/utils/helpers/sysfs.c
index c6343024a611..96e28c124b5c 100644
--- a/tools/power/cpupower/utils/helpers/sysfs.c
+++ b/tools/power/cpupower/utils/helpers/sysfs.c
@@ -362,22 +362,7 @@ char *sysfs_get_cpuidle_driver(void)
362 */ 362 */
363int sysfs_get_sched(const char *smt_mc) 363int sysfs_get_sched(const char *smt_mc)
364{ 364{
365 unsigned long value; 365 return -ENODEV;
366 char linebuf[MAX_LINE_LEN];
367 char *endp;
368 char path[SYSFS_PATH_MAX];
369
370 if (strcmp("mc", smt_mc) && strcmp("smt", smt_mc))
371 return -EINVAL;
372
373 snprintf(path, sizeof(path),
374 PATH_TO_CPU "sched_%s_power_savings", smt_mc);
375 if (sysfs_read_file(path, linebuf, MAX_LINE_LEN) == 0)
376 return -1;
377 value = strtoul(linebuf, &endp, 0);
378 if (endp == linebuf || errno == ERANGE)
379 return -1;
380 return value;
381} 366}
382 367
383/* 368/*
@@ -388,21 +373,5 @@ int sysfs_get_sched(const char *smt_mc)
388 */ 373 */
389int sysfs_set_sched(const char *smt_mc, int val) 374int sysfs_set_sched(const char *smt_mc, int val)
390{ 375{
391 char linebuf[MAX_LINE_LEN]; 376 return -ENODEV;
392 char path[SYSFS_PATH_MAX];
393 struct stat statbuf;
394
395 if (strcmp("mc", smt_mc) && strcmp("smt", smt_mc))
396 return -EINVAL;
397
398 snprintf(path, sizeof(path),
399 PATH_TO_CPU "sched_%s_power_savings", smt_mc);
400 sprintf(linebuf, "%d", val);
401
402 if (stat(path, &statbuf) != 0)
403 return -ENODEV;
404
405 if (sysfs_write_file(path, linebuf, MAX_LINE_LEN) == 0)
406 return -1;
407 return 0;
408} 377}
diff --git a/tools/testing/ktest/examples/README b/tools/testing/ktest/examples/README
new file mode 100644
index 000000000000..a12d295a09d8
--- /dev/null
+++ b/tools/testing/ktest/examples/README
@@ -0,0 +1,32 @@
1This directory contains example configs to use ktest for various tasks.
2The configs still need to be customized for your environment, but it
3is broken up by task which makes it easier to understand how to set up
4ktest.
5
6The configs are based off of real working configs but have been modified
7and commented to show more generic use cases that are more helpful for
8developers.
9
10crosstests.conf - this config shows an example of testing a git repo against
11 lots of different architectures. It only does build tests, but makes
12 it easy to compile test different archs. You can download the arch
13 cross compilers from:
14 http://kernel.org/pub/tools/crosstool/files/bin/x86_64/
15
16test.conf - A generic example of a config. This is based on an actual config
17 used to perform real testing.
18
19kvm.conf - A example of a config that is used to test a virtual guest running
20 on a host.
21
22snowball.conf - An example config that was used to demo ktest.pl against
23 a snowball ARM board.
24
25include/ - The include directory holds default configs that can be
26 included into other configs. This is a real use example that shows how
27 to reuse configs for various machines or set ups. The files here
28 are included by other config files, where the other config files define
29 options and variables that will make the included config work for the
30 given environment.
31
32
diff --git a/tools/testing/ktest/examples/crosstests.conf b/tools/testing/ktest/examples/crosstests.conf
new file mode 100644
index 000000000000..46736604c26c
--- /dev/null
+++ b/tools/testing/ktest/examples/crosstests.conf
@@ -0,0 +1,260 @@
1#
2# Example config for cross compiling
3#
4# In this config, it is expected that the tool chains from:
5#
6# http://kernel.org/pub/tools/crosstool/files/bin/x86_64/
7#
8# running on a x86_64 system have been downloaded and installed into:
9#
10# /usr/local/
11#
12# such that the compiler binaries are something like:
13#
14# /usr/local/gcc-4.5.2-nolibc/mips-linux/bin/mips-linux-gcc
15#
16# Some of the archs will use gcc-4.5.1 instead of gcc-4.5.2
17# this config uses variables to differentiate them.
18#
19# Comments describe some of the options, but full descriptions of
20# options are described in the samples.conf file.
21
22# ${PWD} is defined by ktest.pl to be the directory that the user
23# was in when they executed ktest.pl. It may be better to hardcode the
24# path name here. THIS_DIR is the variable used through out the config file
25# in case you want to change it.
26
27THIS_DIR := ${PWD}
28
29# Update the BUILD_DIR option to the location of your git repo you want to test.
30BUILD_DIR = ${THIS_DIR}/linux.git
31
32# The build will go into this directory. It will be created when you run the test.
33OUTPUT_DIR = ${THIS_DIR}/cross-compile
34
35# The build will be compiled with -j8
36BUILD_OPTIONS = -j8
37
38# The test will not stop when it hits a failure.
39DIE_ON_FAILURE = 0
40
41# If you want to have ktest.pl store the failure somewhere, uncomment this option
42# and change the directory where ktest should store the failures.
43#STORE_FAILURES = ${THIS_DIR}/failures
44
45# The log file is stored in the OUTPUT_DIR called cross.log
46# If you enable this, you need to create the OUTPUT_DIR. It wont be created for you.
47LOG_FILE = ${OUTPUT_DIR}/cross.log
48
49# The log file will be cleared each time you run ktest.
50CLEAR_LOG = 1
51
52# As some archs do not build with the defconfig, they have been marked
53# to be ignored. If you want to test them anyway, change DO_FAILED to 1.
54# If a test that has been marked as DO_FAILED passes, then you should change
55# that test to be DO_DEFAULT
56
57DO_FAILED := 0
58DO_DEFAULT := 1
59
60# By setting both DO_FAILED and DO_DEFAULT to zero, you can pick a single
61# arch that you want to test. (uncomment RUN and chose your arch)
62#RUN := m32r
63
64# At the bottom of the config file exists a bisect test. You can update that
65# test and set DO_FAILED and DO_DEFAULT to zero, and uncomment this variable
66# to run the bisect on the arch.
67#RUN := bisect
68
69# By default all tests will be running gcc 4.5.2. Some tests are using 4.5.1
70# and they select that in the test.
71# Note: GCC_VER is declared as on option and not a variable ('=' instead of ':=')
72# This is important. A variable is used only in the config file and if it is set
73# it stays that way for the rest of the config file until it is change again.
74# Here we want GCC_VER to remain persistent and change for each test, as it is used in
75# the MAKE_CMD. By using '=' instead of ':=' we achieve our goal.
76
77GCC_VER = 4.5.2
78MAKE_CMD = PATH=/usr/local/gcc-${GCC_VER}-nolibc/${CROSS}/bin:$PATH CROSS_COMPILE=${CROSS}- make ARCH=${ARCH}
79
80# all tests are only doing builds.
81TEST_TYPE = build
82
83# If you want to add configs on top of the defconfig, you can add those configs into
84# the add-config file and uncomment this option. This is useful if you want to test
85# all cross compiles with PREEMPT set, or TRACING on, etc.
86#ADD_CONFIG = ${THIS_DIR}/add-config
87
88# All tests are using defconfig
89BUILD_TYPE = defconfig
90
91# The test names will have the arch and cross compiler used. This will be shown in
92# the results.
93TEST_NAME = ${ARCH} ${CROSS}
94
95# alpha
96TEST_START IF ${RUN} == alpha || ${DO_DEFAULT}
97# Notice that CROSS and ARCH are also options and not variables (again '=' instead
98# of ':='). This is because TEST_NAME and MAKE_CMD wil use them for each test.
99# Only options are available during runs. Variables are only present in parsing the
100# config file.
101CROSS = alpha-linux
102ARCH = alpha
103
104# arm
105TEST_START IF ${RUN} == arm || ${DO_DEFAULT}
106CROSS = arm-unknown-linux-gnueabi
107ARCH = arm
108
109# black fin
110TEST_START IF ${RUN} == bfin || ${DO_DEFAULT}
111CROSS = bfin-uclinux
112ARCH = blackfin
113BUILD_OPTIONS = -j8 vmlinux
114
115# cris - FAILS?
116TEST_START IF ${RUN} == cris || ${RUN} == cris64 || ${DO_FAILED}
117CROSS = cris-linux
118ARCH = cris
119
120# cris32 - not right arch?
121TEST_START IF ${RUN} == cris || ${RUN} == cris32 || ${DO_FAILED}
122CROSS = crisv32-linux
123ARCH = cris
124
125# ia64
126TEST_START IF ${RUN} == ia64 || ${DO_DEFAULT}
127CROSS = ia64-linux
128ARCH = ia64
129
130# frv
131TEST_START IF ${RUN} == frv || ${DO_FAILED}
132CROSS = frv-linux
133ARCH = frv
134GCC_VER = 4.5.1
135
136# h8300 - failed make defconfig??
137TEST_START IF ${RUN} == h8300 || ${DO_FAILED}
138CROSS = h8300-elf
139ARCH = h8300
140GCC_VER = 4.5.1
141
142# m68k fails with error?
143TEST_START IF ${RUN} == m68k || ${DO_DEFAULT}
144CROSS = m68k-linux
145ARCH = m68k
146
147# mips64
148TEST_START IF ${RUN} == mips || ${RUN} == mips64 || ${DO_DEFAULT}
149CROSS = mips64-linux
150ARCH = mips
151
152# mips32
153TEST_START IF ${RUN} == mips || ${RUN} == mips32 || ${DO_DEFAULT}
154CROSS = mips-linux
155ARCH = mips
156
157# m32r
158TEST_START IF ${RUN} == m32r || ${DO_FAILED}
159CROSS = m32r-linux
160ARCH = m32r
161GCC_VER = 4.5.1
162BUILD_OPTIONS = -j8 vmlinux
163
164# parisc64 failed?
165TEST_START IF ${RUN} == hppa || ${RUN} == hppa64 || ${DO_FAILED}
166CROSS = hppa64-linux
167ARCH = parisc
168
169# parisc
170TEST_START IF ${RUN} == hppa || ${RUN} == hppa32 || ${DO_FAILED}
171CROSS = hppa-linux
172ARCH = parisc
173
174# ppc
175TEST_START IF ${RUN} == ppc || ${RUN} == ppc32 || ${DO_DEFAULT}
176CROSS = powerpc-linux
177ARCH = powerpc
178
179# ppc64
180TEST_START IF ${RUN} == ppc || ${RUN} == ppc64 || ${DO_DEFAULT}
181CROSS = powerpc64-linux
182ARCH = powerpc
183
184# s390
185TEST_START IF ${RUN} == s390 || ${DO_DEFAULT}
186CROSS = s390x-linux
187ARCH = s390
188
189# sh
190TEST_START IF ${RUN} == sh || ${DO_DEFAULT}
191CROSS = sh4-linux
192ARCH = sh
193
194# sparc64
195TEST_START IF ${RUN} == sparc || ${RUN} == sparc64 || ${DO_DEFAULT}
196CROSS = sparc64-linux
197ARCH = sparc64
198
199# sparc
200TEST_START IF ${RUN} == sparc || ${RUN} == sparc32 || ${DO_DEFAULT}
201CROSS = sparc-linux
202ARCH = sparc
203
204# xtensa failed
205TEST_START IF ${RUN} == xtensa || ${DO_FAILED}
206CROSS = xtensa-linux
207ARCH = xtensa
208
209# UML
210TEST_START IF ${RUN} == uml || ${DO_DEFAULT}
211MAKE_CMD = make ARCH=um SUBARCH=x86_64
212ARCH = uml
213CROSS =
214
215TEST_START IF ${RUN} == x86 || ${RUN} == i386 || ${DO_DEFAULT}
216MAKE_CMD = make ARCH=i386
217ARCH = i386
218CROSS =
219
220TEST_START IF ${RUN} == x86 || ${RUN} == x86_64 || ${DO_DEFAULT}
221MAKE_CMD = make ARCH=x86_64
222ARCH = x86_64
223CROSS =
224
225#################################
226
227# This is a bisect if needed. You need to give it a MIN_CONFIG that
228# will be the config file it uses. Basically, just copy the created defconfig
229# for the arch someplace and point MIN_CONFIG to it.
230TEST_START IF ${RUN} == bisect
231MIN_CONFIG = ${THIS_DIR}/min-config
232CROSS = s390x-linux
233ARCH = s390
234TEST_TYPE = bisect
235BISECT_TYPE = build
236BISECT_GOOD = v3.1
237BISECT_BAD = v3.2
238CHECKOUT = v3.2
239
240#################################
241
242# These defaults are needed to keep ktest.pl from complaining. They are
243# ignored because the test does not go pass the build. No install or
244# booting of the target images.
245
246DEFAULTS
247MACHINE = crosstest
248SSH_USER = root
249BUILD_TARGET = cross
250TARGET_IMAGE = image
251POWER_CYCLE = cycle
252CONSOLE = console
253LOCALVERSION = version
254GRUB_MENU = grub
255
256REBOOT_ON_ERROR = 0
257POWEROFF_ON_ERROR = 0
258POWEROFF_ON_SUCCESS = 0
259REBOOT_ON_SUCCESS = 0
260
diff --git a/tools/testing/ktest/examples/include/bisect.conf b/tools/testing/ktest/examples/include/bisect.conf
new file mode 100644
index 000000000000..009bea65bfb6
--- /dev/null
+++ b/tools/testing/ktest/examples/include/bisect.conf
@@ -0,0 +1,90 @@
1#
2# This example shows the bisect tests (git bisect and config bisect)
3#
4
5
6# The config that includes this file may define a RUN_TEST
7# variable that will tell this config what test to run.
8# (what to set the TEST option to).
9#
10DEFAULTS IF NOT DEFINED RUN_TEST
11# Requires that hackbench is in the PATH
12RUN_TEST := ${SSH} hackbench 50
13
14
15# Set TEST to 'bisect' to do a normal git bisect. You need
16# to modify the options below to make it bisect the exact
17# commits you are interested in.
18#
19TEST_START IF ${TEST} == bisect
20TEST_TYPE = bisect
21# You must set the commit that was considered good (git bisect good)
22BISECT_GOOD = v3.3
23# You must set the commit that was considered bad (git bisect bad)
24BISECT_BAD = HEAD
25# It's best to specify the branch to checkout before starting the bisect.
26CHECKOUT = origin/master
27# This can be build, boot, or test. Here we are doing a bisect
28# that requires to run a test to know if the bisect was good or bad.
29# The test should exit with 0 on good, non-zero for bad. But see
30# the BISECT_RET_* options in samples.conf to override this.
31BISECT_TYPE = test
32TEST = ${RUN_TEST}
33# It is usually a good idea to confirm that the GOOD and the BAD
34# commits are truly good and bad respectively. Having BISECT_CHECK
35# set to 1 will check both that the good commit works and the bad
36# commit fails. If you only want to check one or the other,
37# set BISECT_CHECK to 'good' or to 'bad'.
38BISECT_CHECK = 1
39#BISECT_CHECK = good
40#BISECT_CHECK = bad
41
42# Usually it's a good idea to specify the exact config you
43# want to use throughout the entire bisect. Here we placed
44# it in the directory we called ktest.pl from and named it
45# 'config-bisect'.
46MIN_CONFIG = ${THIS_DIR}/config-bisect
47# By default, if we are doing a BISECT_TYPE = test run but the
48# build or boot fails, ktest.pl will do a 'git bisect skip'.
49# Uncomment the below option to make ktest stop testing on such
50# an error.
51#BISECT_SKIP = 0
52# Now if you had BISECT_SKIP = 0 and the test fails, you can
53# examine what happened and then do 'git bisect log > /tmp/replay'
54# Set BISECT_REPLAY to /tmp/replay and ktest.pl will run the
55# 'git bisect replay /tmp/replay' before continuing the bisect test.
56#BISECT_REPLAY = /tmp/replay
57# If you used BISECT_REPLAY after the bisect test failed, you may
58# not want to continue the bisect on that commit that failed.
59# By setting BISECT_START to a new commit. ktest.pl will checkout
60# that commit after it has performed the 'git bisect replay' but
61# before it continues running the bisect test.
62#BISECT_START = 2545eb6198e7e1ec50daa0cfc64a4cdfecf24ec9
63
64# Now if you don't trust ktest.pl to make the decisions for you, then
65# set BISECT_MANUAL to 1. This will cause ktest.pl not to decide
66# if the commit was good or bad. Instead, it will ask you to tell
67# it if the current commit was good. In the mean time, you could
68# take the result, load it on any machine you want. Run several tests,
69# or whatever you feel like. Then, when you are happy, you can tell
70# ktest if you think it was good or not and ktest.pl will continue
71# the git bisect. You can even change what commit it is currently at.
72#BISECT_MANUAL = 1
73
74
75# One of the unique tests that ktest does is the config bisect.
76# Currently (which hopefully will be fixed soon), the bad config
77# must be a superset of the good config. This is because it only
78# searches for a config that causes the target to fail. If the
79# good config is not a subset of the bad config, or if the target
80# fails because of a lack of a config, then it will not find
81# the config for you.
82TEST_START IF ${TEST} == config-bisect
83TEST_TYPE = config_bisect
84# set to build, boot, test
85CONFIG_BISECT_TYPE = boot
86# Set the config that is considered bad.
87CONFIG_BISECT = ${THIS_DIR}/config-bad
88# This config is optional. By default it uses the
89# MIN_CONFIG as the good config.
90CONFIG_BISECT_GOOD = ${THIS_DIR}/config-good
diff --git a/tools/testing/ktest/examples/include/defaults.conf b/tools/testing/ktest/examples/include/defaults.conf
new file mode 100644
index 000000000000..323a552ce642
--- /dev/null
+++ b/tools/testing/ktest/examples/include/defaults.conf
@@ -0,0 +1,157 @@
1# This file holds defaults for most the tests. It defines the options that
2# are most common to tests that are likely to be shared.
3#
4# Note, after including this file, a config file may override any option
5# with a DEFAULTS OVERRIDE section.
6#
7
8# For those cases that use the same machine to boot a 64 bit
9# and a 32 bit version. The MACHINE is the DNS name to get to the
10# box (usually different if it was 64 bit or 32 bit) but the
11# BOX here is defined as a variable that will be the name of the box
12# itself. It is useful for calling scripts that will power cycle
13# the box, as only one script needs to be created to power cycle
14# even though the box itself has multiple operating systems on it.
15# By default, BOX and MACHINE are the same.
16
17DEFAULTS IF NOT DEFINED BOX
18BOX := ${MACHINE}
19
20
21# Consider each box as 64 bit box, unless the config including this file
22# has defined BITS = 32
23
24DEFAULTS IF NOT DEFINED BITS
25BITS := 64
26
27
28DEFAULTS
29
30# THIS_DIR is used through out the configs and defaults to ${PWD} which
31# is the directory that ktest.pl was called from.
32
33THIS_DIR := ${PWD}
34
35
36# to orginize your configs, having each machine save their configs
37# into a separate directly is useful.
38CONFIG_DIR := ${THIS_DIR}/configs/${MACHINE}
39
40# Reset the log before running each test.
41CLEAR_LOG = 1
42
43# As installing kernels usually requires root privilege, default the
44# user on the target as root. It is also required that the target
45# allows ssh to root from the host without asking for a password.
46
47SSH_USER = root
48
49# For accesing the machine, we will ssh to root@machine.
50SSH := ssh ${SSH_USER}@${MACHINE}
51
52# Update this. The default here is ktest will ssh to the target box
53# and run a script called 'run-test' located on that box.
54TEST = ${SSH} run-test
55
56# Point build dir to the git repo you use
57BUILD_DIR = ${THIS_DIR}/linux.git
58
59# Each machine will have its own output build directory.
60OUTPUT_DIR = ${THIS_DIR}/build/${MACHINE}
61
62# Yes this config is focused on x86 (but ktest works for other archs too)
63BUILD_TARGET = arch/x86/boot/bzImage
64TARGET_IMAGE = /boot/vmlinuz-test
65
66# have directory for the scripts to reboot and power cycle the boxes
67SCRIPTS_DIR := ${THIS_DIR}/scripts
68
69# You can have each box/machine have a script to power cycle it.
70# Name your script <box>-cycle.
71POWER_CYCLE = ${SCRIPTS_DIR}/${BOX}-cycle
72
73# This script is used to power off the box.
74POWER_OFF = ${SCRIPTS_DIR}/${BOX}-poweroff
75
76# Keep your test kernels separate from your other kernels.
77LOCALVERSION = -test
78
79# The /boot/grub/menu.lst is searched for the line:
80# title Test Kernel
81# and ktest will use that kernel to reboot into.
82# For grub2 or other boot loaders, you need to set BOOT_TYPE
83# to 'script' and define other ways to load the kernel.
84# See snowball.conf example.
85#
86GRUB_MENU = Test Kernel
87
88# The kernel build will use this option.
89BUILD_OPTIONS = -j8
90
91# Keeping the log file with the output dir is convenient.
92LOG_FILE = ${OUTPUT_DIR}/${MACHINE}.log
93
94# Each box should have their own minum configuration
95# See min-config.conf
96MIN_CONFIG = ${CONFIG_DIR}/config-min
97
98# For things like randconfigs, there may be configs you find that
99# are already broken, or there may be some configs that you always
100# want set. Uncomment ADD_CONFIG and point it to the make config files
101# that set the configs you want to keep on (or off) in your build.
102# ADD_CONFIG is usually something to add configs to all machines,
103# where as, MIN_CONFIG is specific per machine.
104#ADD_CONFIG = ${THIS_DIR}/config-broken ${THIS_DIR}/config-general
105
106# To speed up reboots for bisects and patchcheck, instead of
107# waiting 60 seconds for the console to be idle, if this line is
108# seen in the console output, ktest will know the good kernel has
109# finished rebooting and it will be able to continue the tests.
110REBOOT_SUCCESS_LINE = ${MACHINE} login:
111
112# The following is different ways to end the test.
113# by setting the variable REBOOT to: none, error, fail or
114# something else, ktest will power cycle or reboot the target box
115# at the end of the tests.
116#
117# REBOOT := none
118# Don't do anything at the end of the test.
119#
120# REBOOT := error
121# Reboot the box if ktest detects an error
122#
123# REBOOT := fail
124# Do not stop on failure, and after all tests are complete
125# power off the box (for both success and error)
126# This is good to run over a weekend and you don't want to waste
127# electricity.
128#
129
130DEFAULTS IF ${REBOOT} == none
131REBOOT_ON_SUCCESS = 0
132REBOOT_ON_ERROR = 0
133POWEROFF_ON_ERROR = 0
134POWEROFF_ON_SUCCESS = 0
135
136DEFAULTS ELSE IF ${REBOOT} == error
137REBOOT_ON_SUCCESS = 0
138REBOOT_ON_ERROR = 1
139POWEROFF_ON_ERROR = 0
140POWEROFF_ON_SUCCESS = 0
141
142DEFAULTS ELSE IF ${REBOOT} == fail
143REBOOT_ON_SUCCESS = 0
144POWEROFF_ON_ERROR = 1
145POWEROFF_ON_SUCCESS = 1
146POWEROFF_AFTER_HALT = 120
147DIE_ON_FAILURE = 0
148
149# Store the failure information into this directory
150# such as the .config, dmesg, and build log.
151STORE_FAILURES = ${THIS_DIR}/failures
152
153DEFAULTS ELSE
154REBOOT_ON_SUCCESS = 1
155REBOOT_ON_ERROR = 1
156POWEROFF_ON_ERROR = 0
157POWEROFF_ON_SUCCESS = 0
diff --git a/tools/testing/ktest/examples/include/min-config.conf b/tools/testing/ktest/examples/include/min-config.conf
new file mode 100644
index 000000000000..c703cc46d151
--- /dev/null
+++ b/tools/testing/ktest/examples/include/min-config.conf
@@ -0,0 +1,60 @@
1#
2# This file has some examples for creating a MIN_CONFIG.
3# (A .config file that is the minimum for a machine to boot, or
4# to boot and make a network connection.)
5#
6# A MIN_CONFIG is very useful as it is the minimum configuration
7# needed to boot a given machine. You can debug someone else's
8# .config by only setting the configs in your MIN_CONFIG. The closer
9# your MIN_CONFIG is to the true minimum set of configs needed to
10# boot your machine, the closer the config you test with will be
11# to the users config that had the failure.
12#
13# The make_min_config test allows you to create a MIN_CONFIG that
14# is truly the minimum set of configs needed to boot a box.
15#
16# In this example, the final config will reside in
17# ${CONFIG_DIR}/config-new-min and ${CONFIG_DIR}/config-new-min-net.
18# Just move one to the location you have set for MIN_CONFIG.
19#
20# The first test creates a MIN_CONFIG that will be the minimum
21# configuration to boot ${MACHINE} and be able to ssh to it.
22#
23# The second test creates a MIN_CONFIG that will only boot
24# the target and most likely will not let you ssh to it. (Notice
25# how the second test uses the first test's result to continue with.
26# This is because the second test config is a subset of the first).
27#
28# The ${CONFIG_DIR}/config-skip (and -net) will hold the configs
29# that ktest.pl found would not boot the target without them set.
30# The config-new-min holds configs that ktest.pl could not test
31# directly because another config that was needed to boot the box
32# selected them. Sometimes it is possible that this file will hold
33# the true minimum configuration. You can test to see if this is
34# the case by running the boot test with BOOT_TYPE = allnoconfig and
35# setting setting the MIN_CONFIG to ${CONFIG_DIR}/config-skip. If the
36# machine still boots, then you can use the config-skip as your MIN_CONFIG.
37#
38# These tests can run for several hours (and perhaps days).
39# It's OK to kill the test with a Ctrl^C. By restarting without
40# modifying this config, ktest.pl will notice that the config-new-min(-net)
41# exists, and will use that instead as the starting point.
42# The USE_OUTPUT_MIN_CONFIG is set to 1 to keep ktest.pl from asking
43# you if you want to use the OUTPUT_MIN_CONFIG as the starting point.
44# By using the OUTPUT_MIN_CONFIG as the starting point will allow ktest.pl to
45# start almost where it left off.
46#
47TEST_START IF ${TEST} == min-config
48TEST_TYPE = make_min_config
49OUTPUT_MIN_CONFIG = ${CONFIG_DIR}/config-new-min-net
50IGNORE_CONFIG = ${CONFIG_DIR}/config-skip-net
51MIN_CONFIG_TYPE = test
52TEST = ${SSH} echo hi
53USE_OUTPUT_MIN_CONFIG = 1
54
55TEST_START IF ${TEST} == min-config && ${MULTI}
56TEST_TYPE = make_min_config
57OUTPUT_MIN_CONFIG = ${CONFIG_DIR}/config-new-min
58IGNORE_CONFIG = ${CONFIG_DIR}/config-skip
59MIN_CONFIG = ${CONFIG_DIR}/config-new-min-net
60USE_OUTPUT_MIN_CONFIG = 1
diff --git a/tools/testing/ktest/examples/include/patchcheck.conf b/tools/testing/ktest/examples/include/patchcheck.conf
new file mode 100644
index 000000000000..339d3e1700ff
--- /dev/null
+++ b/tools/testing/ktest/examples/include/patchcheck.conf
@@ -0,0 +1,74 @@
1# patchcheck.conf
2#
3# This contains a test that takes two git commits and will test each
4# commit between the two. The build test will look at what files the
5# commit has touched, and if any of those files produce a warning, then
6# the build will fail.
7
8
9# PATCH_START is the commit to begin with and PATCH_END is the commit
10# to end with (inclusive). This is similar to doing a git rebase -i PATCH_START~1
11# and then testing each commit and doing a git rebase --continue.
12# You can use a SHA1, a git tag, or anything that git will accept for a checkout
13
14PATCH_START := HEAD~3
15PATCH_END := HEAD
16
17# Change PATCH_CHECKOUT to be the branch you want to test. The test will
18# do a git checkout of this branch before starting. Obviously both
19# PATCH_START and PATCH_END must be in this branch (and PATCH_START must
20# be contained by PATCH_END).
21
22PATCH_CHECKOUT := test/branch
23
24# Usually it's a good idea to have a set config to use for testing individual
25# patches.
26PATCH_CONFIG := ${CONFIG_DIR}/config-patchcheck
27
28# Change PATCH_TEST to run some test for each patch. Each commit that is
29# tested, after it is built and installed on the test machine, this command
30# will be executed. Usually what is done is to ssh to the target box and
31# run some test scripts. If you just want to boot test your patches
32# comment PATCH_TEST out.
33PATCH_TEST := ${SSH} "/usr/local/bin/ktest-test-script"
34
35DEFAULTS IF DEFINED PATCH_TEST
36PATCH_TEST_TYPE := test
37
38DEFAULTS ELSE
39PATCH_TEST_TYPE := boot
40
41# If for some reason a file has a warning that one of your patches touch
42# but you do not care about it, set IGNORE_WARNINGS to that commit(s)
43# (space delimited)
44#IGNORE_WARNINGS = 39eaf7ef884dcc44f7ff1bac803ca2a1dcf43544 6edb2a8a385f0cdef51dae37ff23e74d76d8a6ce
45
46# If you are running a multi test, and the test failed on the first
47# test but on, say the 5th patch. If you want to restart on the
48# fifth patch, set PATCH_START1. This will make the first test start
49# from this commit instead of the PATCH_START commit.
50# Note, do not change this option. Just define PATCH_START1 in the
51# top config (the one you pass to ktest.pl), and this will use it,
52# otherwise it will just use PATCH_START if PATCH_START1 is not defined.
53DEFAULTS IF NOT DEFINED PATCH_START1
54PATCH_START1 := ${PATCH_START}
55
56TEST_START IF ${TEST} == patchcheck
57TEST_TYPE = patchcheck
58MIN_CONFIG = ${PATCH_CONFIG}
59TEST = ${PATCH_TEST}
60PATCHCHECK_TYPE = ${PATCH_TEST_TYPE}
61PATCHCHECK_START = ${PATCH_START1}
62PATCHCHECK_END = ${PATCH_END}
63CHECKOUT = ${PATCH_CHECKOUT}
64
65TEST_START IF ${TEST} == patchcheck && ${MULTI}
66TEST_TYPE = patchcheck
67MIN_CONFIG = ${PATCH_CONFIG}
68TEST = ${PATCH_TEST}
69PATCHCHECK_TYPE = ${PATCH_TEST_TYPE}
70PATCHCHECK_START = ${PATCH_START}
71PATCHCHECK_END = ${PATCH_END}
72CHECKOUT = ${PATCH_CHECKOUT}
73# Use multi to test different compilers?
74MAKE_CMD = CC=gcc-4.5.1 make
diff --git a/tools/testing/ktest/examples/include/tests.conf b/tools/testing/ktest/examples/include/tests.conf
new file mode 100644
index 000000000000..4fdb811bd810
--- /dev/null
+++ b/tools/testing/ktest/examples/include/tests.conf
@@ -0,0 +1,74 @@
1#
2# This is an example of various tests that you can run
3#
4# The variable TEST can be of boot, build, randconfig, or test.
5#
6# Note that TEST is a variable created with ':=' and only exists
7# throughout the config processing (not during the tests itself).
8#
9# The TEST option (defined with '=') is used to tell ktest.pl
10# what test to run after a successful boot. The TEST option is
11# persistent into the test runs.
12#
13
14# The config that includes this file may define a BOOT_TYPE
15# variable that tells this config what type of boot test to run.
16# If it's not defined, the below DEFAULTS will set the default
17# to 'oldconfig'.
18#
19DEFAULTS IF NOT DEFINED BOOT_TYPE
20BOOT_TYPE := oldconfig
21
22# The config that includes this file may define a RUN_TEST
23# variable that will tell this config what test to run.
24# (what to set the TEST option to).
25#
26DEFAULTS IF NOT DEFINED RUN_TEST
27# Requires that hackbench is in the PATH
28RUN_TEST := ${SSH} hackbench 50
29
30
31# If TEST is set to 'boot' then just build a kernel and boot
32# the target.
33TEST_START IF ${TEST} == boot
34TEST_TYPE = boot
35# Notice how we set the BUILD_TYPE option to the BOOT_TYPE variable.
36BUILD_TYPE = ${BOOT_TYPE}
37# Do not do a make mrproper.
38BUILD_NOCLEAN = 1
39
40# If you only want to build the kernel, and perhaps install
41# and test it yourself, then just set TEST to build.
42TEST_START IF ${TEST} == build
43TEST_TYPE = build
44BUILD_TYPE = ${BOOT_TYPE}
45BUILD_NOCLEAN = 1
46
47# Build, install, boot and test with a randconfg 10 times.
48# It is important that you have set MIN_CONFIG in the config
49# that includes this file otherwise it is likely that the
50# randconfig will not have the neccessary configs needed to
51# boot your box. This version of the test requires a min
52# config that has enough to make sure the target has network
53# working.
54TEST_START ITERATE 10 IF ${TEST} == randconfig
55MIN_CONFIG = ${CONFIG_DIR}/config-min-net
56TEST_TYPE = test
57BUILD_TYPE = randconfig
58TEST = ${RUN_TEST}
59
60# This is the same as above, but only tests to a boot prompt.
61# The MIN_CONFIG used here does not need to have networking
62# working.
63TEST_START ITERATE 10 IF ${TEST} == randconfig && ${MULTI}
64TEST_TYPE = boot
65BUILD_TYPE = randconfig
66MIN_CONFIG = ${CONFIG_DIR}/config-min
67MAKE_CMD = make
68
69# This builds, installs, boots and tests the target.
70TEST_START IF ${TEST} == test
71TEST_TYPE = test
72BUILD_TYPE = ${BOOT_TYPE}
73TEST = ${RUN_TEST}
74BUILD_NOCLEAN = 1
diff --git a/tools/testing/ktest/examples/kvm.conf b/tools/testing/ktest/examples/kvm.conf
new file mode 100644
index 000000000000..831c7c5395f1
--- /dev/null
+++ b/tools/testing/ktest/examples/kvm.conf
@@ -0,0 +1,88 @@
1#
2# This config is an example usage of ktest.pl with a kvm guest
3#
4# The guest is called 'Guest' and this would be something that
5# could be run on the host to test a virtual machine target.
6
7MACHINE = Guest
8
9
10# Use virsh to read the serial console of the guest
11CONSOLE = virsh console ${MACHINE}
12
13#*************************************#
14# This part is the same as test.conf #
15#*************************************#
16
17# The include files will set up the type of test to run. Just set TEST to
18# which test you want to run.
19#
20# TESTS = patchcheck, randconfig, boot, test, config-bisect, bisect, min-config
21#
22# See the include/*.conf files that define these tests
23#
24TEST := patchcheck
25
26# Some tests may have more than one test to run. Define MULTI := 1 to run
27# the extra tests.
28MULTI := 0
29
30# In case you want to differentiate which type of system you are testing
31BITS := 64
32
33# REBOOT = none, error, fail, empty
34# See include/defaults.conf
35REBOOT := empty
36
37
38# The defaults file will set up various settings that can be used by all
39# machine configs.
40INCLUDE include/defaults.conf
41
42
43#*************************************#
44# Now we are different from test.conf #
45#*************************************#
46
47
48# The example here assumes that Guest is running a Fedora release
49# that uses dracut for its initfs. The POST_INSTALL will be executed
50# after the install of the kernel and modules are complete.
51#
52POST_INSTALL = ${SSH} /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION
53
54# Guests sometimes get stuck on reboot. We wait 3 seconds after running
55# the reboot command and then do a full power-cycle of the guest.
56# This forces the guest to restart.
57#
58POWERCYCLE_AFTER_REBOOT = 3
59
60# We do the same after the halt command, but this time we wait 20 seconds.
61POWEROFF_AFTER_HALT = 20
62
63
64# As the defaults.conf file has a POWER_CYCLE option already defined,
65# and options can not be defined in the same section more than once
66# (all DEFAULTS sections are considered the same). We use the
67# DEFAULTS OVERRIDE to tell ktest.pl to ignore the previous defined
68# options, for the options set in the OVERRIDE section.
69#
70DEFAULTS OVERRIDE
71
72# Instead of using the default POWER_CYCLE option defined in
73# defaults.conf, we use virsh to cycle it. To do so, we destroy
74# the guest, wait 5 seconds, and then start it up again.
75# Crude, but effective.
76#
77POWER_CYCLE = virsh destroy ${MACHINE}; sleep 5; virsh start ${MACHINE}
78
79
80DEFAULTS
81
82# The following files each handle a different test case.
83# Having them included allows you to set up more than one machine and share
84# the same tests.
85INCLUDE include/patchcheck.conf
86INCLUDE include/tests.conf
87INCLUDE include/bisect.conf
88INCLUDE include/min-config.conf
diff --git a/tools/testing/ktest/examples/snowball.conf b/tools/testing/ktest/examples/snowball.conf
new file mode 100644
index 000000000000..a82a3c5bc2b7
--- /dev/null
+++ b/tools/testing/ktest/examples/snowball.conf
@@ -0,0 +1,53 @@
1# This example was used to boot the snowball ARM board.
2# See http://people.redhat.com/srostedt/ktest-embedded-2012/
3
4# PWD is a ktest.pl variable that will result in the process working
5# directory that ktest.pl is executed in.
6
7# THIS_DIR is automatically assigned the PWD of the path that generated
8# the config file. It is best to use this variable when assigning other
9# directory paths within this directory. This allows you to easily
10# move the test cases to other locations or to other machines.
11#
12THIS_DIR := /home/rostedt/work/demo/ktest-embed
13LOG_FILE = ${OUTPUT_DIR}/snowball.log
14CLEAR_LOG = 1
15MAKE_CMD = PATH=/usr/local/gcc-4.5.2-nolibc/arm-unknown-linux-gnueabi/bin:$PATH CROSS_COMPILE=arm-unknown-linux-gnueabi- make ARCH=arm
16ADD_CONFIG = ${THIS_DIR}/addconfig
17
18SCP_TO_TARGET = echo "don't do scp"
19
20TFTPBOOT := /var/lib/tftpboot
21TFTPDEF := ${TFTPBOOT}/snowball-default
22TFTPTEST := ${OUTPUT_DIR}/${BUILD_TARGET}
23
24SWITCH_TO_GOOD = cp ${TFTPDEF} ${TARGET_IMAGE}
25SWITCH_TO_TEST = cp ${TFTPTEST} ${TARGET_IMAGE}
26
27# Define each test with TEST_START
28# The config options below it will override the defaults
29TEST_START SKIP
30TEST_TYPE = boot
31BUILD_TYPE = u8500_defconfig
32BUILD_NOCLEAN = 1
33
34TEST_START
35TEST_TYPE = make_min_config
36OUTPUT_MIN_CONFIG = ${THIS_DIR}/config.newmin
37START_MIN_CONFIG = ${THIS_DIR}/config.orig
38IGNORE_CONFIG = ${THIS_DIR}/config.ignore
39BUILD_NOCLEAN = 1
40
41
42DEFAULTS
43LOCALVERSION = -test
44POWER_CYCLE = echo use the thumb luke; read a
45CONSOLE = cat ${THIS_DIR}/snowball-cat
46REBOOT_TYPE = script
47SSH_USER = root
48BUILD_OPTIONS = -j8 uImage
49BUILD_DIR = ${THIS_DIR}/linux.git
50OUTPUT_DIR = ${THIS_DIR}/snowball-build
51MACHINE = snowball
52TARGET_IMAGE = /var/lib/tftpboot/snowball-image
53BUILD_TARGET = arch/arm/boot/uImage
diff --git a/tools/testing/ktest/examples/test.conf b/tools/testing/ktest/examples/test.conf
new file mode 100644
index 000000000000..b725210efb7f
--- /dev/null
+++ b/tools/testing/ktest/examples/test.conf
@@ -0,0 +1,62 @@
1#
2# Generic config for a machine
3#
4
5# Name your machine (the DNS name, what you ssh to)
6MACHINE = foo
7
8# BOX can be different than foo, if the machine BOX has
9# multiple partitions with different systems installed. For example,
10# you may have a i386 and x86_64 installation on a test box.
11# If this is the case, MACHINE defines the way to connect to the
12# machine, which may be different between which system the machine
13# is booting into. BOX is used for the scripts to reboot and power cycle
14# the machine, where it does not matter which system the machine boots into.
15#
16#BOX := bar
17
18# Define a way to read the console
19CONSOLE = stty -F /dev/ttyS0 115200 parodd; cat /dev/ttyS0
20
21# The include files will set up the type of test to run. Just set TEST to
22# which test you want to run.
23#
24# TESTS = patchcheck, randconfig, boot, test, config-bisect, bisect, min-config
25#
26# See the include/*.conf files that define these tests
27#
28TEST := patchcheck
29
30# Some tests may have more than one test to run. Define MULTI := 1 to run
31# the extra tests.
32MULTI := 0
33
34# In case you want to differentiate which type of system you are testing
35BITS := 64
36
37# REBOOT = none, error, fail, empty
38# See include/defaults.conf
39REBOOT := empty
40
41# The defaults file will set up various settings that can be used by all
42# machine configs.
43INCLUDE include/defaults.conf
44
45# In case you need to add a patch for a bisect or something
46#PRE_BUILD = patch -p1 < ${THIS_DIR}/fix.patch
47
48# Reset the repo after the build and remove all 'test' modules from the target
49# Notice that DO_POST_BUILD is a variable (defined by ':=') and POST_BUILD
50# is the option (defined by '=')
51
52DO_POST_BUILD := git reset --hard
53POST_BUILD = ${SSH} 'rm -rf /lib/modules/*-test*'; ${DO_POST_BUILD}
54
55# The following files each handle a different test case.
56# Having them included allows you to set up more than one machine and share
57# the same tests.
58INCLUDE include/patchcheck.conf
59INCLUDE include/tests.conf
60INCLUDE include/bisect.conf
61INCLUDE include/min-config.conf
62
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 4915408f6a98..292b13ad03f5 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -39,6 +39,7 @@ my %default = (
39 "CLEAR_LOG" => 0, 39 "CLEAR_LOG" => 0,
40 "BISECT_MANUAL" => 0, 40 "BISECT_MANUAL" => 0,
41 "BISECT_SKIP" => 1, 41 "BISECT_SKIP" => 1,
42 "MIN_CONFIG_TYPE" => "boot",
42 "SUCCESS_LINE" => "login:", 43 "SUCCESS_LINE" => "login:",
43 "DETECT_TRIPLE_FAULT" => 1, 44 "DETECT_TRIPLE_FAULT" => 1,
44 "NO_INSTALL" => 0, 45 "NO_INSTALL" => 0,
@@ -66,6 +67,7 @@ my %default = (
66 67
67my $ktest_config; 68my $ktest_config;
68my $version; 69my $version;
70my $have_version = 0;
69my $machine; 71my $machine;
70my $ssh_user; 72my $ssh_user;
71my $tmpdir; 73my $tmpdir;
@@ -106,6 +108,8 @@ my $minconfig;
106my $start_minconfig; 108my $start_minconfig;
107my $start_minconfig_defined; 109my $start_minconfig_defined;
108my $output_minconfig; 110my $output_minconfig;
111my $minconfig_type;
112my $use_output_minconfig;
109my $ignore_config; 113my $ignore_config;
110my $ignore_errors; 114my $ignore_errors;
111my $addconfig; 115my $addconfig;
@@ -205,6 +209,8 @@ my %option_map = (
205 "MIN_CONFIG" => \$minconfig, 209 "MIN_CONFIG" => \$minconfig,
206 "OUTPUT_MIN_CONFIG" => \$output_minconfig, 210 "OUTPUT_MIN_CONFIG" => \$output_minconfig,
207 "START_MIN_CONFIG" => \$start_minconfig, 211 "START_MIN_CONFIG" => \$start_minconfig,
212 "MIN_CONFIG_TYPE" => \$minconfig_type,
213 "USE_OUTPUT_MIN_CONFIG" => \$use_output_minconfig,
208 "IGNORE_CONFIG" => \$ignore_config, 214 "IGNORE_CONFIG" => \$ignore_config,
209 "TEST" => \$run_test, 215 "TEST" => \$run_test,
210 "ADD_CONFIG" => \$addconfig, 216 "ADD_CONFIG" => \$addconfig,
@@ -1702,10 +1708,12 @@ sub install {
1702 1708
1703sub get_version { 1709sub get_version {
1704 # get the release name 1710 # get the release name
1711 return if ($have_version);
1705 doprint "$make kernelrelease ... "; 1712 doprint "$make kernelrelease ... ";
1706 $version = `$make kernelrelease | tail -1`; 1713 $version = `$make kernelrelease | tail -1`;
1707 chomp($version); 1714 chomp($version);
1708 doprint "$version\n"; 1715 doprint "$version\n";
1716 $have_version = 1;
1709} 1717}
1710 1718
1711sub start_monitor_and_boot { 1719sub start_monitor_and_boot {
@@ -1828,6 +1836,9 @@ sub build {
1828 my $save_no_reboot = $no_reboot; 1836 my $save_no_reboot = $no_reboot;
1829 $no_reboot = 1; 1837 $no_reboot = 1;
1830 1838
1839 # Calculate a new version from here.
1840 $have_version = 0;
1841
1831 if (defined($pre_build)) { 1842 if (defined($pre_build)) {
1832 my $ret = run_command $pre_build; 1843 my $ret = run_command $pre_build;
1833 if (!$ret && defined($pre_build_die) && 1844 if (!$ret && defined($pre_build_die) &&
@@ -1887,6 +1898,9 @@ sub build {
1887 undef $redirect; 1898 undef $redirect;
1888 1899
1889 if (defined($post_build)) { 1900 if (defined($post_build)) {
1901 # Because a post build may change the kernel version
1902 # do it now.
1903 get_version;
1890 my $ret = run_command $post_build; 1904 my $ret = run_command $post_build;
1891 if (!$ret && defined($post_build_die) && 1905 if (!$ret && defined($post_build_die) &&
1892 $post_build_die) { 1906 $post_build_die) {
@@ -3119,6 +3133,12 @@ sub test_this_config {
3119sub make_min_config { 3133sub make_min_config {
3120 my ($i) = @_; 3134 my ($i) = @_;
3121 3135
3136 my $type = $minconfig_type;
3137 if ($type ne "boot" && $type ne "test") {
3138 fail "Invalid MIN_CONFIG_TYPE '$minconfig_type'\n" .
3139 " make_min_config works only with 'boot' and 'test'\n" and return;
3140 }
3141
3122 if (!defined($output_minconfig)) { 3142 if (!defined($output_minconfig)) {
3123 fail "OUTPUT_MIN_CONFIG not defined" and return; 3143 fail "OUTPUT_MIN_CONFIG not defined" and return;
3124 } 3144 }
@@ -3128,8 +3148,15 @@ sub make_min_config {
3128 # that instead. 3148 # that instead.
3129 if (-f $output_minconfig && !$start_minconfig_defined) { 3149 if (-f $output_minconfig && !$start_minconfig_defined) {
3130 print "$output_minconfig exists\n"; 3150 print "$output_minconfig exists\n";
3131 if (read_yn " Use it as minconfig?") { 3151 if (!defined($use_output_minconfig)) {
3152 if (read_yn " Use it as minconfig?") {
3153 $start_minconfig = $output_minconfig;
3154 }
3155 } elsif ($use_output_minconfig > 0) {
3156 doprint "Using $output_minconfig as MIN_CONFIG\n";
3132 $start_minconfig = $output_minconfig; 3157 $start_minconfig = $output_minconfig;
3158 } else {
3159 doprint "Set to still use MIN_CONFIG as starting point\n";
3133 } 3160 }
3134 } 3161 }
3135 3162
@@ -3278,6 +3305,11 @@ sub make_min_config {
3278 build "oldconfig" or $failed = 1; 3305 build "oldconfig" or $failed = 1;
3279 if (!$failed) { 3306 if (!$failed) {
3280 start_monitor_and_boot or $failed = 1; 3307 start_monitor_and_boot or $failed = 1;
3308
3309 if ($type eq "test" && !$failed) {
3310 do_run_test or $failed = 1;
3311 }
3312
3281 end_monitor; 3313 end_monitor;
3282 } 3314 }
3283 3315
@@ -3474,6 +3506,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
3474 $no_reboot = 1; 3506 $no_reboot = 1;
3475 $reboot_success = 0; 3507 $reboot_success = 0;
3476 3508
3509 $have_version = 0;
3510
3477 $iteration = $i; 3511 $iteration = $i;
3478 3512
3479 my $makecmd = set_test_option("MAKE_CMD", $i); 3513 my $makecmd = set_test_option("MAKE_CMD", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index b682456afda8..cf362b3d1ec9 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -158,7 +158,7 @@
158# 158#
159# TEST_START IF (DEFINED ALL_TESTS || ${MYTEST} == boottest) && ${MACHINE} == gandalf 159# TEST_START IF (DEFINED ALL_TESTS || ${MYTEST} == boottest) && ${MACHINE} == gandalf
160# 160#
161# Notice the use of paranthesis. Without any paranthesis the above would be 161# Notice the use of parentheses. Without any parentheses the above would be
162# processed the same as: 162# processed the same as:
163# 163#
164# TEST_START IF DEFINED ALL_TESTS || (${MYTEST} == boottest && ${MACHINE} == gandalf) 164# TEST_START IF DEFINED ALL_TESTS || (${MYTEST} == boottest && ${MACHINE} == gandalf)
@@ -1105,10 +1105,26 @@
1105# and will not be tested again in later runs. 1105# and will not be tested again in later runs.
1106# (optional) 1106# (optional)
1107# 1107#
1108# MIN_CONFIG_TYPE can be either 'boot' or 'test'. With 'boot' it will
1109# test if the created config can just boot the machine. If this is
1110# set to 'test', then the TEST option must be defined and the created
1111# config will not only boot the target, but also make sure that the
1112# config lets the test succeed. This is useful to make sure the final
1113# config that is generated allows network activity (ssh).
1114# (optional)
1115#
1116# USE_OUTPUT_MIN_CONFIG set this to 1 if you do not want to be prompted
1117# about using the OUTPUT_MIN_CONFIG as the MIN_CONFIG as the starting
1118# point. Set it to 0 if you want to always just use the given MIN_CONFIG.
1119# If it is not defined, it will prompt you to pick which config
1120# to start with (MIN_CONFIG or OUTPUT_MIN_CONFIG).
1121#
1108# Example: 1122# Example:
1109# 1123#
1110# TEST_TYPE = make_min_config 1124# TEST_TYPE = make_min_config
1111# OUTPUT_MIN_CONFIG = /path/to/config-new-min 1125# OUTPUT_MIN_CONFIG = /path/to/config-new-min
1112# START_MIN_CONFIG = /path/to/config-min 1126# START_MIN_CONFIG = /path/to/config-min
1113# IGNORE_CONFIG = /path/to/config-tested 1127# IGNORE_CONFIG = /path/to/config-tested
1128# MIN_CONFIG_TYPE = test
1129# TEST = ssh ${USER}@${MACHINE} echo hi
1114# 1130#
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
index 4b107b5e623f..8674b9ec14f6 100644
--- a/tools/usb/ffs-test.c
+++ b/tools/usb/ffs-test.c
@@ -297,7 +297,7 @@ static void *start_thread_helper(void *arg)
297 297
298 ret = t->in(t, t->buf, t->buf_size); 298 ret = t->in(t, t->buf, t->buf_size);
299 if (ret > 0) { 299 if (ret > 0) {
300 ret = t->out(t, t->buf, t->buf_size); 300 ret = t->out(t, t->buf, ret);
301 name = out_name; 301 name = out_name;
302 op = "write"; 302 op = "write";
303 } else { 303 } else {
diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c
index 6e0f56701e44..82d7c590c026 100644
--- a/tools/usb/testusb.c
+++ b/tools/usb/testusb.c
@@ -358,6 +358,7 @@ static const char *usbfs_dir_find(void)
358{ 358{
359 static char usbfs_path_0[] = "/dev/usb/devices"; 359 static char usbfs_path_0[] = "/dev/usb/devices";
360 static char usbfs_path_1[] = "/proc/bus/usb/devices"; 360 static char usbfs_path_1[] = "/proc/bus/usb/devices";
361 static char udev_usb_path[] = "/dev/bus/usb";
361 362
362 static char *const usbfs_paths[] = { 363 static char *const usbfs_paths[] = {
363 usbfs_path_0, usbfs_path_1 364 usbfs_path_0, usbfs_path_1
@@ -376,6 +377,10 @@ static const char *usbfs_dir_find(void)
376 } 377 }
377 } while (++it != end); 378 } while (++it != end);
378 379
380 /* real device-nodes managed by udev */
381 if (access(udev_usb_path, F_OK) == 0)
382 return udev_usb_path;
383
379 return NULL; 384 return NULL;
380} 385}
381 386
diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h
index 7579f19e61e0..81847dd08bd0 100644
--- a/tools/virtio/linux/virtio.h
+++ b/tools/virtio/linux/virtio.h
@@ -203,6 +203,7 @@ void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
203void virtqueue_disable_cb(struct virtqueue *vq); 203void virtqueue_disable_cb(struct virtqueue *vq);
204 204
205bool virtqueue_enable_cb(struct virtqueue *vq); 205bool virtqueue_enable_cb(struct virtqueue *vq);
206bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
206 207
207void *virtqueue_detach_unused_buf(struct virtqueue *vq); 208void *virtqueue_detach_unused_buf(struct virtqueue *vq);
208struct virtqueue *vring_new_virtqueue(unsigned int num, 209struct virtqueue *vring_new_virtqueue(unsigned int num,
diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c
index 6bf95f995364..e626fa553c5a 100644
--- a/tools/virtio/virtio_test.c
+++ b/tools/virtio/virtio_test.c
@@ -144,7 +144,8 @@ static void wait_for_interrupt(struct vdev_info *dev)
144 } 144 }
145} 145}
146 146
147static void run_test(struct vdev_info *dev, struct vq_info *vq, int bufs) 147static void run_test(struct vdev_info *dev, struct vq_info *vq,
148 bool delayed, int bufs)
148{ 149{
149 struct scatterlist sl; 150 struct scatterlist sl;
150 long started = 0, completed = 0; 151 long started = 0, completed = 0;
@@ -183,8 +184,12 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq, int bufs)
183 assert(started <= bufs); 184 assert(started <= bufs);
184 if (completed == bufs) 185 if (completed == bufs)
185 break; 186 break;
186 if (virtqueue_enable_cb(vq->vq)) { 187 if (delayed) {
187 wait_for_interrupt(dev); 188 if (virtqueue_enable_cb_delayed(vq->vq))
189 wait_for_interrupt(dev);
190 } else {
191 if (virtqueue_enable_cb(vq->vq))
192 wait_for_interrupt(dev);
188 } 193 }
189 } 194 }
190 test = 0; 195 test = 0;
@@ -216,6 +221,14 @@ const struct option longopts[] = {
216 .val = 'i', 221 .val = 'i',
217 }, 222 },
218 { 223 {
224 .name = "delayed-interrupt",
225 .val = 'D',
226 },
227 {
228 .name = "no-delayed-interrupt",
229 .val = 'd',
230 },
231 {
219 } 232 }
220}; 233};
221 234
@@ -224,6 +237,7 @@ static void help()
224 fprintf(stderr, "Usage: virtio_test [--help]" 237 fprintf(stderr, "Usage: virtio_test [--help]"
225 " [--no-indirect]" 238 " [--no-indirect]"
226 " [--no-event-idx]" 239 " [--no-event-idx]"
240 " [--delayed-interrupt]"
227 "\n"); 241 "\n");
228} 242}
229 243
@@ -233,6 +247,7 @@ int main(int argc, char **argv)
233 unsigned long long features = (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | 247 unsigned long long features = (1ULL << VIRTIO_RING_F_INDIRECT_DESC) |
234 (1ULL << VIRTIO_RING_F_EVENT_IDX); 248 (1ULL << VIRTIO_RING_F_EVENT_IDX);
235 int o; 249 int o;
250 bool delayed = false;
236 251
237 for (;;) { 252 for (;;) {
238 o = getopt_long(argc, argv, optstring, longopts, NULL); 253 o = getopt_long(argc, argv, optstring, longopts, NULL);
@@ -251,6 +266,9 @@ int main(int argc, char **argv)
251 case 'i': 266 case 'i':
252 features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC); 267 features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC);
253 break; 268 break;
269 case 'D':
270 delayed = true;
271 break;
254 default: 272 default:
255 assert(0); 273 assert(0);
256 break; 274 break;
@@ -260,6 +278,6 @@ int main(int argc, char **argv)
260done: 278done:
261 vdev_info_init(&dev, features); 279 vdev_info_init(&dev, features);
262 vq_info_add(&dev, 256); 280 vq_info_add(&dev, 256);
263 run_test(&dev, &dev.vqs[0], 0x100000); 281 run_test(&dev, &dev.vqs[0], delayed, 0x100000);
264 return 0; 282 return 0;
265} 283}