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

Merge branch 'feature/patrick/ptests-filter-execnow' into 'master'

[Ptests] More use of MODULE directive

See merge request frama-c/frama-c!3380
parents 437130a7 5fa714be
No related branches found
No related tags found
No related merge requests found
...@@ -819,7 +819,10 @@ end = struct ...@@ -819,7 +819,10 @@ end = struct
dc_timeout = ""; dc_timeout = "";
} }
let scan_execnow ~once dir ex_macros ex_timeout (s:string) = let scan_execnow ~warn ~once ~file dir ex_macros ex_timeout (s:string) =
if once=false then
lock_eprintf "%s: using EXEC directive (DEPRECATED): %s@."
file s;
let rec aux (s:execnow) = let rec aux (s:execnow) =
try try
Scanf.sscanf s.ex_cmd "%_[ ]LOG%_[ ]%[-A-Za-z0-9_',+=:.\\@@]%_[ ]%s@\n" Scanf.sscanf s.ex_cmd "%_[ ]LOG%_[ ]%[-A-Za-z0-9_',+=:.\\@@]%_[ ]%s@\n"
...@@ -834,21 +837,31 @@ end = struct ...@@ -834,21 +837,31 @@ end = struct
try try
Scanf.sscanf s.ex_cmd "%_[ ]make%_[ ]%s@\n" Scanf.sscanf s.ex_cmd "%_[ ]make%_[ ]%s@\n"
(fun cmd -> (fun cmd ->
(* It should be better to use a specific macro into the command (such as @MAKE@) for that. *)
let s = aux ({ s with ex_cmd = cmd; }) in let s = aux ({ s with ex_cmd = cmd; }) in
{ s with ex_cmd = !do_make^" "^cmd; } ) let r = { s with ex_cmd = !do_make^" "^cmd; } in
if warn then
Format.eprintf "%s: EXEC%s directive with a make command (DEPRECATED): %s@."
file (if once then "NOW" else "") r.ex_cmd;
r)
with Scanf.Scan_failure _ -> with Scanf.Scan_failure _ ->
s s
in in
aux let execnow = aux
{ ex_cmd = s; { ex_cmd = s;
ex_macros; ex_macros;
ex_log = []; ex_log = [];
ex_bin = []; ex_bin = [];
ex_dir = dir; ex_dir = dir;
ex_once = once; ex_once = once;
ex_done = ref false; ex_done = ref false;
ex_timeout; ex_timeout;
} }
in
if warn && execnow.ex_log = [] && execnow.ex_bin = [] then
Format.eprintf "%s: EXEC%s without LOG nor BIN target (DEPRECATED): %s@."
file (if once then "NOW" else "") s;
execnow
type parsing_env = { type parsing_env = {
current_default_toplevel: string; current_default_toplevel: string;
...@@ -899,10 +912,10 @@ end = struct ...@@ -899,10 +912,10 @@ end = struct
List.fold_right (fun x s -> s ^ " " ^ x) opts "" List.fold_right (fun x s -> s ^ " " ^ x) opts ""
(* how to process options *) (* how to process options *)
let config_exec ~once ~file:_ dir s current = let config_exec ~warn ~once ~file dir s current =
{ current with { current with
dc_execnow = dc_execnow =
scan_execnow ~once dir current.dc_macros current.dc_timeout s :: current.dc_execnow } scan_execnow ~warn ~once ~file dir current.dc_macros current.dc_timeout s :: current.dc_execnow }
let config_macro ~file _dir s current = let config_macro ~file _dir s current =
let regex = Str.regexp "[ \t]*\\([^ \t@]+\\)\\([ \t]+\\(.*\\)\\|$\\)" in let regex = Str.regexp "[ \t]*\\([^ \t@]+\\)\\([ \t]+\\(.*\\)\\|$\\)" in
...@@ -937,7 +950,7 @@ end = struct ...@@ -937,7 +950,7 @@ end = struct
if String.(deps = "") then current if String.(deps = "") then current
else begin else begin
let make_cmd = Macros.expand current.dc_macros "@PTEST_MAKE_MODULE@" in let make_cmd = Macros.expand current.dc_macros "@PTEST_MAKE_MODULE@" in
config_exec ~once:true ~file dir (make_cmd ^ deps) current config_exec ~warn:false ~once:true ~file dir (make_cmd ^ deps) current
end end
let update_module_macros modules macros = let update_module_macros modules macros =
...@@ -1036,8 +1049,8 @@ end = struct ...@@ -1036,8 +1049,8 @@ end = struct
"DONTRUN", "DONTRUN",
(fun ~file:_ _ s current -> { current with dc_dont_run = true }); (fun ~file:_ _ s current -> { current with dc_dont_run = true });
"EXECNOW", config_exec ~once:true; "EXECNOW", config_exec ~warn:true ~once:true;
"EXEC", config_exec ~once:false; "EXEC", config_exec ~warn:true ~once:false;
"MACRO", config_macro; "MACRO", config_macro;
......
/* run.config /* run.config
COMMENT: Test option -cg-function-pointers COMMENT: Test option -cg-function-pointers
EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs MODULE: @PTEST_NAME@
OPT: -cg-function-pointers -no-autoload-plugins -load-module eva,@PTEST_DIR@/@PTEST_NAME@.cmxs PLUGIN: @PTEST_PLUGIN@,eva
OPT: -cg-no-services -cg-function-pointers -no-autoload-plugins -load-module eva,@PTEST_DIR@/@PTEST_NAME@.cmxs OPT: -cg-function-pointers
OPT: -cg-no-function-pointers -no-autoload-plugins -load-module eva,@PTEST_DIR@/@PTEST_NAME@.cmxs OPT: -cg-no-services -cg-function-pointers
OPT: -cg-no-services -cg-no-function-pointers -no-autoload-plugins -load-module eva,@PTEST_DIR@/@PTEST_NAME@.cmxs OPT: -cg-no-function-pointers
OPT: -cg-no-services -cg-no-function-pointers
*/ */
int (*fptr)(int); int (*fptr)(int);
......
/*run.config /*run.config
NOFRAMAC: MACRO: SHARE share/compliance
EXECNOW: LOG json_@PTEST_NAME@_1.txt python3 -m json.tool < share/compliance/c11_functions.json | head -n 2 > @PTEST_RESULT@/json_@PTEST_NAME@_1.txt 2> @DEV_NULL@ NOFRAMAC:
EXECNOW: LOG json_@PTEST_NAME@_2.txt python3 -m json.tool < share/compliance/glibc_functions.json | head -n 2 > @PTEST_RESULT@/json_@PTEST_NAME@_2.txt 2> @DEV_NULL@ EXECNOW: LOG json_@PTEST_NAME@_1.txt python3 -m json.tool < @SHARE@/c11_functions.json | head -n 2 > @PTEST_RESULT@/json_@PTEST_NAME@_1.txt 2> @DEV_NULL@
EXECNOW: LOG json_@PTEST_NAME@_3.txt python3 -m json.tool < share/compliance/nonstandard_identifiers.json | head -n 2 > @PTEST_RESULT@/json_@PTEST_NAME@_3.txt 2> @DEV_NULL@ EXECNOW: LOG json_@PTEST_NAME@_2.txt python3 -m json.tool < @SHARE@/glibc_functions.json | head -n 2 > @PTEST_RESULT@/json_@PTEST_NAME@_2.txt 2> @DEV_NULL@
EXECNOW: LOG json_@PTEST_NAME@_4.txt python3 -m json.tool < share/compliance/posix_identifiers.json | head -n 2 > @PTEST_RESULT@/json_@PTEST_NAME@_4.txt 2> @DEV_NULL@ EXECNOW: LOG json_@PTEST_NAME@_3.txt python3 -m json.tool < @SHARE@/nonstandard_identifiers.json | head -n 2 > @PTEST_RESULT@/json_@PTEST_NAME@_3.txt 2> @DEV_NULL@
EXECNOW: LOG json_@PTEST_NAME@_4.txt python3 -m json.tool < @SHARE@/posix_identifiers.json | head -n 2 > @PTEST_RESULT@/json_@PTEST_NAME@_4.txt 2> @DEV_NULL@
*/ */
/*run.config /*run.config
EXECNOW: make tests/dynamic/empty.cmo tests/dynamic/abstract.cmo tests/dynamic/abstract2.cmo
CMD: FRAMAC_PLUGIN=tests/dynamic bin/toplevel.byte
OPT: -add-path tests/dynamic/file_path -add-path tests/dynamic/directory_path -add-path tests/dynamic/none OPT: -add-path tests/dynamic/file_path -add-path tests/dynamic/directory_path -add-path tests/dynamic/none
OPT: -load-module tests/dynamic/empty.cmo,tests/dynamic/abstract.cmo,tests/dynamic/abstract2.cmo MODULE: empty abstract abstract2
OPT:
*/ */
/* run.config /* run.config
COMMENT: do not compare generated journals since they depend on current time COMMENT: do not compare generated journals since they depend on current time
PLUGIN: @EVA_PLUGINS@ PLUGIN: @EVA_PLUGINS@
EXECNOW: BIN control_journal.ml @frama-c@ @PTEST_FILE@ -journal-enable -eva -deps -out @EVA_OPTIONS@ -main f -journal-name control_journal.ml > @DEV_NULL@ 2> @DEV_NULL@ EXECNOW: BIN control_journal.ml @frama-c@ @PTEST_FILE@ -journal-enable -eva -deps -out @EVA_OPTIONS@ -main f -journal-name @PTEST_RESULT@/control_journal.ml > @DEV_NULL@ 2> @DEV_NULL@
OPT: -load-script control_journal.ml OPT: -load-script @PTEST_RESULT@/control_journal.ml
MODULE: MODULE:
EXECNOW: BIN control_journal_bis.ml cp control_journal.ml control_journal_bis.ml > @DEV_NULL@ 2> @DEV_NULL@ EXECNOW: BIN control_journal_bis.ml cp @PTEST_RESULT@/control_journal.ml @PTEST_RESULT@/control_journal_bis.ml > @DEV_NULL@ 2> @DEV_NULL@
OPT: -calldeps -load-script control_journal_bis.ml OPT: -calldeps -load-script @PTEST_RESULT@/control_journal_bis.ml
MODULE: abstract_cpt use_cpt MODULE: abstract_cpt use_cpt
EXECNOW: BIN abstract_cpt_journal.ml @frama-c@ -journal-enable -journal-name abstract_cpt_journal.ml > @DEV_NULL@ 2> @DEV_NULL@ EXECNOW: BIN abstract_cpt_journal.ml @frama-c@ -journal-enable -journal-name @PTEST_RESULT@/abstract_cpt_journal.ml > @DEV_NULL@ 2> @DEV_NULL@
OPT: -load-script abstract_cpt_journal.ml OPT: -load-script @PTEST_RESULT@/abstract_cpt_journal.ml
*/ */
int x,y,c,d; int x,y,c,d;
......
/* run.config /* run.config
EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs PLUGIN:
EXECNOW: LOG my_visitor_sav.res LOG my_visitor_sav.err BIN my_visitor.sav FRAMAC_PLUGIN=./lib/plugins @frama-c@ @PTEST_FILE@ -no-autoload-plugins -load-module @PTEST_DIR@/@PTEST_NAME@.cmxs -main f -save @PTEST_DIR@/@PTEST_NAME@.sav > @PTEST_DIR@/result/@PTEST_NAME@_sav.res 2> @PTEST_DIR@/result/@PTEST_NAME@_sav.err MODULE: @PTEST_NAME@
OPT: -load @PTEST_DIR@/@PTEST_NAME@.sav -no-autoload-plugins -load-module @PTEST_DIR@/@PTEST_NAME@.cmxs -no-my-visitor -print EXECNOW: LOG my_visitor_sav.res LOG my_visitor_sav.err BIN my_visitor.sav @frama-c@ @PTEST_FILE@ -main f -save @PTEST_DIR@/@PTEST_NAME@.sav > @PTEST_DIR@/result/@PTEST_NAME@_sav.res 2> @PTEST_DIR@/result/@PTEST_NAME@_sav.err
OPT: -load @PTEST_DIR@/@PTEST_NAME@.sav -no-autoload-plugins -print OPT: -load @PTEST_DIR@/@PTEST_NAME@.sav -no-my-visitor -print
MODULE:
OPT: -load @PTEST_DIR@/@PTEST_NAME@.sav -print
*/ */
int f() { int f() {
int y = 0; int y = 0;
......
/* run.config /* run.config
EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs MODULE: libSelect @PTEST_NAME@
CMD: @frama-c@ -load-module tests/slicing/libSelect.cmxs -load-module @PTEST_DIR@/@PTEST_NAME@.cmxs
OPT: @EVA_OPTIONS@ -deps -slicing-level 0 -journal-disable OPT: @EVA_OPTIONS@ -deps -slicing-level 0 -journal-disable
*/ */
/* bin/toplevel.opt -deps -eva @PTEST_DIR@/@PTEST_NAME@.c */ /* bin/toplevel.opt -deps -eva @PTEST_DIR@/@PTEST_NAME@.c */
/* bin/toplevel.opt -deps -pdg-debug -pdg @PTEST_DIR@/@PTEST_NAME@.c */ /* bin/toplevel.opt -deps -pdg-debug -pdg @PTEST_DIR@/@PTEST_NAME@.c */
/* cf aussi @PTEST_DIR@/@PTEST_NAME@.ml */ /* cf aussi @PTEST_DIR@/@PTEST_NAME@.ml */
......
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