Setting
Autofix is an automated program fixing tool that targets Eiffel code.
In order to use Autofix to try to repair the programs provided in the IntroClass benchmark, we have to translate each program from C to Eiffel language. Since AutoFix requires contracts for program fixing, we replaced the input/output sentences in the original IntroClass, which received inputs and produced outputs from/to standard input/output, to programs that received inputs as parameters and produced outputs as return values. We equipped the resulting programs with the correct contracts for pre- and post-conditions of each case study.
In this translation from C to Eiffel, several faulty programs became "correct" as a result of the translation. These cases have to do with default values for variables and with how input is required and output is produced; for instance, faulty cases that reported output values with accompanying messages in lowercase, when they were expected to be uppercase, are disregarded since in Eiffel translated programs outputs are produced as return values.
The translation was performed following the next steps:
1. We replace input/output sentences with a routine that takes the inputs as parameters and returns the output values.
2. We translate the C programs to the CIL language (C Intermediate Language).
3. Afterwards, we translate the CIL programs to Eiffel using the C2Eif tool.
4. Finally, we added the contacts (pre and post conditions) to each of the programs and fixed manually some minor issues generated by the tools during the automated translation.
At the end of this page, we provide the Eiffel version for each program (introclass-eiffel.zip), so you can reproduce the Autofix experimental evaluation. In each case study you find the hashnames.txt file and three folders: fixed, no_fixed, and no_fault. The hashnames.txt file contains a list explaining to which IntroClass hash name corresponds to each of the Eiffel programs. The no_fixed folder contains all the Eiffel programs for which Autofix was not able to generate a valid fix (almost every Eiffel program is in this folder). The fixed folder contains the Eiffel programs for which Autofix was able to generate a valid fix (i.e., it does not violate the contracts). The no_fault folder contains all the programs for which Autotest does not produce a test that violates the contracts, so then, Autofix does not try to fix it (because there is nothing to fix).
Reproducibility
Initially, compile the programs you want to try to fix by using Autofix.
Then, open the Autofix toolbar by pressing the option View -> Tools -> Autofix.
In this window, you can set, for instance, the time used for testing, the number of passing and failing tests used in the fixing procedure, the time used for fixing the buggy programs, and select if Autofix is able to propose fix candidates for the implementation or/and contracts. In our case, we assume the contracts as corrects, so we only allow to Autofix to propose fixes for the program implementations.
Then, you have to add the classes for which Autofix will apply its fixing process, and press the "Start AutoFixing" button.
You can see the partial outcome while Autofix is running in the Output tab.
In the Faults tab, you can see the number of failing tests (i.e., tests that violate the contracts) that were generated by AutoTest for each class. In addition, you can see the number of candidates generated by Autofix that will be checked later if they are or not effective fixing.
In the Fixes tab, Autofix reports all the candidates fixes generated that were not discarded, and shows the different options available to fix the corresponding program.