Skip to content

Commit

Permalink
[tests] Redefine CXREF to include BASE_ARGUMENTS
Browse files Browse the repository at this point in the history
  • Loading branch information
thoni56 committed Jun 20, 2024
1 parent 6aee2ff commit a87c773
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 22 deletions.
7 changes: 4 additions & 3 deletions tests/Makefile.boilerplate
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

include ../Makefile.messages

# You can override which c-xref to run, but each test need to define ARGUMENTS
# and can use $(COMMAND)
CXREF = ../../src/c-xref
# You can override which c-xref to run by setting CXREF_PROGRAM, but
# each test need to define ARGUMENTS and can use $(COMMAND)
CXREF_PROGRAM = ../../src/c-xref
BASE_ARGUMENTS = -xrefrc .c-xrefrc -p $(CURDIR)
CXREF = $(CXREF_PROGRAM) $(BASE_ARGUMENTS)
COMMAND = $(CXREF) $(BASE_ARGUMENTS) $(ARGUMENTS)

# Define the test name as the directory name
Expand Down
4 changes: 1 addition & 3 deletions tests/test_cexercise_browsing/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Automated tests for C exercise : browsing

include ../Makefile.boilerplate

$(TEST): CXrefs
Expand All @@ -16,7 +14,7 @@ CXrefs: .c-xrefrc
@# Sources are not here but in subdir
@sed -e s:$(CURDIR)$$:$(CURDIR)/cexercise: .c-xrefrc > .c-xrefrc.tmp
@mv .c-xrefrc.tmp .c-xrefrc
@$(COMMAND) -o $(TEST).log
@$(CXREF) -create -o $(TEST).log

debug:
@$(EDIT_SERVER_DRIVER) commands.input --delay 5 > output.tmp &
Expand Down
4 changes: 2 additions & 2 deletions tests/test_full_update/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ $(TEST): CXrefs
$(NORMALIZE) output.tmp > output
$(VERIFY)

trace: CXREF+=-trace
trace: ARGUMENTS+=-trace
trace: $(TEST)

CXrefs: .c-xrefrc
# Sources in subdir:
sed -e s:$(CURDIR)$$:$(CURDIR)/cexercise: .c-xrefrc > .c-xrefrc.tmp
mv .c-xrefrc.tmp .c-xrefrc
$(COMMAND) -create -o $(TEST).log
$(CXREF) -create -o $(TEST).log

clean:
rm -rf CXrefs .c-xrefrc
4 changes: 2 additions & 2 deletions tests/test_get_environment_value/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ $(TEST): CXrefs
trace: EXTRA = \'-trace\'
trace: $(TEST)

CXrefs:
@$(CXREF) test_source -o cxrefs.log
CXrefs: .c-xrefrc
@$(CXREF) -create test_source -o cxrefs.log

clean:
rm -rf .c-xrefrc CXrefs output*
Expand Down
1 change: 0 additions & 1 deletion tests/test_get_project_new/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ trace debug: EXTRA+=--extra="-trace -log=log"
trace: $(TEST)

CXrefs: .c-xrefrc
echo CXREF
$(CXREF) -create

clean:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_globalunused/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trace: $(TEST)
ARGUMENTS = -create

CXrefs: .c-xrefrc
@$(COMMAND) -o $(TEST).log
@$(CXREF) -create -o $(TEST).log

clean:
@-rm -rf CXrefs output.log output.tmp output
Expand Down
2 changes: 1 addition & 1 deletion tests/test_include_next/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ include ../Makefile.boilerplate
ARGUMENTS = -create -I path1 -I path2 source.c -xrefactory-II -errors -o output.tmp

$(TEST): .c-xrefrc
$(COMMAND) > out
$(COMMAND) > output.tmp
@$(NORMALIZE) output.tmp > output
grep "error len" output ; \
if [ $$? -eq 0 ] ; then \
Expand Down
2 changes: 1 addition & 1 deletion tests/test_no_errors_on_communication_channel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $(TEST): CXrefs
trace: EXTRA = \'-trace\'
trace: $(TEST)

CXrefs:
CXrefs: .c-xrefrc
@$(CXREF) test_source -o cxrefs.log

clean:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_old_style_func/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include ../Makefile.boilerplate
ARGUMENTS = -xrefactory-II -create -errors $(TRACE) source.c -log=log -o output.tmp

$(TEST): .c-xrefrc
$(COMMAND) > out
$(COMMAND) > output.tmp
@$(NORMALIZE) output.tmp > output
grep "error len" output ; \
if [ $$? -eq 0 ] ; then \
Expand Down
2 changes: 1 addition & 1 deletion tests/test_prune_option/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include ../Makefile.boilerplate
ARGUMENTS = -xrefactory-II -create -errors $(TRACE) -log=log -o output.tmp -prune pruned

$(TEST): .c-xrefrc
$(COMMAND) > out
$(COMMAND) > output.tmp
@$(NORMALIZE) output.tmp > output
grep "pruned_source.c" output ; \
if [ $$? -eq 0 ] ; then \
Expand Down
2 changes: 1 addition & 1 deletion tests/test_simple_block/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include ../Makefile.boilerplate
ARGUMENTS = -xrefactory-II -create -errors $(TRACE) source.c -log=log -o output.tmp

$(TEST): .c-xrefrc
$(COMMAND) > out
$(COMMAND) > output.tmp
@$(NORMALIZE) output.tmp > output
grep "error len" output ; \
if [ $$? -eq 0 ] ; then \
Expand Down
2 changes: 1 addition & 1 deletion tests/test_simple_complete/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $(TEST): CXrefs
trace: EXTRA = \'-trace\'
trace: $(TEST)

CXrefs:
CXrefs: .c-xrefrc
@$(CXREF) test_source -create -o $(TEST).log

clean:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_simple_tagsearch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trace: EXTRA = \'-trace\'
trace: $(TEST)

CXrefs:
@$(CXREF) test_source -create -o $(TEST).log
@$(CXREF) -create test_source -o $(TEST).log

clean:
rm -rf CXrefs .c-xrefrc
Expand Down
2 changes: 1 addition & 1 deletion tests/test_uint32_t/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ trace: TRACE=-trace
trace: $(TEST)

clean:
rm -rf .c-xrefrc CXrefs output.log output.tmp
rm -rf .c-xrefrc CXrefs out output output.log output.tmp
4 changes: 2 additions & 2 deletions tests/test_update/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ $(TEST): CXrefs
$(NORMALIZE) output.tmp > output
$(VERIFY)

trace: CXREF+=-trace
trace: ARGUMENTS += -trace
trace: $(TEST)

CXrefs: .c-xrefrc
# Sources in subdir:
sed -e s:$(CURDIR)$$:$(CURDIR)/cexercise: .c-xrefrc > .c-xrefrc.tmp
mv .c-xrefrc.tmp .c-xrefrc
$(COMMAND) -create -o $(TEST).log
$(CXREF) -create -o $(TEST).log

clean:
rm -rf CXrefs .c-xrefrc

0 comments on commit a87c773

Please sign in to comment.