On Fedora, /bin/ and /usr/bin are symlinked, and on one of my boxes (although I could not reproduce this behavior in a docker container), /bin comes before /usr/bin in $PATH, so which capnp reports /bin/capnp, and capnp_dir is set to /include, and the test fails:
0$ ./build/test/functional/interface_ipc.py
12025-10-30T20:43:43.753812Z TestFramework (INFO): PRNG seed is: 8370468257027235753
22025-10-30T20:43:43.754163Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_b9kjzj2a
3terminate called after throwing an instance of 'kj::ExceptionImpl'
4 what(): mp/proxy.capnp:6: failed: Import failed: /capnp/c++.capnp
5Aborted (core dumped)
This changes the functional test to resolve any symlinks in the capnp binary path reported by which.