Download MuCPP

MuCPP has been legally registered in the "Registro Territorial de la Propiedad Intelectual de la Junta de Andalucía" with the code: CA-452-14

Downloads:

Installation on Ubuntu

Steps:
  1. Download LLVM Clang libraries:
  2. Mucpp is available in different versions of Clang: 14/15, 10 and 3.6.

    Clang installation: Clang 14 is the default version in Ubuntu 22.04. Therefore, the following command will install the required libraries for this version:
     sudo apt install clang libclang-dev
    If you choose to install another Clang version (e.g., clang 15), add the version as follows:
     sudo apt install clang-15 libclang-15-dev

    Note: since the name of the binary files installed will contain the version, it is recommended to create a simbolic link to use the binaries without the version as follows:

     sudo ln -s /usr/bin/clang-15 /usr/bin/clang
    sudo ln -s /usr/bin/clang++-15 /usr/bin/clang++
    sudo ln -s /usr/bin/llvm-config-15 /usr/bin/llvm-config

    Change the version everywhere it appears in the above and below commands in case you choose to install MuCPP with a specific version of Clang (15, 14, 10, 3.6).

  3. Install the version control system git:

  4.  sudo apt-get install git

    Configure git setting your name and email:

     git config --global user.name "Your name"
    git config --global user.email "Your email"
    Further information on how to use Git can be found in Section "Handling mutants with Git".

  5. Make sure the Make utility is intalled:

  6.  sudo apt install make
  7. Download the appropriate MuCPP file according to the selected Clang version (see section "Download") and unzip the file:
  8. MuCPP for Clang-14 version:
     cd download_directory
    mv mucpp-14.gz mucpp.gz
    gzip -d mucpp.gz
  9. Check that the executable of MuCPP (mucpp) has execution permission:

  10.  ls -l mucpp
    chmod +x mucpp
  11. Copy the executable of MuCPP to /usr/bin:

  12.  sudo cp mucpp /usr/bin
NB:
  • Please note that, if you do not follow these steps, you may find error messages when using the tool about missing headers files because Clang may not be able to locate the path to built in header files. In case you get this kind of errors, you should add the "Clang include directory" when using the tool through the -isystem option (see "Analyze" in Section "Requirements").
    This directory usually is:
    dirname $(which clang++)/../lib/clang/CLANG_VERSION/include   where CLANG_VERSION depends on the installed Clang version.

Please, go to the following page to obtain further information: Click here.

After these steps, the example program "cars.tar.gz" can be downloaded and unzipped to check the correct installation of the mutation tool (see Section "Example program" to observe an example of the usage of the tool).


Test suite execution

Along with MuCPP, a library for the execution of tests is provided. If you want to use it, you will need to download "tests_execution.tar.gz", unzip it and add the files ("TestLib.a" and "test_functions.h") to the directory of your program (see Section "Test suite execution with the provided library"). The example program "cars.tar.gz" uses this library to execute the tests.

First, go to section "Requirements" to prepare the system under test correctly for the execution of the test suite. If you prefer to use your own test suite library or other testing framework, you will need to create an additional script in order to report the results of the test suite execution to MuCPP (in order to create the file "tests_output.tmp" properly).

This library automatically generates the files ("tests_output.tmp" and times_output.tmp") that MuCPP needs. The file "tests_execution.tar.gz" includes:
  • The library "TestLib.a".
  • The header file called "tests_functions.h".
The library "TestLib.a" defines a class "TestFunctions". An object of this class can be constructed passing three arguments:
  1. First argument: whether a time measurement of the test suite execution is undertaken (the results will be saved in "times_output.tmp") or not. In this library, the time is measured in nanoseconds.
  2. Second argument: to set a timeout (in seconds) so that a test case ends after the specified time. If the timeout is correctly set, it will indicate that a test case is taking too much time to perform and, therefore, an anomalous behavior is taking place.
  3. Third argument: to indicate whether the test suite execution should continue or not once a test case fails.
Note:
  • The mutants for which the command "mucpp_test" fails cannot be executed against the test cases. In case that the third argument is set to true, only a value 1 will be shown for those mutants.
The class "TestFunctions" contains the next four public methods:
  • test_case starts the execution of the test case received as argument.
  • has_failed indicates if the last test case executed has failed.
  • continue_execution returns the third argument provided when constructing the object "TestFunctions", indicating if the tester wants the test suite execution to continue, even when the last test case has failed.
  • set_timeout sets a new timeout; it will be applied to the rest of test cases.
In addition, "tests_functions.h" contains the following function to use within the body of a test case:
  • check_test_case receives a value as argument. A value "0" means that the test case is not passed and its execution ends. Otherwise, the test case continues its execution.