Skip to content

Commit 39a693a

Browse files
author
Shale Xiong
committed
[gen] add -unfold-only flag which only unfolds wildcard
1 parent 4977a80 commit 39a693a

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

gen/common/config.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ let variant = ref (fun (_:Variant_gen.t) -> false)
5353
let rejects = ref None
5454
let stdout = ref false
5555
let cycleonly = ref false
56+
let unfold_only = ref false
5657
let metadata = ref true
5758
let numeric = ref true
5859
let varatom = ref ([] : string list)
@@ -356,6 +357,7 @@ let diy_spec () =
356357
Arg.String (fun s -> filter_check := !filter_check @ [s]);
357358
],
358359
"<lhs> <rhs> show whether the internal filter prohibits the two relaxations in the mode specified by `-mode` argument, however, all other constraints between <lhs> and <rhs>, such as edge compatibility, are ignored. Passing the internal filter is a necessary but not sufficient condition when sequence `<lhs> <rhs>` appears in the generated tests. This argument overrides other arguments but is overrided by `-show`.")::
360+
("-unfold-only", Arg.Set unfold_only, "unfold the wildcard.")::
359361
[]
360362

361363
let valid_stdout_flag is_diyone =

gen/diy.ml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ let parse_fences fs = List.fold_right parse_fence fs []
135135

136136

137137

138+
let parse_argument_opt argument =
139+
Option.map parse_argument argument |> Option.value ~default:[]
140+
138141
let gen lr ls rl n =
139-
let parse_argument_opt argument =
140-
Option.map parse_argument argument
141-
|> Option.value ~default:[] in
142142
let lr = parse_argument_opt lr
143143
and ls = parse_argument_opt ls
144144
and rl = parse_argument_opt rl in
@@ -218,7 +218,8 @@ let () =
218218
let relax_list = split_cands !Config.relaxs
219219
and safe_list = split_cands !Config.safes
220220
and reject_list = !Config.rejects
221-
and filter_list = !Config.filter_check in
221+
and filter_list = !Config.filter_check
222+
and unfold_only = !Config.unfold_only in
222223

223224
let cpp = match !Config.arch with `CPP -> true | _ -> false in
224225

@@ -321,8 +322,8 @@ let () =
321322
| [lhs;rhs] ->
322323
let lhs_unfold = M.parse_argument lhs in
323324
let rhs_unfold = M.parse_argument rhs in
324-
let relax = Option.map M.parse_argument relax_list |> Option.value ~default:[] in
325-
let safe = Option.map M.parse_argument safe_list |> Option.value ~default:[] in
325+
let relax = M.parse_argument_opt relax_list in
326+
let safe = M.parse_argument_opt safe_list in
326327
List.map ( fun l ->
327328
List.map ( fun r ->
328329
l,r,M.M.filter_check ~relax ~safe (Builder.R.edges_of l) (Builder.R.edges_of r)
@@ -336,6 +337,13 @@ let () =
336337
( Code.pp_check Co.choice )
337338
)
338339
| _ -> (* The common path to generate tests *)
340+
if unfold_only then
341+
let relax = M.parse_argument_opt relax_list in
342+
let safe = M.parse_argument_opt safe_list in
343+
let reject = M.parse_argument_opt reject_list in
344+
eprintf "***relax***\n%s\n***safe***\n%s\n***reject***\n%s\n"
345+
(Builder.R.pp_relax_list relax) (Builder.R.pp_relax_list safe) (Builder.R.pp_relax_list reject)
346+
else
339347
M.go !Config.size reject_list relax_list safe_list;
340348
exit 0
341349
with

0 commit comments

Comments
 (0)