generated from snapcrafters/snap-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I added two convenience scripts: - klee.env to get the flags you need to compile. Those flags do not include optimization/debug symbols flags as they are up to the user. - klee.run to run a klee testcase without having to manually setup the environment.
- Loading branch information
Showing
4 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
_klee_env() | ||
{ | ||
local cur prev | ||
|
||
COMPREPLY=() | ||
cur=${COMP_WORDS[COMP_CWORD]} | ||
|
||
_expand || return 0 | ||
|
||
case "$cur" in | ||
-*) | ||
COMPREPLY=( $( compgen -W '-h --help' -- "$cur" )) | ||
;; | ||
*) | ||
COMPREPLY=( $( compgen -W 'CFLAGS LDFLAGS' -- "$cur" )) | ||
;; | ||
esac | ||
|
||
return 0 | ||
} && | ||
complete -F _klee_env $nospace $filenames klee.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
function print_help() { | ||
res=${1:-0} | ||
echo "Usage klee.env [FLAGS] VARIABLES" | ||
echo "Prints the variables needed to compile klee programs" | ||
echo "" | ||
echo "Available FLAGS:" | ||
echo " -h, --help Display this help and exit." | ||
echo "" | ||
echo "Available VARIABLES:" | ||
echo " CFLAGS returns the flags to pass to clang or gcc with" | ||
echo " include/lib paths to compile a klee program." | ||
echo " LDFLAGS returns the link flags to pass to clang or gcc" | ||
echo " to link a klee program, so that it can run the" | ||
echo " testcases generated by a klee run." | ||
echo "" | ||
exit $res | ||
} | ||
|
||
DIR="$( realpath "$( dirname -- "${BASH_SOURCE[0]}"; )/.." )" | ||
|
||
command= | ||
|
||
while [ "$1" != "$EOL" ]; do | ||
opt="$1"; shift | ||
case $opt in | ||
-h | --help) print_help;; | ||
* ) command=$opt;; | ||
esac | ||
done | ||
|
||
|
||
case $command in | ||
CFLAGS ) | ||
echo "-I $DIR/include -L $DIR/lib" | ||
;; | ||
LDFLAGS) | ||
echo "-lkleeRuntest" | ||
;; | ||
* ) | ||
>&2 echo "Error: unknown variable $command" | ||
print_help 1 | ||
;; | ||
esac | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
function print_help() { | ||
res=${1:-0} | ||
echo "Usage: klee.run TESTCASE COMMAND..." | ||
echo "Run a klee TESTCASE for COMMAND" | ||
echo "" | ||
exit $res | ||
} | ||
|
||
DIR="$(realpath "$( dirname -- "${BASH_SOURCE[0]}"; )/.." )" | ||
|
||
if [ $# -lt 2 ] | ||
then | ||
>&2 echo "Error: TESTCASE and COMMAND are required" | ||
print_help 1 | ||
fi | ||
|
||
testcase=$1 | ||
shift | ||
command=$1 | ||
shift | ||
|
||
LD_LIBRARY_PATH="$DIR/lib/:$LD_LIBRARY_PATH" KTEST_FILE="$testcase" $command $@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters