mer-hybris / libgbinder

GLib-style interface to binder
BSD 3-Clause "New" or "Revised" License
50 stars 42 forks source link

Erroneous failure of unit tests if /etc/gbinder.d/ contains specific config #118

Closed zhubr closed 11 months ago

zhubr commented 11 months ago

While rebuilding 1.1.34 rpm on opensuse 15.4 (for myself) I'm observing (supposedly erroneous) unit-test failure in case some config from waydroid /etc/gbinder.d/anbox.conf is present. This config is: ---------------------------------------------- cut cat /etc/gbinder.d/anbox.conf [Protocol] /dev/binder = aidl2 /dev/vndbinder = aidl2 /dev/hwbinder = hidl

[ServiceManager] /dev/binder = aidl2 /dev/vndbinder = aidl2 /dev/hwbinder = hidl ---------------------------------------------- cut And then unit-test error is:

make[1]: Entering directory '/opt/nick/rpmbuild/BUILD/libgbinder-1.1.34/unit/unit_protocol' cc -c -fPIC -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_MAX_ALLOWED -Wall -Wno-deprecated-declarations -I../common -I../../src -I../../include -MMD -MP -I/usr/include/gutil -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -g -DDEBUG -MT"build/debug/common_test_binder.o" -MF"build/debug/common_test_binder.d" ../common/test_binder.c -o build/debug/common_test_binder.o make[1]: Leaving directory '/opt/nick/rpmbuild/BUILD/libgbinder-1.1.34/unit/unit_protocol' make[1]: Entering directory '/opt/nick/rpmbuild/BUILD/libgbinder-1.1.34/unit/unit_protocol' cc -fPIC -g build/debug/common_test_binder.o build/debug/common_test_main.o build/debug/unit_protocol.o ../../build/debug/libgbinder.a -lgobject-2.0 -lglib-2.0 -lglibutil -lpthread -o build/debug/unit_protocol make[1]: Leaving directory '/opt/nick/rpmbuild/BUILD/libgbinder-1.1.34/unit/unit_protocol' make[1]: Entering directory '/opt/nick/rpmbuild/BUILD/libgbinder-1.1.34/unit/unit_protocol'

random seed: R02S5700a7bf8500565b2c575cd29088ef67

1..26

Start of protocol tests

** ERROR:unit_protocol.c:197:test_device: assertion failed (p->name == "aidl"): ("aidl2" == "aidl") Bail out! ERROR:unit_protocol.c:197:test_device: assertion failed (p->name == "aidl"): ("aidl2" == "aidl") ---------------------------------------------- cut Now if I remove/rename the /etc/gbinder.d all tests pass fine. It looks like maybe while in unit-tests, global configs should better be ignored?

zhubr commented 11 months ago

(For some reason github has added some strange markup to my sample fragments, sorry for that)

monich commented 11 months ago

Yeah, it's kind of a known problem (and not a problem it this thing is being built in a clean environment e.g. in OBS). Let's see if I can find time to fix it...

monich commented 11 months ago

Hmm, actually the problem with this particular unit test (as well as few others) is supposed to be fixed by commit 865a29d (included in version 1.1.20). Some tests seem to still have this problem but unit_protocol should be fine. Something fishy is going on...

monich commented 11 months ago

Ah, that's because only /etc/gbinder.conf was ignored by unit_protocol but not the contents of /etc/gbinder.d/

monich commented 11 months ago

PR #119 should really fix this problem. It would be nice if you could test it and confirm that it works for you too. And thanks for reporting the issue!

zhubr commented 11 months ago

Yes, all unit-tests now pass successfully regardless of the offending config file. Thanks!