It occured to me that I’ve not seen this documented, so I thought i might write a small topic about this.
The first step is to compile your modified libbe.so in your haiku repo, for jam one can just name the target. The -j4 are the number of processors. you can adjust this in your case.
~/proj/haiku: jam -j4 libbe.so
The second part is compiling the tests.
~/proj/haiku: cd src/tests/kits/interface/
~/proj/haiku/src/tests/kits/interface: jam -j4
Some tests will probably fail to compile here. This is to be expected as they are seldomly used for testing!
If this happens either ignore it, or roll up your sleeves and fix it.
Now that you have compiled your tests you can run them. But care has to be taken to run it with the correct libbe.so, the one you just compiled
To do this one can either use the LIBRARY_PATH variable, and prepend a folder with the libbe.so in it. Or in this case I will use LD_PRELOAD, this is a variable with which we can specify a library that the dynamic linker should load before it checks the LIBRARY_PATH.
First we have to go to where the finished tests are moved by the buildsystem:
~/proj/haiku: cd generated/objects/haiku/x86_64/release/
For my machine this is x86_64, but on a older 32bit system this would be different (or on a riscV or arm system)
The next path depends on wether you have compiled the tests in debug mode or in release mode, the default is the release mode, so we will go there.
~/proj/haiku/generated/objects/haiku/x86_64: cd release/tests/
And then into the folder for the interface tests (or other tests if you prefer)
~/proj/haiku/generated/objects/haiku/x86_64/release/tests: cd kits/interface/
Now we need to prepend the enviroment variable to the command we wish to execute, eithe export this to the enviroment or write it before every command
To export it you would do this:
export LD_PRELOAD=../../../kits/libbe.so
Or alternatively just write it before the commands:
~/proj/haiku/generated/objects/haiku/x86_64/release/tests/kits/interface: LD_PRELOAD=../../../kits/libbe.so layout/widget_layout_test/WidgetLayoutTest BTextControl
The test used here is a bit more complex, but this should work similarily for other layout kit tests, or other tests in general.
I hope this has been somewhat informative, maybe it was too verbose? let me know what you think.
Regards