@@ -149,3 +149,72 @@ $ make rebuild-image@ppc64le@ubuntu
149149
150150Note that the build mounts the source tree read-only, so nothing it does can
151151affect your source tree.
152+
153+ Bisecting the kernel vs a selftest
154+ ----------------------------------
155+
156+ Build the selftests using a version of the test that's known good. Usually
157+ there's no reason to rebuild the tests on every kernel revision.
158+
159+ These examples are run from the kernel directory, not the ci-scripts directory.
160+ It can be done either way, but it's more natural to run from the kernel
161+ directory when bisectting the kernel. This assumes Linux is in ` ~/linux ` and
162+ these scripts are in ` ~/ci-scripts ` , adapt as appropriate.
163+
164+ ```
165+ $ cd ~/linux
166+ ```
167+
168+ ```
169+ $ make SRC=$PWD -C ~/ci-scripts/build QUIET=1 JFACTOR=$(nproc) ppctests@ppc64le@ubuntu@16.04 INSTALL=1
170+ ```
171+
172+ :rotating_light : Using an old Ubuntu image uses an older libc, which is more
173+ likely to be present on the guest root filesystem. Another option is to build
174+ the selftests statically.
175+
176+ Tar up the selftests into the current directory, the qemu scripts will detect them:
177+
178+ ```
179+ $ tar -czf selftests.tar.gz -C $HOME/ci-scripts/build/output/selftests_powerpc@ppc64le@ubuntu@16.04/ install
180+ ```
181+
182+ ```
183+ $ ~/ci-scripts/scripts/boot/qemu-pseries+kvm --callback "run_selftests(powerpc/mm:wild_bctr)"
184+ ...
185+ INFO: Running 'qemu-system-ppc64 -nographic -vga none -M pseries -smp 8 -m 4G -accel kvm ...
186+ ...
187+ / # INFO: Running individual selftests powerpc/mm:wild_bctr
188+ /var/tmp/selftests/run_kselftest.sh -t powerpc/mm:wild_bctr
189+ [ 2.783761][ T201] kselftest: Running tests in powerpc
190+ TAP version 13
191+ 1..1
192+ # timeout set to 300
193+ # selftests: powerpc/mm: wild_bctr
194+ # test: wild_bctr
195+ # tags: git_version:v6.8-rc6-2555-gfe559db
196+ # Everything is OK in here.
197+ ...
198+ # success: wild_bctr
199+ ok 1 selftests: powerpc/mm: wild_bctr
200+ / # poweroff
201+ / # Stopping network: [ 3.104385][ T274] ip (274) used greatest stack depth: 10912 bytes left
202+ OK
203+ Saving random seed: OK
204+ Stopping klogd: OK
205+ Stopping syslogd: OK
206+ umount: devtmpfs busy - remounted read-only
207+ umount: can't unmount /: Invalid argument
208+ The system is going down NOW!
209+ Sent SIGTERM to all processes
210+ Sent SIGKILL to all processes
211+ Requesting system poweroff
212+ [ 5.152672][ T293] reboot: Power down
213+ INFO: Test completed OK
214+ ```
215+
216+ More than one selftest can be run by passing multiple arguments to
217+ ` run_selftests ` or by passing multiple ` --callback ` options.
218+
219+ From there the bisection can either be run by hand, or fully automated by
220+ creating a script to build the kernel and run the qemu test.
0 commit comments