Skip to content

Commit 44ec52b

Browse files
committed
test: fix binary with external objects test
Since the binary depends on another sum module (nobin) to be built before itself, some settings were missing. As the comment in the test itself explains, the external objects feature doesn't do by default anything regarding the objects themselves. It's the developer responsibility to make sure they exist In our case, we require the pre sub module to be built, however in this case it isn't enough, as the objects appear in the module's artifact dependency list, and make will fail as it doesn't know what to do with their absence, hence the additional dependency we added between the objects and the module that will build them, enforcing the right order of objects generation. This is the 'right' solution for SBS based external objects (a case that doesn't make much sense to begin with). User specific cases will require different dependencies to make sure the order is maintained. Signed-off-by: Omer Caspi <omer.caspi@gmail.com>
1 parent 51e44a3 commit 44ec52b

File tree

1 file changed

+10
-0
lines changed
  • test/002_binaries/prog-nobin-extern

1 file changed

+10
-0
lines changed

test/002_binaries/prog-nobin-extern/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ FLAV=dbg
99
endif
1010

1111
MODULE_EXTERN_OBJS := ../nobin/obj/$(FLAV)/nobin0.c.o ../nobin/obj/$(FLAV)/nobin1.c.o
12+
# External objects might or might not be built in the same project. They are
13+
# added as dependencies to the module build. In this case, since they are built
14+
# by another module int the same project, we need to make sure that module is
15+
# built beforehand. This requires the following two lines. Adding a pre sub
16+
# module to the module build isn't enough as the external objects are being
17+
# evaluated before the artifact is linked, hence the 2nd line, which adds a
18+
# dependency between these objects and pre sub module, preventing the module
19+
# artifact from being built before the external objects are created.
20+
MODULE_PRE_SUB_MODULES := ../nobin
21+
$(MODULE_EXTERN_OBJS): $(MODULE_PRE_SUB_MODULES)
1222

1323
PROJ_ROOT := $(shell git rev-parse --show-toplevel)
1424
include $(PROJ_ROOT)/module.inc.mk

0 commit comments

Comments
 (0)