exactness: Make it possible to run only selected tests from list file.

Signed-off-by: Aharon Hillel <a.hillel@partner.samsung.com>

SVN revision: 67970
This commit is contained in:
Aharon Hillel 2012-02-15 09:56:07 +00:00 committed by Tom Hacohen
parent f51a7e4835
commit 6d68ce3439
2 changed files with 101 additions and 19 deletions

14
README
View File

@ -28,6 +28,9 @@ The application is "elementary_test"
with two parameters: --test-win-only pager\\ slide with two parameters: --test-win-only pager\\ slide
("pager slide" compose singe parameter, note the \\) ("pager slide" compose singe parameter, note the \\)
By default, exactness runs through test file and commits all tests specified.
To run selected tests add test name as param to exactness.
More on this later.
Later, you run exactness with the tests file as parameter. Later, you run exactness with the tests file as parameter.
1. Test Recording. 1. Test Recording.
@ -141,8 +144,15 @@ Later, you run exactness with the tests file as parameter.
When tests completed, the user gets notification message if any tests failed. When tests completed, the user gets notification message if any tests failed.
In such case, please review the fail_*.txt files. In such case, please review the fail_*.txt files.
6. Running selected tests.
6. To view exactness help issue the command: To run selected tests add test name as param to exactness.
Use this option to run selected tests without modifying your test file.
Usage:
/opt/e17/bin/exactness -s TestsFile TestName1 [TestName2] [...]
TestName param has to match test name given in tests file (1st field)
7. To view exactness help issue the command:
exactness --help exactness --help
or or
exactness -h exactness -h

View File

@ -26,10 +26,17 @@ echo "second field is test-command and [optional] params."
echo "Any line starting with '#' is a comment (ignored):" echo "Any line starting with '#' is a comment (ignored):"
echo echo
echo "# This is a comment line" echo "# This is a comment line"
echo "TestName1 TestCmd [param1] [param2]" echo "TestName TestCmd [param1] [param2]"
echo echo
echo "Later, you run \$0 with the tests file as parameter." echo "Later, you run \$0 with the tests file as parameter."
echo echo
echo "By default, exactness runs through test file running all tests specified."
echo "You may run selected tests by adding test name as param to exactness."
echo "Usage:"
echo "\$0 -s TestsFile TestName1 [TestName2] [...]"
echo "Use this option to run selected tests without modifying your test file."
echo "TestName param has to match test name given in tests file (1st field)"
echo
echo echo
echo "Two additional parameters that \$0 accepts:" echo "Two additional parameters that \$0 accepts:"
echo "BaseDir - This is where '.rec' files reside (gets pwd by default)" echo "BaseDir - This is where '.rec' files reside (gets pwd by default)"
@ -288,6 +295,36 @@ fi
return 0 return 0
} }
name_in_args () {
# This function gets curline as first arg
# Then list of args to find if test name is first field of curline
get_test_params "\$1"
if [ \$? -ne 0 ]
then
return 0
fi
if [ -z "\$_test_name" ]
then
return 0
fi
shift
while (( "\$#" ));
do
if [ "\$_test_name" = "\$1" ]
# found test name in list of args
then
return 1
fi
shift
done
# Not found
return 0
}
# Script Entry Point # Script Entry Point
OUR_LIBPATH="$1" OUR_LIBPATH="$1"
@ -300,6 +337,7 @@ _remove_fail=
_orig_dir="orig" _orig_dir="orig"
# Init dest_dir - should change on the fly # Init dest_dir - should change on the fly
_dest_dir= _dest_dir=
_test_all=1
_base_dir=\`pwd\` _base_dir=\`pwd\`
_test_name= _test_name=
_test_cmd= _test_cmd=
@ -347,9 +385,23 @@ do
done done
shift \$((\$OPTIND - 1)) shift \$((\$OPTIND - 1))
_test_file_name="\$1"
shift
# Test if user added test-names as arguments
if [ ! -z "\$*" ]
then
_test_all=0
fi
# when using -o option, we can loop now on tests names
# given as arguments to this script
DEBUG echo _test_file_name="\$_test_file_name"
DEBUG echo _base_dir="\$_base_dir" DEBUG echo _base_dir="\$_base_dir"
DEBUG echo _dest_dir="\$_dest_dir" DEBUG echo _dest_dir="\$_dest_dir"
if [ "\$_simulation" ] if [ "\$_simulation" ]
then then
# When in simulation mode, we will just commit play (ignore other options) # When in simulation mode, we will just commit play (ignore other options)
@ -360,12 +412,17 @@ then
_play= _play=
while read curline; while read curline;
do do
do_simulation "\$curline" name_in_args "\$curline" \$*
if [ \$? -ne 0 ] _run_test=\$(( \$? + \$_test_all ))
if [ \$_run_test -ne 0 ]
then then
(( _n_exe_err++ )) do_simulation "\$curline"
if [ \$? -ne 0 ]
then
(( _n_exe_err++ ))
fi
fi fi
done < "\$1" done < "\$_test_file_name"
# This will cause render simulation # This will cause render simulation
fi fi
@ -434,36 +491,51 @@ if [ "\$_record" ]
then then
while read curline; while read curline;
do do
do_record "\$curline" name_in_args "\$curline" \$*
if [ \$? -ne 0 ] _run_test=\$(( \$? + \$_test_all ))
if [ \$_run_test -ne 0 ]
then then
(( _n_exe_err++ )) do_record "\$curline"
if [ \$? -ne 0 ]
then
(( _n_exe_err++ ))
fi
fi fi
done < "\$1" done < "\$_test_file_name"
fi fi
if [ "\$_play" ] if [ "\$_play" ]
then then
while read curline; while read curline;
do do
do_play "\$curline" name_in_args "\$curline" \$*
if [ \$? -ne 0 ] _run_test=\$(( \$? + \$_test_all ))
if [ \$_run_test -ne 0 ]
then then
(( _n_exe_err++ )) do_play "\$curline"
if [ \$? -ne 0 ]
then
(( _n_exe_err++ ))
fi
fi fi
done < "\$1" done < "\$_test_file_name"
fi fi
if [ "\$_compare" ] if [ "\$_compare" ]
then then
while read curline; while read curline;
do do
get_test_params "\$curline" name_in_args "\$curline" \$*
if [ \$? -eq 0 ] _run_test=\$(( \$? + \$_test_all ))
if [ \$_run_test -ne 0 ]
then then
do_compare "\$_test_name" get_test_params "\$curline"
if [ \$? -eq 0 ]
then
do_compare "\$_test_name"
fi
fi fi
done < "\$1" done < "\$_test_file_name"
fi fi
_n_tests_failed=0 _n_tests_failed=0