Home

Awesome

How to use Test-Suite

Test-Suite is a micro-benchmark suite designed for validating various static analysis algorithms (particularly pointer analyses and static bug checkers) developed in SVF. It includes around 400 hand-written programs and code snippets. Test-Suite provides flexible and extendable interfaces for users to add their own tests for validating the correctness of different static analyses.

Download SVF and execute the following commandline under SVF's root directory. build.sh will build SVF and run SVF's analyses against the test cases if Test-suite folder is present.

git clone https://github.com/SVF-tools/SVF.git
cd SVF
git clone https://github.com/SVF-tools/Test-Suite
source ./build.sh
cd Release-build
ctest

The following gives the Test-Suite's folders and the corresponding SVF's options for validation.

FolderSVF optionDescription
basic_c_testswpa -ander -stat=falsebasic test cases for C programs (flow-insensitive and field-sensitive analysis)
basic_cpp_testswpa -ander -stat=falsebasic test cases for C++ programs (flow-insensitive and field-sensitive analysis)
fs_testswpa -fspta -stat=falseflow-sensitive tests
cs_testsdvf -cxt -print-pts=false -stat=falsecontext-sensitive tests
path_testspath-sensitive tests
complex_testswpa -ander -stat=falsecomplex test cases simplified from real programs
mtamultithreaded test cases
mem_leaksaber -leak -valid-tests -mempar=inter-disjoint -stat=falsememory leak test cases
double_freesaber -dfree -valid-tests -stat=falsedouble free test cases

Scripts

Travis CI is used to build all the test cases, It uses ./generate_bc.sh to do so and then pushes the compiled test cases into master branch.

All tests are specified in CMakeLists.txt file. The CMakeLists.txt file uses foreach loops to specify tests in bulk. To add new tests append a command and specified folder into the respective commands list and folders list in CMakeLists.txt An example of a test:

add_test(
  NAME basic_c_tests/CI-funptr.c
  COMMAND wpa -ander -stat=false ${CMAKE_CURRENT_SOURCE_DIR}/test_cases_bc/basic_c_tests/CI-funptr.c.bc
  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${CMAKE_BUILD_TYPE}-build/bin
)

For differential testing of two options a C++ script diff_tests.cpp is used. This script will run each option, compare the results and output. If the output is 0 then the test passed.