Skip to content

Commit

Permalink
feat: add compiler flags
Browse files Browse the repository at this point in the history
  • Loading branch information
fabaindaiz committed Aug 6, 2024
1 parent 6cd9dc7 commit e2c3223
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Type

let make_test
~(compiler : compiler)
?(runtime : runtime = Runtime.direct_output)
?(runtime : runtime = Runtime.not_implemented)
?(oracle : runtime = Runtime.not_implemented)
?(testeable : testeable = Testeable.compare_results)
(filename : string) =
Expand Down
6 changes: 4 additions & 2 deletions test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ open Type


let test_regexp =
Str.regexp "NAME:\\|DESCRIPTION:\\|PARAMS:\\|STATUS:\\|SRC:\\|EXPECTED:\\|END"
Str.regexp "NAME:\\|DESCRIPTION:\\|FLAGS:\\|PARAMS:\\|STATUS:\\|SRC:\\|EXPECTED:\\|END"

let get_opt s dflt tokens =
let open Str in
Expand All @@ -16,13 +16,15 @@ let parse_content filename content =
let toks = full_split test_regexp content in
let name, toks = get_opt "NAME:" Filename.(chop_extension @@ basename filename) toks in
let description, toks = get_opt "DESCRIPTION:" "" toks in
let flags_string, toks = get_opt "FLAGS:" "" toks in
let flags = List.map String.trim (String.split_on_char ',' flags_string) in
let params_string, toks = get_opt "PARAMS:" "" toks in
let params = List.map String.trim (String.split_on_char ',' params_string) in
let status, toks = get_opt "STATUS:" "ok" toks in
match toks with
| Delim "SRC:" :: Text src ::
Delim "EXPECTED:" :: Text expected :: ( [] | Delim "END" :: _ ) ->
Some { file = filename; name; description; params; status = status_of_string status;
Some { file = filename; name; description; flags; params; status = status_of_string status;
src; expected = String.trim expected }
| _ -> (Printf.fprintf stderr "Wrong format in test file %s" filename ; None)

Expand Down
1 change: 1 addition & 0 deletions type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type t =
{ file : string
; name : string
; description : string
; flags : string list
; params : string list
; status : status
; src : string
Expand Down
2 changes: 2 additions & 0 deletions type.mli
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type t =
(** Name of the test *)
; description : string
(** Description of the test *)
; flags : string list
(** Compilation flags passed to the compiler *)
; params : string list
(** Parameters passed to the test as environment variables *)
; status : status
Expand Down

0 comments on commit e2c3223

Please sign in to comment.