[Build] Rework Makefile rules to ease addition of LOC package#6
[Build] Rework Makefile rules to ease addition of LOC package#6
Conversation
2d8e373 to
09f1efa
Compare
|
|
||
| - name: Build-CC-Samples | ||
| run: BUILD_MODE=${{ matrix.build_type }} make clean-l3 && BUILD_MODE=${{ matrix.build_type }} CC=g++ CXX=g++ LD=g++ make all-cc-tests | ||
|
|
There was a problem hiding this comment.
No new tests added to CI. Just adding blank lines for readability.
| @echo 'Usage:' | ||
| @echo ' ' | ||
| @echo 'To build all sample programs and run all unit-tests:' | ||
| @echo ' make clean && CC=g++ CXX=g++ LD=g++ make all' |
There was a problem hiding this comment.
New functionality being onlined here.
| # test-use-cases/single-file-Cpp-program/test-main.cpp | ||
| # | ||
| # Convert this list of *main.c to generate test-code program binary names, | ||
| # using the src-dir's name as the program name. |
There was a problem hiding this comment.
All these TEST* symbols on L137 were found unnecessary, so I've simplified them.
| SINGLE_FILE_CC_PROGRAM_OBJS := $(SINGLE_FILE_CC_PROGRAM_OBJS:%.c=$(OBJDIR)/%.o) | ||
|
|
||
| $(BINDIR)/$(TESTSDIR)/single-file-CC-program: $(SINGLE_FILE_CC_PROGRAM_OBJS) | ||
|
|
There was a problem hiding this comment.
This whole deleted block is now unnecessary as the dependencies of make targets on sample program binaries is defined differently, above.
|
|
||
| #include <stdint.h> | ||
|
|
||
| #ifdef L3_LOC_ENABLED |
There was a problem hiding this comment.
Here onwards, in the change-set, you will see LOC making an appearance.
I have edited the files to "prepare" the structures and L3 APIs to start working with 4-byte loc_t ID value.
Currently, all this is #ifdef'ed out under L3_LOC_ENABLED define.
In a future PR, the builds will be invoked with this -DL3_LOC_ENABLED which will - magically - activate this code, and L3 logging will become LOC-enabled.
| */ | ||
| #ifdef L3_LOC_ENABLED | ||
| #define l3_log_simple(msg, arg1, arg2) \ | ||
| l3__log_simple(__LOC__, (msg), (arg1), (arg2)) |
There was a problem hiding this comment.
In an immediately upcoming PR #8 , if we build the sample programs with L3_LOC_ENABLED=1, then we will store the LOC-ID token in the L3 logging entry struct. Otherwise, will just store 0.
| { | ||
| pid_t tid; | ||
| #ifdef L3_LOC_ENABLED | ||
| loc_t loc; |
There was a problem hiding this comment.
Note that in a future PR, when this field is activated, we are -only- re-using the 4-byte hole that is conveniently left behind for us in current non-L3_LOC_ENABLED build:
(gdb) ptype/o struct l3_entry
/* offset | size */ type = struct l3_entry {
/* 0 | 4 */ pid_t tid;
/* XXX 4-byte hole */ <<< loc_t loc; field is using these pad bytes.
/* 8 | 8 */ const char *msg;
/* 16 | 8 */ uint64_t arg1;
/* 24 | 8 */ uint64_t arg2;
/* total size (bytes): 32 */
}
09f1efa to
986fda5
Compare
This commit refactors the Makefile rules to ease the addition of rules to integrate Line-of-Code (LOC) package in a follow-on commit. Several redundant TEST_*BIN* etc. symbols are purged. Existing capabilities are unchanged, and we now additionally support: $ make clean && CC=g++ CXX=g++ LD=g++ make all $ make run-tests ... to build all .c, .cpp and .cc sample-programs and run them in one-pass. clean: rm /tmp/l3*.dat files, also. Update `make help` usage messages to be more self-explanatory.
986fda5 to
efa685b
Compare
This commit refactors the Makefile rules to ease the addition of rules to integrate Line-of-Code (LOC) package in a follow-on commit. Several redundant TEST_BIN etc. symbols are purged.
Existing capabilities are unchanged, and we now additionally support:
... to build all .c, .cpp and .cc sample-programs and run them in one-pass.
Added
test.shwrapper script for devs to quickly re-run all the tests that are run in CI, for easily stabilizing changes w/o having to go thru CI.Updated
make helpusage messages (as a quick reference):NOTE: To the reviewer:
This is really a non-functional, code-cleanup, refactoring change.
I have folded-in the support for LOC package on top of this code in a test PR #8 , which shows that this refactoring greatly simplifies adding in
Makefilerules to pick-up LOC's generated files and other Make-rules.Additionally, in this change-set, you will see LOC making an appearance in
l3.handl3.cfiles:I have edited the files to "prepare" the structures and L3 APIs to start working with 4-byte loc_t ID value.
Currently, all this is #ifdef'ed out under L3_LOC_ENABLED define.
In a future PR, the builds will be invoked with this -DL3_LOC_ENABLED which will - magically - activate this code, and L3 logging will become LOC-enabled.
Once this goes in, I am ready to submit a PR for integrating LOC with L3 package.