The exec and system commands enable tests to execute external commands. However, many of such commands are available only on certain platforms. (For example, rm is Unix-specific and not available on Windows.) Please avoid these commands if possible. They harm the portability and stability of tests.
Have a look at the mysqltest manual and the t/mysqltest.test test file. There are now several mysqltest built-in commands such as
"--write_file", "--cat_file", "--remove_file", ...
which are reliable on all operating systems. Sometimes OS commands could be also replaced by SQL statement sequences writing to and reading from files and some SQL string functions.