Skip to content

Commit

Permalink
[tests] Move 'clean' target to Makefile.boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
thoni56 committed Jun 20, 2024
1 parent 273ed05 commit cc56245
Show file tree
Hide file tree
Showing 70 changed files with 24 additions and 229 deletions.
4 changes: 3 additions & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ list:

.PHONY: clean
clean:
rm -rf *.info */.coverage coverage
$(foreach dir,$(TESTS),\
$(MAKE) -C $(dir) clean ; \
)

coverage:
GCOV_PREFIX=$PWD/test_simple_push/.coverage/ GCOV_PREFIX_STRIP=7 lcov -v -c --build-directory ../src/.objects/ -d $PWD/test_simple_push/.coverage/ -b ../src -o test_simple_push.info
Expand Down
3 changes: 3 additions & 0 deletions tests/Makefile.boilerplate
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ VERIFY = cmp output expected ; \
.c-xrefrc: ../c-xrefrc.tpl
@sed -e "s+CURDIR+$(CURDIR)+g" -e "s+TEST+$(TEST)+g" ../c-xrefrc.tpl > .c-xrefrc

clean:
@-rm -rf CXrefs .c-xrefrc out* log *.log

coverage:
cd ../../src ; make clean-coverage
@echo "Doing coverage in this directory only"
Expand Down
3 changes: 0 additions & 3 deletions tests/c-xref/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,3 @@ $(TEST): .c-xrefrc

trace: TRACE=-trace
trace: $(TEST)

clean:
rm -rf CXrefs c-xref.log out .c-xrefrc
3 changes: 0 additions & 3 deletions tests/ffmpeg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,3 @@ ffmpeg:

.c-xrefrc: c-xrefrc.tpl
@sed -e "s+PWD+$(CURDIR)+g" c-xrefrc.tpl > .c-xrefrc

clean:
rm -rf CXrefs c-xref .c-xrefrc ffmpeg ffmpeg.log
3 changes: 0 additions & 3 deletions tests/systemd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,3 @@ systemd:

.c-xrefrc: c-xrefrc.tpl
@sed -e "s+PWD+$$PWD+g" c-xrefrc.tpl > .c-xrefrc

clean:
rm -rf CXrefs .c-xrefrc systemd systemd.log
5 changes: 1 addition & 4 deletions tests/test_add_parameter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ include ../Makefile.boilerplate

ARGUMENTS = -xrefactory-II -refactory -rfct-add-param -olcxparnum=2 -rfct-param1=int\ arg -rfct-param2=42 -olcursor=17 $(CURDIR)/source.c

$(TEST): clean
$(TEST):
$(COMMAND) -log=log $(EXTRA) > output.tmp
@$(NORMALIZE) output.tmp | grep -v progress > output
@$(VERIFY)

trace: EXTRA=-trace
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output log
5 changes: 1 addition & 4 deletions tests/test_add_parameter_after_void/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ include ../Makefile.boilerplate

ARGUMENTS = -xrefactory-II -refactory -rfct-add-param -olcxparnum=2 -rfct-param1="int arg" -rfct-param2=42 -olcursor=16 $(CURDIR)/hello.c

$(TEST): clean
$(TEST):
$(COMMAND) -log=log $(EXTRA) > output.tmp
@$(NORMALIZE) output.tmp | grep -v progress > output
@$(VERIFY)

trace: EXTRA=-trace
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output log
5 changes: 1 addition & 4 deletions tests/test_add_parameter_outside_range/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ include ../Makefile.boilerplate

ARGUMENTS = -xrefactory-II -refactory -rfct-add-param -olcxparnum=14 -rfct-param1="int arg" -rfct-param2=42 -olcursor=70 $(CURDIR)/source.c

$(TEST): clean
$(TEST):
$(COMMAND) -log=log $(EXTRA) > output.tmp
@$(NORMALIZE) output.tmp | grep -v progress > output
@$(VERIFY)

trace: EXTRA=-trace
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output log
5 changes: 1 addition & 4 deletions tests/test_add_parameter_to_empty/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ include ../Makefile.boilerplate

ARGUMENTS = -xrefactory-II -refactory -rfct-add-param -olcxparnum=1 -rfct-param1="int arg" -rfct-param2=42 -olcursor=16 $(CURDIR)/hello.c

$(TEST): clean
$(TEST):
$(COMMAND) -log=log $(EXTRA) > output.tmp
@$(NORMALIZE) output.tmp | grep -v progress > output
@$(VERIFY)

trace: EXTRA=-trace
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output log
5 changes: 1 addition & 4 deletions tests/test_add_parameter_to_void/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ include ../Makefile.boilerplate

ARGUMENTS = -xrefactory-II -refactory -rfct-add-param -olcxparnum=1 -rfct-param1="int arg" -rfct-param2=42 -olcursor=16 $(CURDIR)/hello.c

$(TEST): clean
$(TEST):
$(COMMAND) -log=log $(EXTRA) > output.tmp
@$(NORMALIZE) output.tmp | grep -v progress > output
@$(VERIFY)

trace: EXTRA=-trace
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output log
3 changes: 0 additions & 3 deletions tests/test_bracketed_include/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@ $(TEST): .c-xrefrc
else \
$(OK) ; \
fi

clean:
rm -rf .c-xrefrc CXrefs output.log output.tmp
3 changes: 0 additions & 3 deletions tests/test_c_extract_with_argument/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ $(TEST):
trace: EXTRA=--extra \'-trace\'
trace: $(TEST)

clean:
@-rm -rf .c-xrefrc CXrefs log output.tmp output

debug:
@$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) --delay 5 > output.tmp &
sleep 1
Expand Down
5 changes: 1 addition & 4 deletions tests/test_c_parsing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ include ../Makefile.boilerplate
ARGUMENTS = test_source/hello.c

# This test will always succeed unless c-xref fails
$(TEST): clean
$(TEST):
@$(COMMAND) -o output.tmp
@$(NORMALIZE) output.tmp >> output
@$(OK)
@exit 0

clean:
@-rm -rf CXrefs output.log output.tmp output
5 changes: 1 addition & 4 deletions tests/test_c_simple_extract_function/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
include ../Makefile.boilerplate


$(TEST): clean
$(TEST):
@# First do the extract
@-$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) > output.tmp
@$(NORMALIZE) output.tmp > output
$(VERIFY)

clean:
@-rm -rf CXrefs output.log output.tmp output

debug:
@$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) --buffer buffer --delay 5 > output.tmp &
sleep 1
Expand Down
5 changes: 1 addition & 4 deletions tests/test_c_simple_extract_macro/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include ../Makefile.boilerplate


$(TEST): clean
$(TEST):
@# First do the extract
@-$(EDIT_SERVER_DRIVER) commands1.input $(EXTRA) > output1.tmp
@$(NORMALIZE) output1.tmp > output
Expand All @@ -22,9 +22,6 @@ $(TEST): clean
trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output

debug:
@$(EDIT_SERVER_DRIVER) commands1.input $(EXTRA) --buffer buffer1 --delay 5 > output.tmp &
sleep 1
Expand Down
3 changes: 0 additions & 3 deletions tests/test_cexercise_browsing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,3 @@ debug:
@$(EDIT_SERVER_DRIVER) commands.input --delay 5 > output.tmp &
sleep 1
sudo gdb -pid `pgrep -a c-xref | grep -v .emacs | awk '{ print $$1 }'` -ex 'br main'

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_completions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ debug:
@$(EDIT_SERVER_DRIVER) commands.input --delay 5 > output.tmp &
sleep 1
sudo gdb -pid `pgrep -a c-xref | grep -v .emacs | awk '{ print $$1 }'` -ex 'br main'

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_completions_with_parenthesis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ debug:
@$(EDIT_SERVER_DRIVER) commands.input --delay 5 > output.tmp &
sleep 1
sudo gdb -pid `pgrep -a c-xref | grep -v .emacs | awk '{ print $$1 }'` -ex 'br main'

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

clean:
rm -rf CXrefs .c-xrefrc

debug:
@$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) --delay 5 > output.tmp &
sleep 1
Expand Down
3 changes: 0 additions & 3 deletions tests/test_cexercise_extract_macro/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ $(TEST): .c-xrefrc

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_parameters_1_add/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ $(TEST): .c-xrefrc

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_parameters_2_delete/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ $(TEST): .c-xrefrc

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_parameters_3_remove_used/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ debug:
@$(EDIT_SERVER_DRIVER) commands.input --delay 5 > output.tmp &
sleep 1
sudo gdb -pid `pgrep -a c-xref | grep -v .emacs | awk '{ print $$1 }'` -ex 'br main'

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_parameters_4_add_with_clash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ $(TEST): .c-xrefrc

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_rename_1_local_variable/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ $(TEST): .c-xrefrc

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_rename_2_function/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ $(TEST): .c-xrefrc

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_rename_3_inside_macro/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ $(TEST): .c-xrefrc

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_cexercise_rename_4_macro_parameter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ CXrefs: .c-xrefrc
@sed -e s:$(CURDIR)$$:$(CURDIR)/cexercise: .c-xrefrc > .c-xrefrc.tmp
@mv .c-xrefrc.tmp .c-xrefrc

clean:
rm -rf CXrefs .c-xrefrc

debug:
@$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) --delay 5 > output.tmp &
sleep 1
Expand Down
3 changes: 0 additions & 3 deletions tests/test_cexercise_rename_5_name_collision/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ $(TEST): .c-xrefrc

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf CXrefs .c-xrefrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ $(TEST): .c-xrefrc

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf CXrefs .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_create_references_in_subdir/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@ $(TEST): .c-xrefrc
else \
$(FAIL) ; \
fi

clean:
rm -rf .c-xrefrc CXrefs
3 changes: 0 additions & 3 deletions tests/test_delete_last_macro_argument/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ $(TEST): .c-xrefrc
@$(NORMALIZE) output.tmp > output
@$(VERIFY)

clean:
rm -rf CXrefs .c-xrefrc

debug:
@$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) --delay 5 > output.tmp &
sleep 1
Expand Down
3 changes: 0 additions & 3 deletions tests/test_delete_no_parameter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ $(TEST): .c-xrefrc

trace: EXTRA=-trace
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output log .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_delete_void_parameter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ $(TEST): .c-xrefrc

trace: EXTRA=-trace
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output log .c-xrefrc
3 changes: 0 additions & 3 deletions tests/test_edit_server_test_example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ $(TEST): .c-xrefrc
trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
rm -rf .c-xrefrc CXrefs output.log output.tmp

debug:
@$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) --delay 5 > output.tmp &
sleep 1
Expand Down
5 changes: 1 addition & 4 deletions tests/test_extract_out_argument/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ include ../Makefile.boilerplate

ARGUMENTS = -xrefactory-II -refactory -rfct-extract-function -olmark=50 -olcursor=80 $(CURDIR)/source.c

$(TEST): clean
$(TEST):
$(COMMAND) -log=log $(EXTRA) > output.tmp
@$(NORMALIZE) output.tmp | grep -v progress > output
@$(VERIFY)

trace: EXTRA=-trace
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output log
5 changes: 1 addition & 4 deletions tests/test_extract_with_complicated_comments_around/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
include ../Makefile.boilerplate


$(TEST): clean
$(TEST):
@-$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) > output.tmp
@$(NORMALIZE) output.tmp > output
$(VERIFY)

trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output

debug:
@$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) --delay 5 > output.tmp &
sleep 1
Expand Down
5 changes: 1 addition & 4 deletions tests/test_extract_with_return/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include ../Makefile.boilerplate


$(TEST): clean
$(TEST):
@-$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) > output.tmp
@$(NORMALIZE) output.tmp > output
@diff output expected > /dev/null ; \
Expand All @@ -18,9 +18,6 @@ $(TEST): clean
trace: EXTRA = \'-trace\'
trace: $(TEST)

clean:
@-rm -rf CXrefs output.log output.tmp output

debug:
@$(EDIT_SERVER_DRIVER) commands.input $(EXTRA) --delay 5 > output.tmp &
sleep 1
Expand Down
Loading

0 comments on commit cc56245

Please sign in to comment.