xtest: gate the GP socket tests at compile time - #825
Conversation
1257c2b to
8504d10
Compare
Always compile regression_2000.c, sock_server.c and rand_stream.c and guard their contents with CFG_GP_SOCKETS taken from conf.h, instead of selecting them into the source list with CFG_GP_SOCKETS taken from the TA dev kit conf.mk. During the Android build, conf.mk is read by kati to generate a build description for ninja before any actual build happens (including optee_os and ta dev kit), so this results in a missing conf.mk file and a wrong ninja build configuration. These three files were therefore dropped without any diagnostics on a clean build, and xtest ended up without the GP socket tests even though the TEE is built with support for them. Adding an optee_os/dev kit build dependency for optee_test can't help, because kati generates the very ninja graph that would build conf.mk. conf.h, on the other hand, is force-included by all three build systems and is guaranteed to be there by the time the compiler runs. This is what commit 44ec72b ("xtest: remove CFG_SECSTOR_TA_MGMT_PTA dependency") already did for install_ta.c. No functional change for either setting of CFG_GP_SOCKETS. Link: OP-TEE#275 [1] Signed-off-by: Andrii Shtompel <andrii_shtompel@epam.com>
8504d10 to
d72b29c
Compare
|
@andrew2311 thanks for the patch, and thanks for digging out the root cause. It is unfortunate that the I propose a different path. I think we should make the dev kit a required input, that is run |
|
Thanks, yes, I saw CFG_GP_SOCKETS is just a part of the issue. |
Always compile regression_2000.c, sock_server.c and rand_stream.c and guard
their contents with CFG_GP_SOCKETS taken from conf.h, instead of selecting
them into the source list with CFG_GP_SOCKETS taken from the TA dev kit conf.mk
On a clean AOSP build Android.mk is parsed long before ninja builds the TA dev
kit, so the -include of conf.mk finds nothing, CFG_GP_SOCKETS is empty and
regression_2000.c, sock_server.c and rand_stream.c are dropped from the source
list with no diagnostic: xtest ships without the GP socket tests even though the
TEE it is built against has CFG_GP_SOCKETS=y, and the missing cases are not even
reported as skipped. A second build picks them up, so the contents of xtest
depend on whether the output directory happens to be warm. This cannot be fixed
by adding a build dependency, because kati generates the very ninja graph that
would build conf.mk. So the patch drops the build-time gate and guards the file
contents with CFG_GP_SOCKETS from conf.h instead, which is force included by all
three build systems and, unlike conf.mk, is guaranteed to be there by the time
the compiler runs - the same fix 44ec72b applied to install_ta.c.
This is issue 275, reported in
2018 and closed without a fix ("known issue but no good solution has been
proposed yet"); integrations workaround it by exporting the flags before the build -
see optee_android_manifest ("we need to set an OP-TEE's CFG_* flag ONLY IF
it's used in an Android.mk somewhere!")