2023-01-12 20:49:14 +01:00
|
|
|
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2024-05-04 00:04:16 +02:00
|
|
|
# Bisecting regressions
|
2022-03-18 17:46:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
Bisecting is a way to find regressions in software. After reporting a bug on the
|
2024-03-16 21:04:42 +01:00
|
|
|
`Pandemonium repository on GitHub ( https://github.com/Relintai/pandemonium_engine )`, you may
|
2022-03-18 17:46:08 +01:00
|
|
|
be asked by a contributor to *bisect* the issue. Bisecting makes it possible for
|
|
|
|
contributors to fix bugs faster, as they can know in advance which commit caused
|
|
|
|
the regression. Your effort will be widely appreciated :)
|
|
|
|
|
|
|
|
The guide below explains how to find a regression by bisecting.
|
|
|
|
|
2024-05-04 00:04:16 +02:00
|
|
|
## What is bisecting?
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2024-03-16 20:56:52 +01:00
|
|
|
Pandemonium developers use the `Git ( https://git-scm.com/ )` version control system.
|
2022-03-18 17:46:08 +01:00
|
|
|
In the context of Git, bisecting is the process of performing a manual
|
2023-01-12 20:39:50 +01:00
|
|
|
`binary search ( https://en.wikipedia.org/wiki/Binary_search_algorithm )`
|
2022-03-18 17:46:08 +01:00
|
|
|
to determine when a regression appeared. While it's typically used for bugs,
|
|
|
|
it can also be used to find other kinds of unexpected changes such as
|
|
|
|
performance regressions.
|
|
|
|
|
2024-05-04 00:04:16 +02:00
|
|
|
## Using official builds to speed up bisecting
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2023-01-12 19:43:03 +01:00
|
|
|
Before using Git's `bisect` command, we strongly recommend trying to reproduce
|
2022-03-18 17:46:08 +01:00
|
|
|
the bug with an older (or newer) official release. This greatly reduces the
|
|
|
|
range of commits that potentially need to be built from source and tested.
|
|
|
|
You can find binaries of official releases, as well as alphas, betas,
|
2024-03-16 20:56:52 +01:00
|
|
|
and release candidates `here ( https://downloads.tuxfamily.org/pandemoniumengine/ )`.
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2024-03-16 20:56:52 +01:00
|
|
|
For example, if you've reported a bug against Pandemonium 3.2, you should first try to
|
|
|
|
reproduce the bug in Pandemonium 3.1 (not a patch release, see below for the reason).
|
|
|
|
If the bug doesn't occur there, try to reproduce it in Pandemonium 3.2 *beta 1* (which
|
2022-03-18 17:46:08 +01:00
|
|
|
is roughly in the middle of all test builds available). If you can't reproduce
|
2024-03-16 20:56:52 +01:00
|
|
|
the bug with Pandemonium 3.2 beta 1, then try newer betas and RC builds. If you do
|
|
|
|
manage to reproduce the bug with Pandemonium 3.2 beta 1, then try older alpha builds.
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2023-01-12 20:55:57 +01:00
|
|
|
Warning:
|
|
|
|
|
2024-03-16 20:56:52 +01:00
|
|
|
For bisecting regressions, don't use patch releases such as Pandemonium 3.1.2.
|
|
|
|
Instead, use the minor version's first release like Pandemonium 3.1. This is
|
2022-03-18 17:46:08 +01:00
|
|
|
because patch releases are built from a separate *stable branch*. This kind
|
2024-03-16 20:56:52 +01:00
|
|
|
of branch doesn't follow the rest of Pandemonium's development, which is done in
|
2023-01-12 19:43:03 +01:00
|
|
|
the `master` branch.
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2024-05-04 00:04:16 +02:00
|
|
|
## The Git bisect command
|
2022-03-18 17:46:08 +01:00
|
|
|
|
|
|
|
If you've found a build that didn't exhibit the bug in the above testing
|
|
|
|
process, you can now start bisecting the regression. The Git version control
|
2023-01-12 19:43:03 +01:00
|
|
|
system offers a built-in command for this: `git bisect`. This makes the
|
2022-03-18 17:46:08 +01:00
|
|
|
process semi-automated as you only have to build the engine, run it and try to
|
|
|
|
reproduce the bug.
|
|
|
|
|
2023-01-12 20:55:57 +01:00
|
|
|
Note:
|
|
|
|
|
2022-03-18 17:46:08 +01:00
|
|
|
Before bisecting a regression, you need to set up a build environment to
|
2024-03-16 20:56:52 +01:00
|
|
|
compile Pandemonium from source. To do so, read the
|
2023-01-12 20:47:54 +01:00
|
|
|
`Compiling ( toc-devel-compiling )` page for your target platform.
|
2024-03-16 20:56:52 +01:00
|
|
|
(Compiling Pandemonium from source doesn't require C++ programming knowledge.)
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2024-03-16 20:56:52 +01:00
|
|
|
Note that compiling Pandemonium can take a while on slow hardware (up an hour for
|
2022-03-18 17:46:08 +01:00
|
|
|
each full rebuild on a slow dual-core CPU). This means the full process can
|
|
|
|
take up to several hours. If your hardware is too slow, you may want to stop
|
|
|
|
there and report the results of your "pre-bisecting" on the GitHub issue so
|
|
|
|
another contributor can continue bisecting from there.
|
|
|
|
|
|
|
|
To start bisecting, you must first determine the commit hashes (identifiers) of
|
|
|
|
the "bad" and "good" build. "bad" refers to the build that exhibits the bug,
|
|
|
|
whereas "good" refers to the version that doesn't exhibit the bug. If you're
|
|
|
|
using a pre-release build as the "good" or "bad" build, browse the `download
|
2024-03-16 20:56:52 +01:00
|
|
|
mirror ( https://downloads.tuxfamily.org/pandemoniumengine/ )`, go to the folder that
|
2023-01-12 19:43:03 +01:00
|
|
|
contains the pre-release you downloaded and look for the `README.txt` file.
|
2022-03-18 17:46:08 +01:00
|
|
|
The commit hash is written inside that file.
|
|
|
|
|
|
|
|
If you're using a stable release as the "good" or "bad" build, use one of the
|
|
|
|
following commit hashes depending on the version:
|
|
|
|
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2024-05-04 14:08:00 +02:00
|
|
|
3.2-stable
|
|
|
|
3.1-stable
|
|
|
|
3.0-stable
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2023-01-12 19:43:03 +01:00
|
|
|
To refer to the latest state of the master branch, you can use `master`
|
2022-03-18 17:46:08 +01:00
|
|
|
instead of a commit hash.
|
|
|
|
|
2024-03-16 20:56:52 +01:00
|
|
|
`Get Pandemonium's source code using Git ( doc_getting_source )`. Once this
|
|
|
|
is done, in the terminal window, use `cd` to reach the Pandemonium repository
|
2022-03-18 17:46:08 +01:00
|
|
|
folder and enter the following command:
|
|
|
|
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2024-05-04 14:08:00 +02:00
|
|
|
# <good commit hash> is hash of the build that works as expected.
|
|
|
|
# <bad commit hash> is hash of the build exhibiting the bug.
|
|
|
|
$ git bisect start
|
|
|
|
$ git bisect good <good commit hash>
|
|
|
|
$ git bisect bad <bad commit hash>
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2024-03-16 20:56:52 +01:00
|
|
|
Compile Pandemonium. This assumes you've set up a build environment:
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2024-05-04 14:08:00 +02:00
|
|
|
# <platform> is the platform you're targeting for regression testing,
|
|
|
|
# like "windows", "x11" or "osx".
|
|
|
|
$ scons platform=<platform> -j4
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2024-03-16 20:56:52 +01:00
|
|
|
Since building Pandemonium takes a while, you want to dedicate as many CPU threads as
|
2023-01-12 19:43:03 +01:00
|
|
|
possible to the task. This is what the `-j` parameter does. Here, the command
|
2024-03-16 20:56:52 +01:00
|
|
|
assigns 4 CPU threads to compiling Pandemonium.
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2023-01-12 19:43:03 +01:00
|
|
|
Run the binary located in the `bin/` folder and try to reproduce the bug.
|
2022-03-18 17:46:08 +01:00
|
|
|
|
|
|
|
If the build **still** exhibits the bug, run the following command:
|
|
|
|
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2024-05-04 14:08:00 +02:00
|
|
|
$ git bisect bad
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2022-03-18 17:46:08 +01:00
|
|
|
|
|
|
|
If the build **does not** exhibit the bug, run the following command:
|
|
|
|
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2024-05-04 14:08:00 +02:00
|
|
|
$ git bisect good
|
2023-01-12 22:00:14 +01:00
|
|
|
```
|
2022-03-18 17:46:08 +01:00
|
|
|
|
|
|
|
After entering one of the commands above, Git will switch to a different commit.
|
2024-03-16 20:56:52 +01:00
|
|
|
You should now build Pandemonium again, try to reproduce the bug, then enter `git
|
2023-01-12 19:43:03 +01:00
|
|
|
bisect good` or `git bisect bad` depending on the result. You'll have to
|
2022-03-18 17:46:08 +01:00
|
|
|
repeat this several times. The longer the commit range, the more steps will be
|
|
|
|
required. 5 to 10 steps are usually sufficient to find most regressions; Git
|
|
|
|
will remind you of the number of steps remaining (in the worst case scenario).
|
|
|
|
|
|
|
|
Once you've completed enough steps, Git will display the commit hash where the
|
|
|
|
regression appeared. Write this commit hash as a comment to the GitHub issue
|
|
|
|
you've bisected. This will help in solving the issue. Thanks again for
|
2024-03-16 20:56:52 +01:00
|
|
|
contributing to Pandemonium :)
|
2022-03-18 17:46:08 +01:00
|
|
|
|
2023-01-12 20:55:57 +01:00
|
|
|
Note:
|
|
|
|
|
2023-01-12 19:43:03 +01:00
|
|
|
You can read the full documentation on `git bisect`
|
2023-01-12 20:39:50 +01:00
|
|
|
`here ( https://git-scm.com/docs/git-bisect )`.
|