Skip to content
Snippets Groups Projects
Commit ff6d1756 authored by Patrick Baudin's avatar Patrick Baudin
Browse files

[tests] using %{bin:tool} and %{dep:file} features of dune

parent 0ec0b078
No related branches found
No related tags found
No related merge requests found
...@@ -21,13 +21,18 @@ ...@@ -21,13 +21,18 @@
# # # #
########################################################################## ##########################################################################
# Accept '-check' to avoid issues with ptests WORKING_DIR="."
while [ $# -ge 1 ] && [ "$1" = "-check" ]; do while [ "$1" != "" ] ; do
shift case "$1" in
-check) shift;;
-C) shift; WORKING_DIR="$1";;
*) break;;
esac
shift
done done
usage() { usage() {
echo "usage: $0 cmd [args]" echo "usage: $0 [-C working-dir] cmd [args]"
echo "" echo ""
echo " where cmd is:" echo " where cmd is:"
echo "" echo ""
...@@ -111,6 +116,8 @@ if [ $# -lt 1 ]; then ...@@ -111,6 +116,8 @@ if [ $# -lt 1 ]; then
fi fi
DIR="$( cd "$( dirname "$0" )" && pwd )" DIR="$( cd "$( dirname "$0" )" && pwd )"
cd "$WORKING_DIR"
# All scripts called by frama-c-script may rely on FRAMAC_BIN pointing to the # All scripts called by frama-c-script may rely on FRAMAC_BIN pointing to the
# directory containing frama-c, frama-c-config and frama-c-script. # directory containing frama-c, frama-c-config and frama-c-script.
export FRAMAC_BIN="$DIR" export FRAMAC_BIN="$DIR"
...@@ -118,6 +125,7 @@ FRAMAC_SHARE=$("${DIR}/frama-c-config" -print-share-path) ...@@ -118,6 +125,7 @@ FRAMAC_SHARE=$("${DIR}/frama-c-config" -print-share-path)
if [ -z ${FRAMAC_SESSION+x} ]; then if [ -z ${FRAMAC_SESSION+x} ]; then
FRAMAC_SESSION="./.frama-c"; FRAMAC_SESSION="./.frama-c";
fi fi
command="$1" command="$1"
# [check_path_exists path]: if [path] exists, # [check_path_exists path]: if [path] exists,
......
/* run.config /* run.config
NOFRAMAC: testing frama-c-script, not frama-c itself NOFRAMAC: testing frama-c-script, not frama-c itself
EXECNOW: LOG heuristic_list_functions.res LOG heuristic_list_functions.err bin/frama-c-script heuristic-list-functions true true @PTEST_DIR@/*.c @PTEST_DIR@/*.i > @PTEST_DIR@/result/heuristic_list_functions.res 2> @PTEST_DIR@/result/heuristic_list_functions.err
DEPS: @PTEST_DEPS@ @PTEST_DIR@/for-find-fun.c
DEPS: @PTEST_DEPS@ @PTEST_DIR@/for-find-fun2.c
DEPS: @PTEST_DEPS@ @PTEST_DIR@/for-list-functions.c
DEPS: @PTEST_DEPS@ @PTEST_DIR@/list_functions.i
DEPS: @PTEST_DEPS@ @PTEST_DIR@/main.c
DEPS: @PTEST_DEPS@ @PTEST_DIR@/main2.c
DEPS: @PTEST_DEPS@ @PTEST_DIR@/main3.c
DEPS: @PTEST_DEPS@ @PTEST_DIR@/make-wrapper.c
DEPS: @PTEST_DEPS@ @PTEST_DIR@/make-wrapper2.c
DEPS: @PTEST_DEPS@ @PTEST_DIR@/make-wrapper3.c
DEPS: @PTEST_DEPS@ @PTEST_DIR@/build-callgraph.i
DEPS: @PTEST_DEPS@ @PTEST_DIR@/recursions.i
EXECNOW: LOG heuristic_list_functions.res LOG heuristic_list_functions.err %{bin:frama-c-script} heuristic-list-functions true true @PTEST_DEPS@ > @PTEST_RESULT@/heuristic_list_functions.res 2> @PTEST_RESULT@/heuristic_list_functions.err
*/ */
/* run.config /* run.config
NOFRAMAC: testing frama-c-script, not frama-c itself NOFRAMAC: testing frama-c-script, not frama-c itself
EXECNOW: LOG GNUmakefile LOG make_template.res LOG make_template.err cd @PTEST_DIR@ && PTESTS_TESTING= ../../bin/frama-c-script make-template result < make_template.input > result/make_template.res 2> result/make_template.err DEPS: for-find-fun2.c for-find-fun.c main.c main2.c main3.c
EXECNOW: LOG list_files.res LOG list_files.err bin/frama-c-script list-files @PTEST_DIR@/list_files.json > @PTEST_DIR@/result/list_files.res 2> @PTEST_DIR@/result/list_files.err EXECNOW: LOG GNUmakefile LOG make_template.res LOG make_template.err PTESTS_TESTING= %{bin:frama-c-script} -C @PTEST_DIR@ make-template result < %{dep:@PTEST_DIR@/make_template.input} > @PTEST_RESULT@/make_template.res 2> @PTEST_RESULT@/make_template.err
EXECNOW: LOG find_fun1.res LOG find_fun1.err bin/frama-c-script find-fun main2 @PTEST_DIR@ > @PTEST_DIR@/result/find_fun1.res 2> @PTEST_DIR@/result/find_fun1.err DEPS: main2.c main3.c main.c
EXECNOW: LOG find_fun2.res LOG find_fun2.err bin/frama-c-script find-fun main3 @PTEST_DIR@ > @PTEST_DIR@/result/find_fun2.res 2> @PTEST_DIR@/result/find_fun2.err EXECNOW: LOG list_files.res LOG list_files.err %{bin:frama-c-script} list-files %{dep:@PTEST_DIR@/list_files.json} > @PTEST_RESULT@/list_files.res 2> @PTEST_RESULT@/list_files.err
EXECNOW: LOG find_fun3.res LOG find_fun3.err bin/frama-c-script find-fun false_positive @PTEST_DIR@ > @PTEST_DIR@/result/find_fun3.res 2> @PTEST_DIR@/result/find_fun3.err DEPS: for-find-fun2.c for-find-fun.c for-list-functions.c main2.c main3.c main.c make-wrapper2.c make-wrapper3.c make-wrapper.c
EXECNOW: LOG list_functions.res LOG list_functions.err bin/frama-c-script list-functions @PTEST_DIR@/for-find-fun2.c @PTEST_DIR@/for-list-functions.c > @PTEST_DIR@/result/list_functions.res 2> @PTEST_DIR@/result/list_functions.err EXECNOW: LOG find_fun1.res LOG find_fun1.err %{bin:frama-c-script} find-fun main2 @PTEST_DIR@ > @PTEST_RESULT@/find_fun1.res 2> @PTEST_RESULT@/find_fun1.err
EXECNOW: LOG list_functions2.res LOG list_functions2.err LOG list_functions2.json bin/frama-c-script list-functions @PTEST_DIR@/for-find-fun2.c @PTEST_DIR@/for-list-functions.c -list-functions-declarations -list-functions-output @PTEST_DIR@/result/list_functions2.json -list-functions-debug 1 > @PTEST_DIR@/result/list_functions2.res 2> @PTEST_DIR@/result/list_functions2.err EXECNOW: LOG find_fun2.res LOG find_fun2.err %{bin:frama-c-script} find-fun main3 @PTEST_DIR@ > @PTEST_RESULT@/find_fun2.res 2> @PTEST_RESULT@/find_fun2.err
EXECNOW: LOG find_fun3.res LOG find_fun3.err %{bin:frama-c-script} find-fun false_positive @PTEST_DIR@ > @PTEST_RESULT@/find_fun3.res 2> @PTEST_RESULT@/find_fun3.err
DEPS:
EXECNOW: LOG list_functions.res LOG list_functions.err %{bin:frama-c-script} list-functions %{dep:@PTEST_DIR@/for-find-fun2.c} %{dep:@PTEST_DIR@/for-list-functions.c} > @PTEST_RESULT@/list_functions.res 2> @PTEST_RESULT@/list_functions.err
EXECNOW: LOG list_functions2.res LOG list_functions2.err LOG list_functions2.json %{bin:frama-c-script} list-functions %{dep:@PTEST_DIR@/for-find-fun2.c} %{dep:@PTEST_DIR@/for-list-functions.c -list-functions-declarations} -list-functions-output @PTEST_RESULT@/list_functions2.json -list-functions-debug 1 > @PTEST_RESULT@/list_functions2.res 2> @PTEST_RESULT@/list_functions2.err
*/ */
void main() { void main() {
} }
// NB: Dependency to ./share directory where are script files used by %{bin:frama-c-script} is implicit with `dune` testing.
...@@ -7,7 +7,7 @@ tests/fc_script/for-find-fun2.c:19:21: h (definition) ...@@ -7,7 +7,7 @@ tests/fc_script/for-find-fun2.c:19:21: h (definition)
tests/fc_script/for-find-fun2.c:28:31: static_fun (definition) tests/fc_script/for-find-fun2.c:28:31: static_fun (definition)
tests/fc_script/for-list-functions.c:8:15: static_fun (definition) tests/fc_script/for-list-functions.c:8:15: static_fun (definition)
tests/fc_script/for-list-functions.c:17:22: k (definition) tests/fc_script/for-list-functions.c:17:22: k (definition)
tests/fc_script/main.c:12:14: main (definition) tests/fc_script/main.c:18:20: main (definition)
tests/fc_script/main2.c:6:8: fake_main (definition) tests/fc_script/main2.c:6:8: fake_main (definition)
tests/fc_script/main2.c:10:12: domain (definition) tests/fc_script/main2.c:10:12: domain (definition)
tests/fc_script/main2.c:14:16: main2 (definition) tests/fc_script/main2.c:14:16: main2 (definition)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment