Commit cb4b6fa8 authored by Ivana Krumlova's avatar Ivana Krumlova Committed by Petr Špaček

tools: divide_tests.sh - env variable for choosing output directory

parent b976748e
Pipeline #39544 passed with stage
in 1 minute and 28 seconds
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# Sorts .rpl tests into several categories. # Sorts .rpl tests into several categories.
# Takes a diretory with the tests as an argument and moves the test to its subdirectories. # Takes a diretory with the tests as an argument and moves the test to its subdirectories.
# Env variable SCRIPT= sets *_run.sh script for finding working tests, default script is kresd_run.sh # Env variable SCRIPT= sets *_run.sh script for finding working tests, default script is kresd_run.sh
# Env variable DEST= sets output directory where the tests will be copied and divided into subfolders. Default value is working directory.
set -o nounset set -o nounset
set -o errexit set -o errexit
...@@ -10,59 +11,67 @@ set -o errexit ...@@ -10,59 +11,67 @@ set -o errexit
SOURCE="$1" SOURCE="$1"
SCRIPT=${SCRIPT:-"./../kresd_run.sh"} SCRIPT=${SCRIPT:-"./../kresd_run.sh"}
DEST=${DEST:-"."}
rm -rf "$DEST/sorted_tests"
mkdir "$DEST/sorted_tests"
for TEST in "$SOURCE/"*.rpl
do
cp "$TEST" "$DEST/sorted_tests"
done
# Test with the same name is already imported in deckard/sets/resolver # Test with the same name is already imported in deckard/sets/resolver
echo Already imported: echo Already imported:
mkdir -p "$SOURCE/imported" mkdir -p "$DEST/sorted_tests/imported"
for TEST in `comm -12 <(ls -F ../sets/resolver/*.rpl | xargs -n 1 basename) <(ls -F "$SOURCE"/*.rpl | xargs -n 1 basename)` for TEST in `comm -12 <(ls -F ../sets/resolver/*.rpl | xargs -n 1 basename) <(ls -F "$DEST/sorted_tests" | xargs -n 1 basename)`
do do
echo -e '\t' "$TEST" echo -e '\t' "$TEST"
mv "$SOURCE/$TEST" "$SOURCE/imported" mv "$DEST/sorted_tests/$TEST" "$DEST/sorted_tests/imported"
done done
# Parse failed # Parse failed
echo Parse failed: echo Parse failed:
mkdir -p "$SOURCE/parsefail" mkdir -p "$DEST/sorted_tests/parsefail"
for TEST in "$SOURCE/"*.rpl for TEST in "$DEST/sorted_tests/"*.rpl
do do
if ! python3 parse.py "$TEST" >/dev/null 2>/dev/null if ! python3 parse.py "$TEST" >/dev/null 2>/dev/null
then then
echo -e '\t' $(basename "$TEST") echo -e '\t' $(basename "$TEST")
mv "$TEST" "$SOURCE/parsefail" mv "$TEST" "$DEST/sorted_tests/parsefail"
fi fi
done done
# Invalid DSA signatures (common in old testbound tests) # Invalid DSA signatures (common in old testbound tests)
echo Invalid DSA signatures: echo Invalid DSA signatures:
mkdir -p "$SOURCE/invaliddsa" mkdir -p "$DEST/sorted_tests/invaliddsa"
for TEST in "$SOURCE/"*.rpl for TEST in "$DEST/sorted_tests/"*.rpl
do do
if ! python3 invalid_dsa.py "$TEST" >/dev/null 2>/dev/null if ! python3 invalid_dsa.py "$TEST" >/dev/null 2>/dev/null
then then
echo -e '\t' $(basename "$TEST") echo -e '\t' $(basename "$TEST")
mv "$TEST" "$SOURCE/invaliddsa" mv "$TEST" "$DEST/sorted_tests/invaliddsa"
fi fi
done done
# Working in selected script # Working in selected script
echo Working in $SCRIPT: echo Working in $SCRIPT:
mkdir -p "$SOURCE/working" mkdir -p "$DEST/sorted_tests/working"
for TEST in "$SOURCE/"*.rpl for TEST in "$DEST/sorted_tests/"*.rpl
do do
if TESTS="$(readlink -m $TEST)" $SCRIPT >/dev/null 2>/dev/null if TESTS="$(readlink -m $TEST)" $SCRIPT >/dev/null 2>/dev/null
then then
echo -e '\t' $(basename "$TEST") echo -e '\t' $(basename "$TEST")
mv "$TEST" "$SOURCE/working" mv "$TEST" "$DEST/sorted_tests/working"
fi fi
done done
echo Others: echo Others:
mkdir -p "$SOURCE/others" mkdir -p "$DEST/sorted_tests/others"
for TEST in "$SOURCE/"*.rpl for TEST in "$DEST/sorted_tests/"*.rpl
do do
echo -e '\t' $(basename "$TEST") echo -e '\t' $(basename "$TEST")
mv "$TEST" "$SOURCE/others" mv "$TEST" "$DEST/sorted_tests/others"
done done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment