Skip to content

Instantly share code, notes, and snippets.

@ChrisTimperley
Last active May 9, 2022 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisTimperley/330a626bac68352e46fb3a95d273a25d to your computer and use it in GitHub Desktop.
Save ChrisTimperley/330a626bac68352e46fb3a95d273a25d to your computer and use it in GitHub Desktop.

Workflow

  1. Copy original version of the program from versions.alt/versions.orig/vK to source.
  2. Compile original code by executing make build in the source directory.
  3. Execute test suite against original version of the object, saving the results to outputs for future reference.
  4. Clear the contents of the source directory.
  5. Copy the appropriate seeded version of the program from versions.alt/versions.seeded/vK to source.
  6. Inject the desired fault(s) in the program by removing the appropriate comment markers in source/FaultSeeds.h.
  7. Compile the program by calling make build in the source directory.
  8. Execute the test suite against the faulty program and compare the outputs against the oracle outputs saved in outputs.alt.

Using MTS to Generate the Test Suite

Thanks to: http://sir.unl.edu/content/mts-usage.php

# example of using mts:
# mts <object-dir> <object-exe> <universe-file> <script-type> <script-name> <program-suffix> <compare-dir>
#
# go to the scripts/ directory of the program
mts .. ../source/grep.exe ../testplans.alt/universe R test.sh NULL NULL

Building for GenProg - Case Study: Grep-v0

cd grep

# copy original program to source directory
cp -r versions.alt/versions.orig/v1/* source

# build original program
(cd source; make build)

# generate expected test case outputs, then move them to outputs.alt
(cd scripts; mts .. ../source/grep ../testplans.alt/v1/v0_2.tsl.universe R test.sh NULL NULL; ./test.sh)
mv outputs/* outputs.alt

# copy faulty program to source directory
rm -rf source/*
cp -r versions.alt/versions.seeded/v1/* source

# inject the desired fault by uncommenting it in source/FaultSeeds.h
# should be able to automate using sed
sed ....

# build faulty program
(cd source; make build)

# build the test script for the faulty program (compares outputs)
rm -f scripts/test.sh
(cd scripts; mts .. ../source/grep ../testplans.alt/v1/v0_2.tsl.universe D test.sh NULL ../outputs.alt)

# Find out which test cases were failed...
(cd scripts; ./test.sh)
@smjunaid-it
Copy link

@ChrisTimperley Sir, can you kindly guide me how can I install mts in linux mint?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment