Topic: Test compiling every commit in a patch set using git-test-sequence
I have found git-test-sequence (blog: git test-sequence: Push Working Changes) which makes test compiling all the commits in a patch set easy. It's only a small changed to the work flow we currently recommend to developers to check their patch set before submission.
cd /tmp
git clone git://git.gnome.org/gparted gparted-test
cd gparted-test
cp -p git-test-sequence testbuild.sh ~/bin
git am ~/mypatch.mbox
git-test-sequence origin/master.. testbuild.sh
Here's a worked example showing several test builds:
$ cd /tmp
$ git clone git://git.gnome.org/gparted gparted-test
Cloning into gparted-test...
remote: Counting objects: 12699, done.
remote: Compressing objects: 100% (6123/6123), done.
remote: Total 12699 (delta 10191), reused 7819 (delta 6525)
Receiving objects: 100% (12699/12699), 5.10 MiB | 390 KiB/s, done.
Resolving deltas: 100% (10191/10191), done.
$ cd gparted-test
Use a couple of my in progress patches for testing.
$ git am ~/mypatches.mbox
Applying: Allow ntfsresize command to report real-time %age progress (#697662)
Applying: Correctly report usage of absolutely full NTFS (#697946)
Here's the top few commits so you can see them and where the git tags point, especially "origin/master" (master tag in the upstream repository at gnome.org).
$ git log --decorate --pretty=oneline -3
a6ebcbc34ec14b4cf5235e944df9cbdbae575173 (HEAD, master) Correctly report usage of absolutely full NTFS (#697946)
0d6f7343e8f78c527ddced1972c9b50510a90062 Allow ntfsresize command to report real-time %age progress (#697662)
76a9cd3c931adc92b49a9effc61ddbfeccb9dd07 (origin/master, origin/HEAD) Updated Spanish translation
Run testbuild.sh over a range of git commits specified using standard commit ranges syntax (about 2/3 down the page).
$ git-test-sequence origin/master.. testbuild.sh
Testing testbuild.sh -j 8
HEAD is now at 0d6f734 Allow ntfsresize command to report real-time %age progress (#697662)
Passed: 40912c57d5330bd3a68b80b855e5a55178b96ca1.
Testing testbuild.sh -j 8
HEAD is now at a6ebcbc Correctly report usage of absolutely full NTFS (#697946)
Passed: ab1090f871ccb74d1679af4c14ea1d9aeec10672.
All's well.
$ echo $?
0
Re-run the tests again. Results are returned immediately, having been cached in the local git object store.
$ git-test-sequence origin/master.. testbuild.sh
Already pass 40912c57d5330bd3a68b80b855e5a55178b96ca1
Already pass ab1090f871ccb74d1679af4c14ea1d9aeec10672
All's well.
$ echo $?
0
Test build GParted over a different range of commits to show a failure case. Stops at the first commit which fails to build.
$ rm testbuild.log
$ git-test-sequence GPARTED_0_14_1..GPARTED_0_15_0 testbuild.sh
Testing testbuild.sh
HEAD is now at c9e6dca Append -git to version for continuing development
Passed: 261d9602fc3b47bb4495c2b290e67c01868e21f4.
...
Testing testbuild.sh
HEAD is now at 34da790 Fix move partition right to left shrinks partition 1 MiB (#695078)
Passed: 528b0ddeec2ee50b89a247f6d625524c9e648ed1.
Testing testbuild.sh
HEAD is now at 08924d3 Updated slovak translation
Passed: 92883b27e2d1a3e13160db573c728b69853a4140.
Testing testbuild.sh
HEAD is now at f5a5c9c Remove gdk_threads_enter/exit (#685740)
Broke on f5a5c9cdb9d24c930871060bceade9cfe0e69053
You have new mail in /var/spool/mail/mike
$ echo $?
1
Look in the testbuild.log for the build results.
$ tail -18 testbuild.log
g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -pthread -I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include -I/usr/include/atkmm-1.6 -I/usr/include/giomm-2.4 -I/usr/lib/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib/pangomm-1.4/include -I/usr/include/gtk-2.0 -I/usr/include/gtk-unix-print-2.0 -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include -I/usr/include/atk-1.0 -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/cairomm-1.0 -I/usr/lib/cairomm-1.0/include -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/lib/gtk-2.0/include -I/usr/include/gdk-pixbuf-2.0 -DGPARTED_DATADIR=\""/usr/local/share"\" -DGNOMELOCALEDIR=\""/usr/local/share/locale"\" -Wall -g -O2 -MT GParted_Core.o -MD -MP -MF .deps/GParted_Core.Tpo -c -o GParted_Core.o GParted_Core.cc
GParted_Core.cc:3551:2: error: ‘Threads’ in namespace ‘Glib’ does not name a type
GParted_Core.cc:3552:2: error: ‘Threads’ in namespace ‘Glib’ does not name a type
GParted_Core.cc: In function ‘bool GParted::_ped_exception_handler(GParted::ped_exception_ctx*)’:
GParted_Core.cc:3571:8: error: ‘struct GParted::ped_exception_ctx’ has no member named ‘cond’
GParted_Core.cc:3579:7: error: ‘struct GParted::ped_exception_ctx’ has no member named ‘mutex’
GParted_Core.cc:3580:7: error: ‘struct GParted::ped_exception_ctx’ has no member named ‘cond’
GParted_Core.cc:3581:7: error: ‘struct GParted::ped_exception_ctx’ has no member named ‘mutex’
GParted_Core.cc: In static member function ‘static PedExceptionOption GParted::GParted_Core::ped_exception_handler(PedException*)’:
GParted_Core.cc:3591:7: error: ‘struct GParted::ped_exception_ctx’ has no member named ‘mutex’
GParted_Core.cc:3593:7: error: ‘struct GParted::ped_exception_ctx’ has no member named ‘cond’
GParted_Core.cc:3593:22: error: ‘struct GParted::ped_exception_ctx’ has no member named ‘mutex’
GParted_Core.cc:3594:7: error: ‘struct GParted::ped_exception_ctx’ has no member named ‘mutex’
make[2]: *** [GParted_Core.o] Error 1
make[2]: Leaving directory `/tmp/gparted-test/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/gparted-test'
make: *** [all] Error 2
Testbuild.sh script looks like this:
#!/bin/sh
# Build GParted logging the top commit and build results.
exec 1>> testbuild.log 2>&1
echo '############################################################'
echo "## Build date: `date`"
echo '############################################################'
git log -1
echo '############################################################'
set -x
if [ $# -eq 0 ]; then
# Default to using the number of processors to tell make how
# many jobs to run simultaneously
nproc=`grep -c '^processor' /proc/cpuinfo`
set -- -j $nproc
fi
# Disable bold text escape sequences from gnome-autogen.sh
TERM=
./autogen.sh && make clean && make "${@}"
Curtis,
I'm proposing the following:
Add git-test-sequence and testbuild.sh to the GParted code.
We update the GParted GIT page probably with a "How to review patch sets" section.
If this sounds OK, I'll produce a patch and draft some wording. This will allow us to easily check all patches compile.
Thanks,
Mike