This project aims to detect semantic conflicts by generating and running test suites on merge scenarios.
- Clone the project locally using the command on your prompt: git clone https://github.com/leusonmario/SMAT
- After cloning, you must rename the configuration file env-config.template.json for env-config.json, and set up the required information for java_home. You must inform the location that Java was installed on your project. In case this environment variable is already configured, you don't need to inform this information again. For more information regarding the configuration, please refer to the configuration documentation.
- Next, you must inform the path of the file with the list of merge scenarios to be analyzed for the field path_hash_csv. Bellow, we provide further information to use the dataset we used to perform our study.
- Our scripts require Python 3.6.x. In case you are running the scripts on a Linux terminal, you can just call the semantic_study.py file (python3 semantic_study.py). As a result, the file semantic_conflict_results.csv and the folder output-test-dest grouping the generated test suites will be created.
- Clone the project MergeDataSet locally.
- Next, perform a checkout for the commit c8b965f.
- Finally, run the script get_sample.py.
- As a result, the file results_semantic_study.csv will be created. If you want to analyze other merge scenarios, you must provide a file the same information provided in our dataset.
SMAT allows the user to provide many scenarios for analysis using a JSON file. This JSON file consists of an array including each scenario that's going to be evaluated. The JSON file has the following structure:
[
{
"projectName": "spring-boot",
"runAnalysis": true,
"scenarioCommits": {
"base": "7578f2f824aac027529878810b76ee176b39e73a",
"left": "0d00039ae7d01538de3f813b17d125dc5fdd5706",
"right": "1c21f54bf91283d70e04c49ea09a4c05a885d7ac",
"merge": "3eebbe1c8aed529e6903e78476492592ce0b0049"
},
"targets": {
"org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory": [
"createDeploymentManager(org.springframework.boot.context.embedded.ServletContextInitializer[])"
]
},
"scenarioJars": {
"base": "/home/jpedroh/Projetos/cin/testes-smat/spring-boot/7578f2f824aac027529878810b76ee176b39e73a-createDeploymentManager.jar",
"left": "/home/jpedroh/Projetos/cin/testes-smat/spring-boot/0d00039ae7d01538de3f813b17d125dc5fdd5706-createDeploymentManager.jar",
"right": "/home/jpedroh/Projetos/cin/testes-smat/spring-boot/1c21f54bf91283d70e04c49ea09a4c05a885d7ac-createDeploymentManager.jar",
"merge": "/home/jpedroh/Projetos/cin/testes-smat/spring-boot/3eebbe1c8aed529e6903e78476492592ce0b0049-createDeploymentManager.jar"
},
"jarType": "transformation"
}
]
The scenarios file path can then be informed in the env-config.json
file using the input_path
field.
If you use Windows as your operating system, when you clone this project, you will probably receive an error message due to the size of a few file names. This problem will make it impossible for you to clone this repository.
To resolve this, you must install the Windows Subsystem for Linux (WSL); just follow the steps outlined in this guide. At the end of the installation, just open the Linux terminal on your Windows and clone the project as usual.
To execute the project, we advise you to use VSCode, because it has extensions to integrate with WSL. Once WSL is installed, when opening VSCode, a message will be displayed to download the Remote - WSL extension. With it, it is possible to edit all the files that are in WSL through VSCode and execute the project via terminal.