No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
* Must be able to run on Fedora 16 and above and RHEL6/CentOS6 | * Must be able to run on Fedora 16 and above and RHEL6/CentOS6 | ||
* Must be easily extendible (without re-compilation of the testsuite tool) | * Must be easily extendible (without re-compilation of the testsuite tool) | ||
* Must the able to hook into [[AutoQA]] | |||
== | == Fedora MinGW Testsuite tool == | ||
In order to create such a testsuite a small tool was created by [[User:Epienbro|Erik van Pienbroek (epienbro)]]. | |||
This is a small (about 1000 lines of code) program written in the C programming language which uses GLib's [http://developer.gnome.org/glib/stable/glib-Testing.html GTester framework]. | |||
With this framework it is possible to easily create test cases and also to make the results available in both machine friendly form (XML) as user-friendly form (HTML reports). | |||
On startup this tool searches it's testcases folder for available testcases and tries to prepare them for execution. | |||
After all available testcases are prepared the testsuite is executed and the results are printed in the console or in a XML/HTML file (depending on how the tool was executed). | |||
During the prepare phase the following tasks are done for each testcase: | |||
* Parse the contents of the testcase file | |||
* | * Make sure that the host is able to execute the testcase (it doesn't make sense to run mingw-w64 specific testcases when there are no mingw-w64 available on the host) | ||
* | * Replace any possible placeholders with the truly expected data (like %TARGET% and %TESTCASESDIR%) | ||
* | |||
== | == Testcase file format == | ||
A testcase always consists of one | A testcase always consists of one text file which describes the testcase. | ||
This file is using the INI-file style for its contents and must have the suffix'' '.testcase' ''in order to be recognized by the testsuite tool. | This file is using the [http://en.wikipedia.org/wiki/INI_file INI-file style] for its contents and must have the suffix'' '.testcase' ''in order to be recognized by the testsuite tool. | ||
Testcases have to be placed in the 'testcases' folder which is part of the [http://svn.openftd.org/svn/fedora_mingw_testsuite/trunk/ Fedora MinGW Testsuite tool]. | |||
Examples for the various testcase types are shown in the sections below | |||
All testcases belonging to the Fedora MinGW Testsuite must contain a section named'' 'mingw_testcase' ''. | All testcases belonging to the Fedora MinGW Testsuite must contain a section named'' 'mingw_testcase' ''. | ||
Line 72: | Line 64: | ||
Only one input key-value pair and one output key-value pair are required. It is recommended to use the '*_text' keys for single-line strings and the '*_file' keys for multi-lines. | Only one input key-value pair and one output key-value pair are required. It is recommended to use the '*_text' keys for single-line strings and the '*_file' keys for multi-lines. | ||
Here's an example of such a testcase (the file shown is named ''[http://svn.openftd.org/viewvc/Fedora%20MinGW%20Testsuite/trunk/testcases/macro_mingw32_configure.testcase?view=markup macro_mingw32_configure.testcase]''): | |||
[mingw_testcase] | |||
type=rpm_parser | |||
input_text=%{_mingw32_configure} | |||
expected_output_file=mingw32_configure_output.txt | |||
=== Type 'compile_and_run' === | === Type 'compile_and_run' === |
Revision as of 16:15, 30 November 2011
MinGW Testsuite
Introduction
At the moment (November 2011) there is no automated method to check the state of the MinGW toolchain which is in Fedora. There's a good possibility that regressions get slipped in and only get discovered after some time.
To prevent these kind of issues we need to have an automated testsuite which can test various parts of the Fedora MinGW toolchain.
Such a testsuite can eventually be hooked in AutoQA so automated testing will be done automatically as soon as something is changed in one of the Fedora MinGW packages.
Requirements
- Must support both the current mingw.org-based toolchain as well as the new mingw-w64-based toolchain
- Must support both win32 as well as win64 binaries
- Must be able to run on Fedora 16 and above and RHEL6/CentOS6
- Must be easily extendible (without re-compilation of the testsuite tool)
- Must the able to hook into AutoQA
Fedora MinGW Testsuite tool
In order to create such a testsuite a small tool was created by Erik van Pienbroek (epienbro). This is a small (about 1000 lines of code) program written in the C programming language which uses GLib's GTester framework. With this framework it is possible to easily create test cases and also to make the results available in both machine friendly form (XML) as user-friendly form (HTML reports).
On startup this tool searches it's testcases folder for available testcases and tries to prepare them for execution. After all available testcases are prepared the testsuite is executed and the results are printed in the console or in a XML/HTML file (depending on how the tool was executed).
During the prepare phase the following tasks are done for each testcase:
- Parse the contents of the testcase file
- Make sure that the host is able to execute the testcase (it doesn't make sense to run mingw-w64 specific testcases when there are no mingw-w64 available on the host)
- Replace any possible placeholders with the truly expected data (like %TARGET% and %TESTCASESDIR%)
Testcase file format
A testcase always consists of one text file which describes the testcase. This file is using the INI-file style for its contents and must have the suffix '.testcase' in order to be recognized by the testsuite tool. Testcases have to be placed in the 'testcases' folder which is part of the Fedora MinGW Testsuite tool.
Examples for the various testcase types are shown in the sections below
All testcases belonging to the Fedora MinGW Testsuite must contain a section named 'mingw_testcase' . In this section a key named 'type' is also required. The value belonging to this key can be used to identify the type of test which needs to be executed. At the moment the following types are valid:
- rpm_parser
- compile_and_run
- custom
Depending on the type of the testcase one or more additional key/value pairs need to be set
Type 'rpm_parser'
Testcases for the type 'rpm_parser' need to provide an input text and an output text. The input text is the RPM code which needs to be processed by the RPM parser. The output text is the RPM code as returned after being processed by the RPM parser. The testcase will be successful when the output from the RPM parser is the same at the expected output.
The following keys are supported:
- required: input_text - string - The RPM code which needs to be processed by the RPM parser
- required: input_file - string - A textfile containing the RPM code which needs to be processed by the RPM parser
- required: expected_output_text - string - The output which is expected
- required: expected_output_file - string - A textfile containing the output which is expected
Only one input key-value pair and one output key-value pair are required. It is recommended to use the '*_text' keys for single-line strings and the '*_file' keys for multi-lines.
Here's an example of such a testcase (the file shown is named macro_mingw32_configure.testcase):
[mingw_testcase] type=rpm_parser input_text=%{_mingw32_configure} expected_output_file=mingw32_configure_output.txt
Type 'compile_and_run'
The following keys are supported:
- required: source_file - string - The file name of the file which needs to be compiled
- required: run_binary - boolean - Whether this testcase only needs to compile the binary (false) or whether it needs to be compiled and executed (true)
- optional: cflags - string - Any additional CFLAGS which need to be used to compile this testcase
- optional: ldflags - string - Any additional LDFLAGS which need to be used to compile this testcase
- optional: expected_stdout_text - string - The stdout output which is expected when the binary is executed
- optional: expected_stdout_file - string - A textfile containing the stdout output which is expected when the binary is executed
- optional: expected_stderr_text - string - The stderr output which is expected when the binary is executed
- optional: expected_stderr_file - stirng - A textfile containing the stderr output which is expected when the binary is executed
Only one input key-value pair and one output key-value pair are required. It is recommended to use the '*_text' keys for single-line strings and the '*_file' keys for multi-lines.
Type 'custom'
Source code
All development is being done in a SVN repository for the time being. The checkout URL is http://svn.openftd.org/svn/fedora_mingw_testsuite/trunk A SVNWeb instance for this SVN repository can be found at http://svn.openftd.org/viewvc/Fedora%20MinGW%20Testsuite/