This repository hosts the darktable
integration tests. Each test renders a raw image from images/ through a
fixed XMP sidecar with darktable-cli and compares the result against a
committed reference image, both on the CPU and the OpenCL path.
run : main driver, runs the tests
requirements.txt : Python dependencies of the helper scripts
deltae : CIE 2000 delta-E report between two images (Python)
count-diff-pixels : number of differing pixels between two images (Python)
check-performance : reports timing regressions from logs/perfs.log
check-failures : interactive review of the failures of a log
check-cpu-gpu : refreshes the cpugpu.maxpix thresholds from a log
images/ : test images
logs/ : run logs, timings (perfs.log) and their analysis
nnnn-name/ : one test
A test directory contains:
| file | |
|---|---|
<name>.xmp |
the sidecar to apply, names the image via DerivedFrom |
expected.png |
the reference output, created on the first run |
cpugpu.maxpix |
max tolerated CPU/GPU pixel difference |
CONFIG |
optional, one extra darktable-cli conf option per line |
README |
optional, first line is a label shown next to the test |
test.sh |
optional, replaces the default driver, returns 0 if OK |
A test passes when the max delta-E against expected.png stays below 2.3
(and the average below 2.3/3).
darktable-cli, found either in thePATH, through theDARKTABLE_CLIenvironment variable, or in/opt/darktablecompare(ImageMagick), for the diff imageszopflipng, only needed to create theexpected.pngof a new testloupe, only needed bycheck-failures- Python 3 with the modules listed in
requirements.txt
deltae and count-diff-pixels need a few Python modules. ./run creates
the virtual environment .venv on its first run, installs
requirements.txt into it and activates it, so there is nothing to do.
To create it by hand, or to use the scripts outside of ./run:
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txtTwo environment variables control this:
DARKTABLE_TESTS_VENV use another location than ./.venv
NO_VENV=1 do not use a virtual environment, the modules are
then expected to be already available
./run # all tests
./run 0001-exposure # a single test
./run --op=exposure # all tests using that moduleOptions:
--disable-opencl do not run the OpenCL path
--disable-timing do not output timing
--no-deltae light check, does not need the delta-E module
--fast-fail stop on the first failing test
--op=<n> | --operation=<n> run the tests with matching operation n
--gdb | --gdb-cl run the CPU / OpenCL path under gdb
Every run writes logs/test-<date>.log, appends the timings to
logs/perfs.log and finally reports timing regressions. To review the
failures of a run:
./check-failures logs/test-<date>.log- Create the directory
<nnnn>-<meaningful name>. - Develop one of the test images in darktable, then copy its XMP into that
directory as
<meaningful name>.xmp. - Optionally add a
READMEand aCONFIG(see the table above). - Run
./run <dir>a first time: as there is noexpected.pngyet, the output is optimized withzopflipngand saved as the reference. Check that it really is the expected output. - Run
./run <dir>again, everything must now be 0:
Test 0001-exposure
Image mire1.cr2
CPU & GPU version differ by 25699 pixels
----------------------------------
Max dE : 0.00000
Avg dE : 0.00000
Std dE : 0.00000
----------------------------------
...
Pixels above tolerance : 0.00 %
OK
- Commit the
.xmpand theexpected.png.
Create <nnnn>-<meaningful name>/test.sh instead. It may do whatever the
test needs and must return 0 when the test passes, 1 otherwise.