Contents

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)

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 to 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%)

Another task which is done during the prepare phase of the tool is the creation of a clean wine prefix.
This wine prefix will be used by testcases of the type compile_and_run and custom and is created in a temporary folder (/tmp/wine_mingw_testsuite_XXXXXX) which will automatically be cleaned up once all testcases are executed.
While creating this wine prefix several symbolic links will also be created from %{mingw32_bindir}/*.dll to $WINEPREFIX/drive_c/windows/syswow64/ and %{mingw64_bindir}/*.dll to $WINEPREFIX/drive_c/windows/system32/.
Due to this testcases can also be executed which depend on dll's provided by mingw packages (like libstdc++-6.dll and libglib-2.0-0.dll)

This shows all testcases which are available for the target mentioned in the ./configure call and the result of each testcase. Failed testcases can also be seen here.

With just the command ./fedora_mingw_testsuite only brief output is shown. To show more detailed information, you can call the program with the --verbose argument.

To generate the XML and HTML reports you can use the command make full-report. This generates two files called full-report.xml and full-report.html. These files can be processed further with other tools/scripts.

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.