In-class exercise Delta Debugging

High-level goal

Delta debugging is a technique for minimizing input files – typically failing test cases, to find a smaller input with the same behavior.

The high-level goal of this exercise is to learn about automated debugging and how to use the delta debugging approach to systematically minimize (“isolate”) failure-inducing inputs.

Background (story time)

Your company uses a sorting program named mysort.pl. The program works most of the time, but a user ran into a problem with it. In the spirit of following best practices, they provided instructions with a concrete test case that shows the problem: a file named failing.txt.

You have been assigned to fix this bug. The source code is unintelligible (it’s written in Perl, after all), so you decide to minimize the test input in hopes of easing the debugging task or giving hints about the underlying defect.

A delta-debugging implementation is provided in the repository. Your goal in this exercise is to apply delta debugging to the input failing.txt.

Set up

  1. Find your preassigned teammate on the Canvas Group
  1. Use a Unix environment (e.g., attu.cs.washington.edu, macOS, or WSL) or git bash for Windows.

  2. Clone the following Git repository: https://bitbucket.org/rjust/delta-debugging (Clone the repository into a directory whose absolute path does not contain any white spaces.)

Instructions

  1. Read the entire assignment and ask any clarifying questions that you might have.

  2. In the top-level directory (delta-debugging), run:

  3. Use delta debugging to minimize failing.txt. Here are the steps to do so:

    Hints:

    If you can’t get your interestingness test script to work within 15 minutes, ask the staff for help and move on.

  4. The minimized test input is stored in file min.txt. Verify that mysort.pl does not terminate. Using min.txt, debug and fix the issue in mysort.pl. (See Questions 1-3 below.)

    Hints about Perl:

  5. Manually create two test input files that trigger the problem in the original mysort.pl and that have the following properties (see Question 4 below) :

    Delta debugging implementations differ in the order in which they evaluate subsets and complements of the input. Validate your test inputs for the provided delta-debugging implementation.

Questions

  1. What is the root cause of the bug in mysort.pl?

  2. Give a one sentence explanation to characterize all test inputs (input files, or equivalently input lists) on which mysort.pl fails because of the root cause in Question 1.

  3. Provide a fix to the bug as a unified diff (use git diff).

  4. Provide your two four-line test inputs and:

Tips

  1. Carefully look at the documentation at delta/doc/using_delta.txt, and make sure you understand the example under /delta/test/delta0. Your understanding is crucial for building your test for this activity.

  2. You do not need to follow the README.md file under directory delta/; the files are already unzipped and ready to use. However, note that actual file names are inconsistent with what has been mentioned in the documentation. in.c should be hello.c, and testit should be hello.test.

  3. If you do not want to add delta command to your path, use ./delta/bin/delta instead, as what ‘dd-wrapper.sh’ does.

  4. You may construct your interestingness test script in any language, but a bash script is enough for this activity and is arguably the simplest one. The structure would be similar to the one for the example provided at delta/test/delta0/hello.test. The course staff has provided some other information about bash scripting that you might find helpful for this exercise.

  5. If you encounter issues with permission when executing ./dd-wrapper.sh or running command, for example error message like [0,500] 000.csh: /path/to/test_mysort.py: Permission denied, try to give your test file permission chmod +x /path/to/your.test.

Deliverables

  1. A plain-text file with your answers to the four questions above. Please list all group members.

  2. The interestingness test script you wrote.

Steps for turn-in

One team member should upload the deliverables to Canvas, via the Canvas submission site for this course.