Git Product home page Git Product logo

llvm-mutate-passes's Introduction

Dependencies required for the wrapper script: CMake 3.16+, LLVM 9+, opt, llc, pytest

How to use wrapper script to generate mutants and test them against a test suite: Expected Usage : python3 mutateWrapper.py <filename relative path> <test suite marker> <opcode to modify> <category>

<opcode to modify> must be a llvm opcode

<category> must be one of the following: "binop", "icmp"

Example Usage: python3 mutateWrapper.py exampleprograms/patchedDigit.c digit add binop

Example Usage: python3 mutateWrapper.py exampleprograms/patchedDigit2.c digit add binop

Example Usage: python3 mutateWrapper.py exampleprograms/patchedDigit3.c digit add binop

Example Usage: python3 mutateWrapper.py exampleprograms/patchedDigit.c digit icmp icmp

Example Usage: python3 mutateWrapper.py exampleprograms/unpatchedDigit.c digit icmp icmp

To add a new test suite: Edit the pytest.ini file with a new marker called {marker}, and then create a pytest file called "test_{filename}.py" and mark test functions with @pytest.mark.{marker}.

Then to test: python3 -m pytest --file {name of executable found in mutants/exampleprograms/}

Or to manually make mutations: Build:

$ cd llvm-pass-skeleton
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cd ..

Run: To run passes that aren't mutate: edit the pass in RegisterMyPass. Ex: static RegisterStandardPasses RegisterMyPass(PassManagerBuilder::EP_EarlyAsPossible, registerLabelPass); Then run: $ clang -Xclang -load -Xclang build/pass/libSkeletonPass.* example.c

_________________________________
To run mutate passes:
1. Emit bc file from source: clang -emit-llvm -o example.bc -c example.c
2. Find instruction number using labelPass: clang -Xclang -load -Xclang build/pass/libSkeletonPass.* example.c
3. Specify instruction location to mutate and mutation operand type and run the mutate pass on bc file: opt -load build/pass/libSkeletonPass.so -mutatePass -mutation_loc=33 -mutation_op=swapplus1toplus2 < functioncall.bc > functioncallnew.bc
4. Create object file from edited bc file: llc -filetype=obj functioncallnew.bc
5. Create executable: clang functioncallnew.o
6. Run executable: ./a.out

llvm-mutate-passes's People

Contributors

jackphong avatar zhongef avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.