Skip to content

Commit

Permalink
units: prepare the way to add a test case triggering an infinite loop
Browse files Browse the repository at this point in the history
A test case in a directory suffixed with .i are just skipped.
*.i directory can be used to store a unit test triggering an infinite loop.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Nov 6, 2014
1 parent 47080ef commit f2120e4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
19 changes: 19 additions & 0 deletions docs/f-units.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,25 @@ When you run test.units target, you will see::
Testing Units/css-singlequote-in-comment...failed but KNOWN bug
Testing Units/ctags-simple...passed

Suffix *.i* is a variant of *.b*. *.i* is for merging/gathering input
which lets ctags process enter an infinite loop. Different from *.b*,
test cases marked as *.i* are never executed. They are just skipped
but reported the skips::

Testing Units/ada-ads...passed
Testing Units/ada-function...skipped (infinite loop)
Testing Units/ada-protected...passed
...

Summary of "Units" test
-------------------------
#passed: 336
#failed: 0
#skipped(features): 0
#skipped(languages): 0
#skipped(infinite loop): 1
#known-bugs: 2


Acknowledgements
------------------------------------------------------------
Expand Down
13 changes: 11 additions & 2 deletions testing.mak
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ test.units: $(CTAGS_TEST)
n_failed=0; \
n_skipped_features=0; \
n_skipped_languages=0; \
n_skipped_infinite_loops=0; \
n_known_bugs=0; \
if [ -n "$(VALGRIND)" -a -n "$(UNIT)" ]; then \
rm -f Units/$(UNIT).[dbt]/STDERR.TMP.vg; \
Expand All @@ -196,9 +197,9 @@ test.units: $(CTAGS_TEST)
fi; \
$(DEFINE_CHECK_FEATURES); \
$(DEFINE_CHECK_LANGUAGES); \
for input in $$(ls Units/*.[dbt]/input.* | grep -v "~$$"); do \
for input in $$(ls Units/*.[dbti]/input.* | grep -v "~$$"); do \
t=$${input%/input.*}; \
name=$${t%.[dbt]}; \
name=$${t%.[dbti]}; \
\
if test -n "$(UNIT)" -a "$${name}" != "Units/$(UNIT)"; then continue; fi; \
\
Expand All @@ -214,6 +215,13 @@ test.units: $(CTAGS_TEST)
\
echo -n "Testing $${name}..."; \
\
ext=$${t##*${name}.}; \
if test "$${ext}" = "i"; then \
echo "skipped (infinite loop)"; \
n_skipped_infinite_loops=$$(expr $$n_skipped_infinite_loops + 1); \
continue; \
fi; \
\
if test -e "$$features"; then \
if ! check_features "$$features"; then \
continue; \
Expand Down Expand Up @@ -241,6 +249,7 @@ test.units: $(CTAGS_TEST)
for f in $$failed_cases; do echo " $$f"; done; \
echo ' #skipped(features): ' $$n_skipped_features; \
echo ' #skipped(languages): ' $$n_skipped_languages; \
echo ' #skipped(infinite loop): ' $$n_skipped_infinite_loops; \
echo ' #known-bugs: ' $$n_known_bugs; \
if [ -n "$(VALGRIND)" -a "$(SHELL)" = /bin/bash -a -n "$(UNIT)" ]; then \
if [ -f Units/$(UNIT).[dbt]/STDERR.TMP.vg ]; then\
Expand Down

0 comments on commit f2120e4

Please sign in to comment.