Description:
Currently, if one wanted to pass an error code as a variable to an MTR command like --error, the variable is parsed as a string and not a number. This results in an error and the test will halt.
It would be very helpful to have the ability to pass in a variable and have the --error command parse it as a number. This would allow greater flexibility in modularizing tests.
How to repeat:
I want to use an include file that performs a series of commands where the last one will fail with a known error. I want to pass the error number to the include file. I will do this many times for a list of errors.
LET $errno = ER_SOME_ERROR;
--source include/test_for_error.inc
LET $errno = ER_SOME_OTHER_ERROR;
--source include/test_for_error.inc
LET $errno = ER_A_DIFFERENT_ERROR;
--source include/test_for_error.inc
<inside 'test_for_error.inc'>
command 1
command 2
command 3
--error $errno
command 4
SHOW ERRORS;
The problem is the --error command thinks $errno is a string. I've tried using @errno with SET as well as 'eval error $errno', but I have no way to change ER_SOME_ERROR to its numeric equivalent. I cannot move --error outside of the include file because commands (1) - (3) are needed and the error goes with command (4).
Suggested fix:
Allow variables to be parsed as numbers for commands that accept numeric values (of fail if the value cannot be parsed as a number).