The regression test scripts were modified for the changes in the test code (and new command line). The test numbering was removed and the scipts now determine which tests to run by the presence of the parser*.dat, expression*.dat and translator*.dat files in the test directory. The regtest script (for Windows/MSYS and Linux) no longer references ibcp.exe but simply ibcp, which will work on both Windows and Linux, with the ".exe" part added automatically on Windows.
To be able to handle any build directory (in source or out of source), the regtest script uses the source directory directly. This was accomplished by making CMake configure this, so regtest was renamed to regtest.in and references the CMake ibcp_SOURCE_DIR variable to create regtest in the binary (build) directory that uses the correct source directory. Now a build and test consists of just three steps, running cmake (with the proper options and path to the build directory), running make and running regtest (in the build directory).
I considered dropping the Windows Command window regtest.bat batch file, but decided this should still be included so that the regression tests could be run from the downloaded binary along with the source directory without having to build the program. It is still a crude alternative to the regtest bash script, but it gets the job done. When run, the "Compare more files (Y/N)?" question still has to be answered with an N now three times with the addition of the expression test compares.
The tests with the regression tests script work on all three platforms, except one problem remains: the problem with parser test #3 giving different results on the three platforms (the Windows XP results are in the repository), which still needs to be resolved. All the testing changes has be pushed to the repository on github, including a new .gitignore file, which tells git to ignore any files in the build and nbproject sub-directories.
Saturday, October 13, 2012
New Test Code
The new test code design outlined on October 10 has been implemented and tested. The old test_parser() and test_translator() functions with their test inputs, were replaced with a single test_ibcp() function that reads an input file and calls the appropriate function based on the type. The ibcp program command lines options have changed as shown:
Early in the translator development, the translator only processed expressions. The first four tests only have expressions. This implementation was left in the code and was changed to be activated only if an expression only flag is passed to the translator. The old test code set this flag for the first four tests. To keep things simple, since the file name is being used to detect the type, this was extended by the new expression type.
The expected result files were renamed accordingly. Also, the translator tests were given two digit test numbers, with a leading 0 for the first nine tests, so that these would be processed in order by the regression test scripts. The new test input files were given a ".dat" extension. The code was also modified to not output the ".exe" with the program name in the header of the output so that Windows and Linux output matches. Now the regression test scripts need to be updated.
ibcp -t <testfile>The first command form specifies the test file, which contains the tests inputs. The test code determines the type of file by the beginning of its name (parser, expression, or translator). The file name may contain anything after the type, including any extension. Blank lines and comment lines (first character '#') are ignored. The second command form activates the interactive mode when the program asks for each input for one of the three types. The new expression type needs further explanation.
ibcp -tp|-te|-tt
Early in the translator development, the translator only processed expressions. The first four tests only have expressions. This implementation was left in the code and was changed to be activated only if an expression only flag is passed to the translator. The old test code set this flag for the first four tests. To keep things simple, since the file name is being used to detect the type, this was extended by the new expression type.
The expected result files were renamed accordingly. Also, the translator tests were given two digit test numbers, with a leading 0 for the first nine tests, so that these would be processed in order by the regression test scripts. The new test input files were given a ".dat" extension. The code was also modified to not output the ".exe" with the program name in the header of the output so that Windows and Linux output matches. Now the regression test scripts need to be updated.
Subscribe to:
Posts (Atom)