Skip to content

Commit

Permalink
change script
Browse files Browse the repository at this point in the history
  • Loading branch information
ladisgin committed Feb 21, 2024
1 parent 764a175 commit 6d162a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 7 additions & 3 deletions scripts/run_tests_with_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This script builds executable file using initial bitcode file and artifacts produced by KLEE.
# To run the script provide all the arguments you want to pass to clang for building executable.
#
# NOTE: First argument is path to clang compiler
# NOTE: First argument is path to compiler
# NOTE: Pre-last argument should be a path to KLEE output directory which contains redefinitions.txt and externals.ll.
# NOTE: Last argument is path to initial bitcode.
#
Expand All @@ -22,6 +22,10 @@
object_file = f'{filename}.o'
sp.run(f'llc {bitcode} -filetype=obj -o {object_file}', shell=True)
sp.run(f'llvm-objcopy {object_file} --redefine-syms {klee_out_dir}/redefinitions.txt', shell=True)

externals = f'{klee_out_dir}/externals.o'
sp.run(f'llc {klee_out_dir}/externals.ll -filetype=obj -o {externals}', shell=True)

clang_args = ' '.join(sys.argv[1:len(sys.argv) - 2])
print(f'{clang_args} {klee_out_dir}/externals.ll {object_file}')
sp.run(f'{clang_args} {klee_out_dir}/externals.ll {object_file}', shell=True)
print(f'{clang_args} {externals} {object_file}')
sp.run(f'{clang_args} {externals} {object_file}', shell=True)
7 changes: 4 additions & 3 deletions test/Replay/libkleeruntest/replay_mocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
// RUN: %clang %s -emit-llvm -g %O0opt -c -o %t.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --mock-policy=all %t.bc
// RUN: %clang -c %t.bc -o %t.o

// RUN: %llc %t.bc -filetype=obj -o %t.o
// RUN: %llc %t.klee-out/externals.ll -filetype=obj -o %t_externals.o
// RUN: %objcopy --redefine-syms %t.klee-out/redefinitions.txt %t.o
// RUN: %cc -no-pie %t_externals.o %t.o %libkleeruntest -Wl,-rpath %libkleeruntestdir -o %t_runner
// RUN: test -f %t.klee-out/test000001.ktest
// RUN: env KTEST_FILE=%t.klee-out/test000001.ktest %t_runner

// RUN: %runmocks %cc -no-pie %libkleeruntest -Wl,-rpath %libkleeruntestdir -o %t.klee-out/b.out %t.klee-out %t.bc
// RUN: %runmocks %cc -no-pie %libkleeruntest -Wl,-rpath %libkleeruntestdir -o %t_runner2 %t.klee-out %t.bc
// RUN: test -f %t.klee-out/test000001.ktest
// RUN: env KTEST_FILE=%t.klee-out/test000001.ktest %t.klee-out/b.out
// RUN: env KTEST_FILE=%t.klee-out/test000001.ktest %t_runner2

extern int variable;

Expand Down

0 comments on commit 6d162a0

Please sign in to comment.