diff --git a/README b/README index c6d9c3d..51f37ef 100644 --- a/README +++ b/README @@ -28,6 +28,9 @@ The application is "elementary_test" with two parameters: --test-win-only pager\\ slide ("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. 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. In such case, please review the fail_*.txt files. - -6. To view exactness help issue the command: +6. Running selected tests. +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 or exactness -h diff --git a/src/scripts/write.sh b/src/scripts/write.sh index db2b65a..1ce3a50 100755 --- a/src/scripts/write.sh +++ b/src/scripts/write.sh @@ -26,10 +26,17 @@ echo "second field is test-command and [optional] params." echo "Any line starting with '#' is a comment (ignored):" echo echo "# This is a comment line" -echo "TestName1 TestCmd [param1] [param2]" +echo "TestName TestCmd [param1] [param2]" echo echo "Later, you run \$0 with the tests file as parameter." 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 "Two additional parameters that \$0 accepts:" echo "BaseDir - This is where '.rec' files reside (gets pwd by default)" @@ -288,6 +295,36 @@ fi 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 OUR_LIBPATH="$1" @@ -300,6 +337,7 @@ _remove_fail= _orig_dir="orig" # Init dest_dir - should change on the fly _dest_dir= +_test_all=1 _base_dir=\`pwd\` _test_name= _test_cmd= @@ -347,9 +385,23 @@ do done 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 _dest_dir="\$_dest_dir" + if [ "\$_simulation" ] then # When in simulation mode, we will just commit play (ignore other options) @@ -360,12 +412,17 @@ then _play= while read curline; do - do_simulation "\$curline" - if [ \$? -ne 0 ] + name_in_args "\$curline" \$* + _run_test=\$(( \$? + \$_test_all )) + if [ \$_run_test -ne 0 ] then - (( _n_exe_err++ )) + do_simulation "\$curline" + if [ \$? -ne 0 ] + then + (( _n_exe_err++ )) + fi fi - done < "\$1" + done < "\$_test_file_name" # This will cause render simulation fi @@ -434,36 +491,51 @@ if [ "\$_record" ] then while read curline; do - do_record "\$curline" - if [ \$? -ne 0 ] + name_in_args "\$curline" \$* + _run_test=\$(( \$? + \$_test_all )) + if [ \$_run_test -ne 0 ] then - (( _n_exe_err++ )) + do_record "\$curline" + if [ \$? -ne 0 ] + then + (( _n_exe_err++ )) + fi fi - done < "\$1" + done < "\$_test_file_name" fi if [ "\$_play" ] then while read curline; do - do_play "\$curline" - if [ \$? -ne 0 ] + name_in_args "\$curline" \$* + _run_test=\$(( \$? + \$_test_all )) + if [ \$_run_test -ne 0 ] then - (( _n_exe_err++ )) + do_play "\$curline" + if [ \$? -ne 0 ] + then + (( _n_exe_err++ )) + fi fi - done < "\$1" + done < "\$_test_file_name" fi if [ "\$_compare" ] then while read curline; do - get_test_params "\$curline" - if [ \$? -eq 0 ] + name_in_args "\$curline" \$* + _run_test=\$(( \$? + \$_test_all )) + if [ \$_run_test -ne 0 ] then - do_compare "\$_test_name" + get_test_params "\$curline" + if [ \$? -eq 0 ] + then + do_compare "\$_test_name" + fi fi - done < "\$1" + done < "\$_test_file_name" fi _n_tests_failed=0