We have identified a situation where make will randomly return 2 or 0 for the 
same recipe.
Our build system compiles unit tests, runs the unit test executable and then 
performs some basic clean-up after the test is run.
We have something like this:

$(derived_dir)/app /unit_tests/%_tests.pass: \
                                app/%.cpp \
                                app/unit_tests/%_tests.cpp \
                                $(PTLIBDOBJS)
                $(AT)$(call PTCOMPILECPP,$(TEMP)/app -$(subst 
/,-,$*)_tests$(PTOBJEXT),app_orion_picasso_resources/unit_tests/$*_tests.cpp)
                $(AT)$(call PTRUN,$(TEMP)/app-$(subst /,-,$*)$(PTEXT)) 
$(programmer_test_flags)
                $(AT)$(PYTHON) $(MAKEROOT)/rm.py $(TEMP)/app-$(subst 
/,-,$*)$(PTEXT) $(TEMP)/app-$(subst /,-,$*)_tests$(PTOBJEXT) 
$(TEMP)/app-$(subst /,-,$*)$(PTOBJEXT)
                $(AT)$(PYTHON) $(MAKEROOT)/rm.py -f $(TEMP)/app-$(subst 
/,-,$*).pdb
                $(AT)$(PYTHON) $(MAKEROOT)/touch.py $@

We execute rm.py and touch.py instead of Linux commands to handle porting 
issues for Windows and Linux, but the basics are the unit test will be deleted 
when the test passes, or be left in the file system if the test fails.
The unit test executable will return error code 2 when it fails, then make 
returns 0 or 2 when a unit test fails.

We tested this with -j8 and can see the return code is randomly returned as 0 
or 2 each time we compile and run the test, but with -j1 make will always 
return 0.
We fixed the problem by placing - in front of the rm.py and touch.py commands, 
but it seems there is some sort of multi-process issue here, and I would still 
expect 0 to always be returned with this problem in the makefile.
We would also expect these lines to be treated as sequential in a single 
process, but is that actually happening?

We are also using the gnu make build on Windows, and the behaviour is 
consistently behaving the same for -j1 and -j8, so it appears to only be a 
problem for Linux.


Regards,
Colin Girling

IMPORTANT NOTICE: This e-mail message is intended to be received only by 
persons entitled to receive the confidential information it may contain. E-mail 
messages to clients of Cabot Commuications Ltd may contain information that is 
confidential and legally privileged. Please do not read, copy, forward, or 
store this message unless you are an intended recipient of it. If you have 
received this message in error, please forward it to the sender and delete it 
completely from your computer system. Cabot Communications Limited is a company 
registered in England and Wales Registered Office: Unit A Link House, Britton 
Gardens, Kingswood, Bristol BS15 1TF. Company Registered in England Number 
02817269.
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to