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

[Ptests] don't look at directives related to other configurations

parent 5470c550
No related branches found
No related tags found
No related merge requests found
...@@ -847,12 +847,12 @@ end = struct ...@@ -847,12 +847,12 @@ end = struct
(* how to process options *) (* how to process options *)
let config_exec ~once ~drop:_ ~file:_ dir s current = let config_exec ~once ~file:_ dir s current =
{ current with { current with
dc_execnow = dc_execnow =
scan_execnow ~once dir current.dc_timeout s :: current.dc_execnow } scan_execnow ~once dir current.dc_timeout s :: current.dc_execnow }
let config_macro ~drop:_ ~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
Mutex.lock str_mutex; Mutex.lock str_mutex;
if Str.string_match regex s 0 then begin if Str.string_match regex s 0 then begin
...@@ -883,7 +883,7 @@ end = struct ...@@ -883,7 +883,7 @@ end = struct
lock_printf "%% - Macro %s for -load-module with definition %s@." name def; lock_printf "%% - Macro %s for -load-module with definition %s@." name def;
Macros.add_list [name, def] macros Macros.add_list [name, def] macros
let add_make_modules ~drop ~file dir deps current = let add_make_modules ~file dir deps current =
let deps,current = List.fold_left (fun ((deps,curr) as acc) s -> let deps,current = List.fold_left (fun ((deps,curr) as acc) s ->
if StringSet.mem s curr.dc_cmxs_module then acc if StringSet.mem s curr.dc_cmxs_module then acc
else else
...@@ -894,23 +894,23 @@ end = struct ...@@ -894,23 +894,23 @@ end = struct
if String.(deps = "") then current if String.(deps = "") then current
else else
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 ~drop ~file dir (make_cmd ^ " " ^ deps) current config_exec ~once:true ~file dir (make_cmd ^ " " ^ deps) current
let config_module ~drop ~file dir s current = let config_module ~file dir s current =
let s = Macros.expand current.dc_macros s in let s = Macros.expand current.dc_macros s in
let deps = List.map (fun s -> "@PTEST_DIR@/" ^ (Filename.remove_extension s) ^ ".cmxs") let deps = List.map (fun s -> "@PTEST_DIR@/" ^ (Filename.remove_extension s) ^ ".cmxs")
(str_split_list s) (str_split_list s)
in in
let current = add_make_modules ~drop ~file dir deps current in let current = add_make_modules ~file dir deps current in
{ current with dc_macros = set_load_modules deps current.dc_macros } { current with dc_macros = set_load_modules deps current.dc_macros }
let config_options = let config_options =
[ "CMD", [ "CMD",
(fun ~drop:_ ~file:_ _ s current -> { current with dc_default_toplevel = s}); (fun ~file:_ _ s current -> { current with dc_default_toplevel = s});
"OPT", "OPT",
(fun ~drop ~file _ s current -> (fun ~file _ s current ->
if not (drop || current.dc_framac) then if not (current.dc_framac) then
lock_eprintf lock_eprintf
"%s: a NOFRAMAC directive has been defined before a sub-test defined by a 'OPT' directive (That NOFRAMAC directive could be misleading.).@." "%s: a NOFRAMAC directive has been defined before a sub-test defined by a 'OPT' directive (That NOFRAMAC directive could be misleading.).@."
file; file;
...@@ -927,8 +927,8 @@ end = struct ...@@ -927,8 +927,8 @@ end = struct
dc_commands = t :: current.dc_commands }); dc_commands = t :: current.dc_commands });
"STDOPT", "STDOPT",
(fun ~drop ~file _ s current -> (fun ~file _ s current ->
if not (drop || current.dc_framac) then if not current.dc_framac then
lock_eprintf lock_eprintf
"%s: a NOFRAMAC directive has been defined before a sub-test defined by a 'STDOPT' directive (That NOFRAMAC directive could be misleading.).@." "%s: a NOFRAMAC directive has been defined before a sub-test defined by a 'STDOPT' directive (That NOFRAMAC directive could be misleading.).@."
file; file;
...@@ -947,10 +947,10 @@ end = struct ...@@ -947,10 +947,10 @@ end = struct
dc_default_log = !default_parsing_env.current_default_log }); dc_default_log = !default_parsing_env.current_default_log });
"FILEREG", "FILEREG",
(fun ~drop:_ ~file:_ _ s current -> { current with dc_test_regexp = s }); (fun ~file:_ _ s current -> { current with dc_test_regexp = s });
"FILTER", "FILTER",
(fun ~drop:_ ~file:_ _ s current -> (fun ~file:_ _ s current ->
let s = trim_right s in let s = trim_right s in
match current.dc_filter with match current.dc_filter with
| None when s="" -> { current with dc_filter = None } | None when s="" -> { current with dc_filter = None }
...@@ -958,18 +958,18 @@ end = struct ...@@ -958,18 +958,18 @@ end = struct
| Some filter -> { current with dc_filter = Some (s ^ " | " ^ filter) }); | Some filter -> { current with dc_filter = Some (s ^ " | " ^ filter) });
"EXIT", "EXIT",
(fun ~drop:_ ~file:_ _ s current -> { current with dc_exit_code = Some s }); (fun ~file:_ _ s current -> { current with dc_exit_code = Some s });
"GCC", "GCC",
(fun ~drop ~file _ _ acc -> (fun ~file _ _ acc ->
if not drop then lock_eprintf "%s: GCC directive (DEPRECATED)@." file; lock_eprintf "%s: GCC directive (DEPRECATED)@." file;
acc); acc);
"COMMENT", "COMMENT",
(fun ~drop:_ ~file:_ _ _ acc -> acc); (fun ~file:_ _ _ acc -> acc);
"DONTRUN", "DONTRUN",
(fun ~drop:_ ~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 ~once:true;
"EXEC", config_exec ~once:false; "EXEC", config_exec ~once:false;
...@@ -979,14 +979,14 @@ end = struct ...@@ -979,14 +979,14 @@ end = struct
"MODULE", config_module; "MODULE", config_module;
"LOG", "LOG",
(fun ~drop:_ ~file:_ _ s current -> { current with dc_default_log = s :: current.dc_default_log }); (fun ~file:_ _ s current -> { current with dc_default_log = s :: current.dc_default_log });
"TIMEOUT", "TIMEOUT",
(fun ~drop:_ ~file:_ _ s current -> { current with dc_timeout = s }); (fun ~file:_ _ s current -> { current with dc_timeout = s });
"NOFRAMAC", "NOFRAMAC",
(fun ~drop ~file _ _ current -> (fun ~file _ _ current ->
if not drop && current.dc_commands <> [] && current.dc_framac then if current.dc_commands <> [] && current.dc_framac then
lock_eprintf lock_eprintf
"%s: a NOFRAMAC directive has the effect of ignoring previous defined sub-tests (by some 'OPT' or 'STDOPT' directives that seems misleading). @." "%s: a NOFRAMAC directive has the effect of ignoring previous defined sub-tests (by some 'OPT' or 'STDOPT' directives that seems misleading). @."
file; file;
...@@ -1004,7 +1004,9 @@ end = struct ...@@ -1004,7 +1004,9 @@ end = struct
Scanf.sscanf s "%[ *]%[A-Za-z0-9]: %s@\n" Scanf.sscanf s "%[ *]%[A-Za-z0-9]: %s@\n"
(fun _ name opt -> (fun _ name opt ->
try try
r := (List.assoc name config_options) ~drop ~file dir opt !r let directive = List.assoc name config_options in
if not drop then
r := directive ~file dir opt !r;
with Not_found -> with Not_found ->
lock_eprintf "@[%s: unknown configuration option: %s@\n%!@]" file name) lock_eprintf "@[%s: unknown configuration option: %s@\n%!@]" file name)
with with
......
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