Commit 8cec5235 authored by Lev Walkin's avatar Lev Walkin

clean before testing

parent b450ce9b
...@@ -13,6 +13,10 @@ usage() { ...@@ -13,6 +13,10 @@ usage() {
echo " $0 -h" echo " $0 -h"
echo " $0 -t \"<ASN.1 definition for type T, in string form>\"" echo " $0 -t \"<ASN.1 definition for type T, in string form>\""
echo " $0 bundles/<bundle-name.txt> [<line>]" echo " $0 bundles/<bundle-name.txt> [<line>]"
echo "Where options are:"
echo " -h Show this help screen"
echo " --dirty Reuse compile results from the previous run(s)"
echo " -t <ASN.1> Run this particular typel"
echo "Examples:" echo "Examples:"
echo " $0 -t UTF8String" echo " $0 -t UTF8String"
echo " $0 -t \"T ::= INTEGER (0..1)\"" echo " $0 -t \"T ::= INTEGER (0..1)\""
...@@ -29,12 +33,25 @@ abs_top_builddir="${abs_top_builddir:-$(pwd)/../../}" ...@@ -29,12 +33,25 @@ abs_top_builddir="${abs_top_builddir:-$(pwd)/../../}"
tests_succeeded=0 tests_succeeded=0
tests_failed=0 tests_failed=0
stop_after_failed=1 # We stop after 3 failures. stop_after_failed=1 # We stop after 3 failures.
need_clean_before_bundle=1 # Clean before testing a bundle file
need_clean_before_test=1 # Before each line in a bundle file
make_clean_before_bundle() {
test "${need_clean_before_bundle}" = "1" && make clean
}
make_clean_before_test() {
test "${need_clean_before_test}" = "1" && make clean
}
# Get all the type-bearding lines in file and process them individually # Get all the type-bearding lines in file and process them individually
verify_asn_types_in_file() { verify_asn_types_in_file() {
local filename="$1" local filename="$1"
local need_line="$2" local need_line="$2"
test "x$filename" != "x" || usage test "x$filename" != "x" || usage
make_clean_before_bundle
echo "Open [$filename]" echo "Open [$filename]"
local line=0 local line=0
while read asn; do while read asn; do
...@@ -60,6 +77,9 @@ verify_asn_type() { ...@@ -60,6 +77,9 @@ verify_asn_type() {
shift shift
local where="$*" local where="$*"
test "x$asn" != "x" || usage test "x$asn" != "x" || usage
make_clean_before_test
if echo "$asn" | grep -qv "::="; then if echo "$asn" | grep -qv "::="; then
asn="T ::= $asn" asn="T ::= $asn"
fi fi
...@@ -174,9 +194,10 @@ asn_compile() { ...@@ -174,9 +194,10 @@ asn_compile() {
# Command line parsing # Command line parsing
case "$1" in case "$1" in
-h) usage ;; -h) usage ;;
--dirty) need_clean_before_bundle=0; need_clean_before_test=0 ;;
-t) verify_asn_type "$2" || exit 1;; -t) verify_asn_type "$2" || exit 1;;
"") "")
for bundle in bundles/*txt; do for bundle in $(echo bundles/*txt | sort -nr); do
verify_asn_types_in_file "$bundle" verify_asn_types_in_file "$bundle"
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