Week 5 (6/17 - 6/21)
After realizing a mistake in my methodology, I reworked last week’s task and moved on to converting all non-Maven projects in Defects4J into Maven projects. Many Defects4J projects are non-Maven, primarily using Ant and Gradle. Converting these projects to Maven will enable me to run PITest (PIT) for mutation testing.
Progress Update for this Week:
- 6/17/2024
- Completed last week’s task, recording all the patches that did not apply and/or failed the test suite. This task took several days to complete, especially since many patches required significant CPU time to process. I sent my findings to Dr. Ghanbari, who plans to discuss them tomorrow during our weekly group meeting.
- 6/18/2024
- Through discussions in the group meeting, I identified a minor flaw in my methodology. I had been checking out each buggy program once and applying all of its patches successively to the same instance. This approach was incorrect because, once a patch is applied, the program is no longer in its original state. Applying subsequent patches to an already modified program will lead to erroneous results.
- 6/19/2024
-
I revised my methodology for applying patches. To improve the performance, I developed the following Bourne Shell Script:
# Base directory containing the extracted dataset base_dir="/home/jwangj001/patches-dataset" # Loop through each project directory for project_dir in "$base_dir"/*; do if [ -d "$project_dir" ]; then echo "Processing project directory: $project_dir" # Extract the project name and number from the directory name dir_name=$(basename "$project_dir") project_name=$(echo "$dir_name" | cut -d'-' -f1) project_number=$(echo "$dir_name" | cut -d'-' -f2) # Define the working directory for defects4j checkout work_dir="${project_dir}/${dir_name}" # Loop through each patch in the project directory for patch_file in "$project_dir"/*.patch; do if [ -f "$patch_file" ]; then echo "Applying patch: $patch_file" # Remove any existing work directory to ensure a fresh checkout rm -rf "$work_dir" # Checkout the buggy program defects4j checkout -p "$project_name" -v "${project_number}b" -w "$work_dir" # Change to the working directory cd "$work_dir" || exit # Apply the patch git apply --ignore-space-change --ignore-whitespace "$patch_file" # Run Defects4J test defects4j test # Change back to the base directory cd "$base_dir" || exit fi done fi done
-
With this change in methodology, the result is what we looked for, and the script significantly improved the performance.
-
- 6/20/2024
- I shared the latest findings with Dr. Ghanbari, and he confirmed that this is what he was looking for. This task was successfully completed.
- 6/21/2024
-
Began working on converting all non-Maven projects in Defects4J into Maven projects. To check the form of each project, I developed the following Bourne Shell Script:
for bug in $(ls); do if [ -d "$bug" ] && [[ ! "$bug" =~ \.sh$ ]]; then if [ -f "$bug/pom.xml" ]; then echo "$bug is a Maven project" elif [ -f "$bug/build.xml" ]; then echo "$bug is an Ant project" elif [ -f "$bug/build.gradle" ]; then echo "$bug is a Gradle project" else echo "$bug does not have recognized build files" fi fi done
Executing this script, I observed that all of the projects were already in Maven form. I feel confident that I completed this task. Looking ahead to next week, I anticipate applying PIT for mutation testing across every project.
-