<div dir="ltr"><div dir="ltr"><div dir="ltr">Hello all,<div><br></div><div>The GRASS testsuite contains several tests that have been written as shell scripts. If I am not mistaken, those can be identified by the "unknown" percentages in the testreport (<a href="http://fatra.cnr.ncsu.edu/grassgistests/reports_for_date-2019-03-26-07-00/report_for_nc_spm_full_v2alpha_nc/testfiles.html" target="_blank">example</a>).</div><div><br></div><div>IMHV this practise is causing several issues:</div><div><br></div><div>1. The testrunner seems to be skipping/omitting the majority of the available tests. More specifically, the testrunner currently runs 27 shell scripts, while it seems that there are <a href="https://gist.github.com/pmav99/8e016e7c044555cef4e37d685a6622b6" target="_blank">95+ tests</a> written as shell scripts. I suspect that the testrunner is only matching "testsuite" directories while skipping directories named "tests", "test_suite" etc.</div><div><br></div><div>1a. There should be uniformity in the naming conventions of test directories and test files.</div><div>1b. Needless to say, we need to make sure that the testrunner runs all the available tests. I guess that if 1a is taken care off then 1b will have been resolved too. </div><div><br></div><div>2. I only checked a bunch of the shell scripts but I am under the impression that majority of them (if not all!) are not real tests but just shell scripts that prove that the code runs while not really asserting that the code is actually correct. Of course, this is better than nothing, but it is not good enough.</div><div><br></div><div>2a. Ideally and as a mid-term goal these tests should be converted to proper python tests</div><div>2b. In the meantime, and if it is not already being used, we should try to make sure that the shells scripts are using "strict mode" so that errors do propagate:</div><div><a href="http://redsymbol.net/articles/unofficial-bash-strict-mode/">http://redsymbol.net/articles/unofficial-bash-strict-mode/</a><br><a href="https://disconnected.systems/blog/another-bash-strict-mode/">https://disconnected.systems/blog/another-bash-strict-mode/</a></div><div>2c. Also in the meantime, and in order to make testreports more useful, we could also add a single python test file next to each shell script which will contain something similar to this:</div><div><br></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><div><font face="monospace, monospace">subprocess.check_out(shlex.split("bash test_foo.sh"))</font></div><div><font face="monospace, monospace"><br></font></div></div></div></blockquote><font face="arial, helvetica, sans-serif">This way, we would have reports with proper count of testsuites, failures etc.</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">3. Finally, IMHV there should also be an official policy/requirement, that new code/modules cannot be accepted unless they have proper and comprehensive tests written in python.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">with kind regards,</font></div><div><font face="arial, helvetica, sans-serif">Panos</font></div></div>