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

Merge branch 'feature/patrick/ptests-adds-config-option' into 'master'

[ptests] adds -config option

See merge request frama-c/frama-c!3925
parents 6404f23e afe09225
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,9 @@ let nb_dune_files = ref 0 ...@@ -30,6 +30,9 @@ let nb_dune_files = ref 0
let nb_ignores = ref 0 let nb_ignores = ref 0
let ignored_suites = ref [] let ignored_suites = ref []
let config_filter = ref None
let default_config = "DEFAULT"
(* Set to an empty string to use no wrapper *) (* Set to an empty string to use no wrapper *)
let wrapper_cmd = ref "frama-c-wtests -brief" let wrapper_cmd = ref "frama-c-wtests -brief"
...@@ -221,7 +224,7 @@ let example_msg = ...@@ -221,7 +224,7 @@ let example_msg =
@@PTEST_NAME@@ # Basename of the test file.@ \ @@PTEST_NAME@@ # Basename of the test file.@ \
@@PTEST_NUMBER@@ # Test command number.@ \ @@PTEST_NUMBER@@ # Test command number.@ \
@@PTEST_CONFIG@@ # Test configuration suffix.@ \ @@PTEST_CONFIG@@ # Test configuration suffix.@ \
@@PTEST_SUITE_DIR@ # Path to the directory contained the source of the test file (../). @@PTEST_SUITE_DIR@@ # Path to the directory contained the source of the test file (../).@ \
@@PTEST_RESULT@@ # Shorthand alias to @@PTEST_SUITE_DIR@@/result@@PTEST_CONFIG@@ (the result directory dedicated to the tested configuration).@ \ @@PTEST_RESULT@@ # Shorthand alias to @@PTEST_SUITE_DIR@@/result@@PTEST_CONFIG@@ (the result directory dedicated to the tested configuration).@ \
@@PTEST_ORACLE@@ # Basename of the current oracle file (macro only usable in FILTER directives).@ \ @@PTEST_ORACLE@@ # Basename of the current oracle file (macro only usable in FILTER directives).@ \
@@PTEST_DEFAULT_OPTIONS@@ # The default option list: %s@ \ @@PTEST_DEFAULT_OPTIONS@@ # The default option list: %s@ \
...@@ -292,6 +295,12 @@ let argspec = ...@@ -292,6 +295,12 @@ let argspec =
("-create-missing-oracles", Arg.Set create_missing_oracles, ("-create-missing-oracles", Arg.Set create_missing_oracles,
" creates missing oracles to allow the use of dune promote") ; " creates missing oracles to allow the use of dune promote") ;
("-config", Arg.String (function
| "" | "''" -> config_filter := Some ""
| s when String.equal s default_config -> config_filter := Some ""
| s -> config_filter := Some s),
"<configuration> Skip the other configurations") ;
("-remove-empty-oracles", Arg.Set remove_empty_oracles, ("-remove-empty-oracles", Arg.Set remove_empty_oracles,
" remove empty oracles") ; " remove empty oracles") ;
...@@ -352,7 +361,7 @@ end = struct ...@@ -352,7 +361,7 @@ end = struct
let get_config_suites (key,value) = let get_config_suites (key,value) =
Option.bind (str_string_match1 regexp_config key 0) Option.bind (str_string_match1 regexp_config key 0)
(function (function
| "DEFAULT" -> Some ("", (split_blank value)) | s when String.equal s default_config -> Some ("", (split_blank value))
| config -> Some (config, (split_blank value))) | config -> Some (config, (split_blank value)))
in in
fun ~dir -> fun ~dir ->
...@@ -2046,15 +2055,22 @@ let () = ...@@ -2046,15 +2055,22 @@ let () =
let suites = Ptests_config.parse ~dir in let suites = Ptests_config.parse ~dir in
if !verbosity >= 1 then Format.printf "%% Nb config= %d@." (StringMap.cardinal suites); if !verbosity >= 1 then Format.printf "%% Nb config= %d@." (StringMap.cardinal suites);
let nb = !nb_dune_files in let nb = !nb_dune_files in
let nbi = !nb_ignores in
StringMap.iter (fun config_mode suites -> StringMap.iter (fun config_mode suites ->
if !verbosity >= 1 then Format.printf "%% - %s_SUITES -> nb suites= %d@." match !config_filter with
(match config_mode with "" -> "DEFAULT" | s -> s) (StringMap.cardinal suites); | Some only when only <> config_mode ->
let env = { config = config_mode ; dir ; dune_alias = "" ; absolute_tests_dir ; absolute_cwd} in let nbi = StringMap.cardinal suites in
let directory = SubDir.create ~with_subdir:false ~env dir in Format.printf "%% - %s_SUITES -> nb suites= %d (skipped config -> ignored)@."
let config = Test_config.current_config ~env directory in (match config_mode with "" -> default_config | s -> s) nbi;
let config = update_dir_ref directory config in nb_ignores := !nb_ignores + nbi
process ~env config suites) suites ; | _ ->
if !verbosity >= 1 then Format.printf "%% - %s_SUITES -> nb suites= %d@."
(match config_mode with "" -> default_config | s -> s) (StringMap.cardinal suites);
let env = { config = config_mode ; dir ; dune_alias = "" ; absolute_tests_dir ; absolute_cwd} in
let directory = SubDir.create ~with_subdir:false ~env dir in
let config = Test_config.current_config ~env directory in
let config = update_dir_ref directory config in
process ~env config suites) suites ;
let nbi = !nb_ignores in
if !verbosity >= 1 then Format.printf "%% Nb dune files= %d@." (!nb_dune_files-nb); if !verbosity >= 1 then Format.printf "%% Nb dune files= %d@." (!nb_dune_files-nb);
if (!nb_ignores-nbi) <> 0 then Format.printf "- %d ignored suite(s)@." (!nb_ignores-nbi); if (!nb_ignores-nbi) <> 0 then Format.printf "- %d ignored suite(s)@." (!nb_ignores-nbi);
) suites ; ) suites ;
......
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