mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
cmdlineTests.sh: Add --exclude option
This commit is contained in:
parent
4752b31e6c
commit
399457d74b
@ -280,6 +280,7 @@ one per subdirectory, and can be executed using the ``cmdlineTests.sh`` script.
|
||||
By default the script runs all available tests.
|
||||
You can also provide one or more `file name patterns <https://www.gnu.org/software/bash/manual/bash.html#Filename-Expansion>`_,
|
||||
in which case only the tests matching at least one pattern will be executed.
|
||||
It is also possible to exclude files matching a specific pattern by prefixing it with ``--exclude``.
|
||||
|
||||
By default the script assumes that a ``solc`` binary is available inside the ``build/`` subdirectory
|
||||
inside the working copy.
|
||||
@ -291,10 +292,11 @@ Example:
|
||||
.. code-block:: bash
|
||||
|
||||
export SOLIDITY_BUILD_DIR=~/solidity/build/
|
||||
test/cmdlineTests.sh "standard_*" "*_yul_*"
|
||||
test/cmdlineTests.sh "standard_*" "*_yul_*" --exclude "standard_yul_*"
|
||||
|
||||
The commands above will run tests from directories starting with ``test/cmdlineTests/standard_`` and
|
||||
subdirectories of ``test/cmdlineTests/`` that have ``_yul_`` somewhere in the name.
|
||||
subdirectories of ``test/cmdlineTests/`` that have ``_yul_`` somewhere in the name,
|
||||
but no test whose name starts with ``standard_yul_`` will be executed.
|
||||
It will also assume that the file ``solidity/build/solc/solc`` inside your home directory is the
|
||||
compiler binary (unless you are on Windows -- then ``solidity/build/solc/Release/solc.exe``).
|
||||
|
||||
|
@ -43,6 +43,7 @@ pushd "${REPO_ROOT}/test/cmdlineTests" > /dev/null
|
||||
autoupdate=false
|
||||
no_smt=false
|
||||
declare -a included_test_patterns
|
||||
declare -a excluded_test_patterns
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
case "$1" in
|
||||
@ -54,6 +55,12 @@ do
|
||||
no_smt=true
|
||||
shift
|
||||
;;
|
||||
--exclude)
|
||||
[[ $2 != '' ]] || fail "No pattern given to --exclude option or the pattern is empty."
|
||||
excluded_test_patterns+=("$2")
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
included_test_patterns+=("$1")
|
||||
shift
|
||||
@ -70,6 +77,11 @@ do
|
||||
done
|
||||
test_name_filter+=(')')
|
||||
|
||||
for pattern in "${excluded_test_patterns[@]}"
|
||||
do
|
||||
test_name_filter+=(-and -not -name "$pattern")
|
||||
done
|
||||
|
||||
# NOTE: We want leading symbols in names to affect the sort order but without
|
||||
# LC_COLLATE=C sort seems to ignore them.
|
||||
# shellcheck disable=SC2207 # We do not support test names containing spaces.
|
||||
|
Loading…
Reference in New Issue
Block a user