SPL Overlaying Faults
1. Source Code Overlays
Since some SPL objects can utilize preprocessor directives to implement the composition of the end-products the normal process of placing cpp directives into a copy of the original source file may interfere with the SPL product build process. To avoid this an alternative method is to create a subdirectory for each fault and put the fault containing source file into a directory tree that is exactly the same as the unmodified version of the SPL source directory. Using this method the directory tree and source file can then be copied directly over the original version and the file containing the fault overwrites the original source file.
Example:
If your source code has a A.java and B.java having the following directory tree in the original version:
object_experiment_root_directory
|_______verisions.alt
|________orig
|_______ v0
|_______componentA
|_______ src
|______componentA
| |__________A.java
|
|______componentB
|__________B.java
The faulted version of A.java (and only this file) containing the first fault
would then be placed under the versions.alt/seeded/vK directory
branch using a subdirectory at the same level as the source
directory and the original source directory name appended with the fault number.
This "sparse" directory structure should maintain the
subdirectory pathing of the original object's directory tree
with the only fault containing source file present in the tree.
A tree diagram of the overlay method would look like this:
object_experiment_root_directory
|_______verisions.alt
|________seeded
|________v1
| |_______ object-project-name // original code tree
| | |______src
| | | |______componentA
| | ... | |__________A.java // original sources
| | | |__________another_source_file.java
| | | |
| | | ...
| | |
| | \______componentB // original sources
| | |__________B.java
| | |__________more_source.java
| | |
| | ...
| |
| |_______object-project-name_1 // fault 1 directory
| | \______src
| | \______componentA
| | \___________A.java // faulted version of A.java
| |
| |_______object-project-name_2 // fault 2 directory
| | \______src
| ... \______componentB
| \___________B.java // faulted version of B.java
|________v2
| |_______object-project-name
| | |______src
| | | |_____componentA
| | ... | \____________A.java
| | | |__________another_source_file.java
| | | |
| | | ...
| | \_____componentB
| | |__________B.java
| | |__________more_source.java
| | |
... ... ...
This is a generalized representation. SPL objects in the repository should
reflect the original structure of the directories under the object-project-name
directories to enable reuse of the original build scripts.
The contents of the original object-project-name directory should have
all the source files needed to build the end-products with the possible exception
of any configuration files used to define the products. These configuration
definition files will be stored in a the configurations directory.
It should be noted that the base (unfaulted) version of the source need
not be stored in the seeded directory tree when the overlay
method is used because it is available under the orig directory
tree already. Eliminating it from this branch can reduces the disk storage
required for the collection at the expense of a more commplicated fault
installation process. If the unfaulted version is not present in this
directory then a CONTENTS or README file should indicate the location
of the unfaulted versions used and scripts provided that automate the
fault insertion procedures.
1.1. Activating the fault
To activate the fault a build script would copy the non-faulted original
version into the versions or source directory.
Once in place, the faulted version of source code can be copied over this
original version of the source. Once copied, the compose/build step can be
performed on this collection of source files to make the end-products.
1.2. Fault localization
SPL objects that use the overlay technique are still required to provide
a FaultSeeds.h and a FaultSeeds.org file
to indicate the actual fault/file location. The fault numbering applied
to the directory names (see above) should be based upon the order the faults
appear in the FaultSeeds.h file.