User Tools

Site Tools


en
en:developer

developer

Running a local build without installing:

  • Clone the lebiniou-data repository.
  • Copy etc/schemes.json to where it should be if you had run make 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/vue directory in lebiniou's top directory (or you'll encounter Server error errors 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

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

  • NULL pointer checks:
    • Use if (NULL == ptr), not if (ptr == NULL) nor if (ptr)
    • Use if (NULL != ptr), not if (ptr != NULL) nor if (!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 NULL and -o NULL

Stress-testing

  • Run LeBiniou with SequencesMin and SequencesMax to low values (e.g. 1).
  • Set LEBINIOU_SEED for reproducible results.
  • To simulate user interaction, use http://localhost:30543/testing to 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

LeBiniou can give reproducible results, so:

  • for development, do not use glibc or other libraries’ random functions, use the ones defined in src.brandom.h instead.
  • 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.sh script from lebiniou-data to test reproducible encoding of a video.
en/developer.txt · Last modified: 2021/07/02 22:43 by oliv3