Developer
Running a local build without installing:
- Clone the lebiniou-data repository.
- Copy
etc/schemes.jsonto where it should be if you had runmake install, i.e. the/usr/local/share/lebiniou/etc/directory if you did a plain./configure. - Create a symbolic link to the
/path/to/lebiniou-data/vuedirectory in lebiniou's top directory (or you'll encounterServer errorerrors when accessing the web interface)
From the top directory, run:
$ LD_LIBRARY_PATH=src DEV_WEB_UI=1 ./src/lebiniou -b plugins
(or use scripts/run.sh)
Check it compiles using LTOWrapper
See: LTOWrapper
$ ./LTOWRAPPER
$ make clean all
$ exit
Checking the tarball compiles everywhere
See: https://www.gnu.org/software/automake/manual/html_node/Checking-the-Distribution.html
$ make distcheck
Compiling a debug version
It is recommended to test both CC=gcc and CC=clang. Pass these flags to ./configure to enable
debug:
--enable-debug: basic debug flags like-g,-O0, …--enable-asan: use AddressSanitizer.--disable-dlclose: this is needed for Valgrind to get a stack trace when errors are in the plugins
Also, use --prefix=/usr to use data files provided by lebiniou-data package.
Style
$ astyle -r *.h,*.c -A10 -s2 -S
Rules
NULLpointer checks:- Use
if (NULL == ptr), notif (ptr == NULL)norif (ptr) - Use if
(NULL != ptr), notif (ptr != NULL)norif (!ptr) - Flow control statements:
- Space between if, switch, for, do, while and the opening parenthesis or bracket
- Readability:
- blank lines in functions
- after variables declaration
- before return statements
- Two blank lines before/after function definitions
- Parenthesis even for
&&and||e.g.if ((this == that) && (foo != bar)) {
Other tests
- New plugins: check they don’t segfault when using
-i NULLand-o NULL
Stress-testing
- Run Le Biniou with
SequencesMinandSequencesMaxto low values (e.g. 1). - Set
LEBINIOU_SEEDfor reproducible results. - To simulate user interaction, use
http://localhost:30543/testingto inject random commands.
Robustness
Following the Erlang programming philosophy “let it crash”, use xerror() when something very
unexpected occurs instead of trying to handle errors (e.g. reading a corrupted path file).
When compiled with debug on this will produce a core file.
Debugging
It is recommended to add useful debug messages in your code so they will help in the future.
For that feel free to add as many #ifdef DEBUG_MY_FEATURE where relevant, in case they are needed
just use CPPFLAGS="-DDEBUG_MY_FEATURE" ./configure (...)
Debian CI for testing
Debian’s CI is pretty strict so we must be sure all tests pass.
Running e.g. lebiniou -i NULL -o NULL --stats must exit with 0 and must not print any
error messages to stderr, or the test will fail:
autopkgtest [04:17:43]: test command1: -----------------------]
command1 FAIL stderr: [!] Error while reading paths directory content: No such file or directory
autopkgtest [04:17:43]: test command1: - - - - - - - - - - results - - - - - - - - - -
autopkgtest [04:17:43]: test command1: - - - - - - - - - - stderr - - - - - - - - - -
[!] Error while reading paths directory content: No such file or directory
autopkgtest [04:17:45]: @@@@@@@@@@@@@@@@@@@@ summary
command1 FAIL stderr: [!] Error while reading paths directory content: No such file or directory
Reproducibility
Le Biniou can give reproducible results, so:
- for development, do not use
glibcor other libraries’ random functions, use the ones defined insrc.brandom.hinstead. - when debugging, make sure you set e.g.
LEBINIOU_SEED=123456(or any other value) so you can reproduce the problem. - Run the
/usr/share/lebiniou/lebiniou-test.shscript fromlebiniou-datato test reproducible encoding of a video.