diff --git a/build_tools/littlecheck.py b/build_tools/littlecheck.py index ecd486037..9bdf1aa60 100755 --- a/build_tools/littlecheck.py +++ b/build_tools/littlecheck.py @@ -14,14 +14,17 @@ import shlex import subprocess import sys +# Directives can occur at the beginning of a line, or anywhere in a line that does not start with #. +COMMENT_RE = r'^(?:[^#].*)?#\s*' + # A regex showing how to run the file. -RUN_RE = re.compile(r"\s*#\s*RUN:\s+(.*)\n") +RUN_RE = re.compile(COMMENT_RE + r"RUN:\s+(.*)\n") # A regex capturing lines that should be checked against stdout. -CHECK_STDOUT_RE = re.compile(r"\s*#\s*CHECK:\s+(.*)\n") +CHECK_STDOUT_RE = re.compile(COMMENT_RE + r"CHECK:\s+(.*)\n") # A regex capturing lines that should be checked against stderr. -CHECK_STDERR_RE = re.compile(r"\s*#\s*CHECKERR:\s+(.*)\n") +CHECK_STDERR_RE = re.compile(COMMENT_RE + r"CHECKERR:\s+(.*)\n") class Config(object): diff --git a/tests/checks/wildcard.fish b/tests/checks/wildcard.fish index 2910ca775..65e7450f6 100644 --- a/tests/checks/wildcard.fish +++ b/tests/checks/wildcard.fish @@ -10,8 +10,7 @@ mkdir b touch ./b/file.txt set dirs ./a ./b -echo $dirs/*.txt -# CHECK: ./b/file.txt +echo $dirs/*.txt # CHECK: ./b/file.txt cd $oldpwd rm -Rf $dir