Skip to content

Commit

Permalink
Introduce tests/dune_hello
Browse files Browse the repository at this point in the history
  • Loading branch information
mtzguido committed Oct 15, 2024
1 parent c683a67 commit 3f8b702
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ALL_TEST_DIRS += typeclasses
ALL_TEST_DIRS += vale
ALL_TEST_DIRS += hacl
ALL_TEST_DIRS += simple_hello
ALL_TEST_DIRS += dune_hello
HAS_OCAML := $(shell which ocamlfind 2>/dev/null)

ifneq (,$(HAS_OCAML))
Expand Down
3 changes: 3 additions & 0 deletions tests/dune_hello/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.ml
_build
lib
5 changes: 5 additions & 0 deletions tests/dune_hello/Hello.fst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Hello

open FStar.IO

let _ = print_string "Hi!\n"
15 changes: 15 additions & 0 deletions tests/dune_hello/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FSTAR_EXE ?= ../../bin/fstar.exe

.PHONY: all
all: run

Hello.ml: Hello.fst
$(FSTAR_EXE) --codegen OCaml Hello.fst --extract Hello

bin/hello.exe: Hello.ml
$(FSTAR_EXE) --ocamlenv dune build @install --profile=release
$(FSTAR_EXE) --ocamlenv dune install --prefix=.

.PHONY: run
run: bin/hello.exe
./bin/hello.exe | grep "Hi!"
11 changes: 11 additions & 0 deletions tests/dune_hello/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(executable
(name hello)
(public_name hello.exe)
(libraries fstar.lib)
(modes native)
)
(env
(_
(bin_annot false)
(flags (:standard -w -A)))
)
7 changes: 7 additions & 0 deletions tests/dune_hello/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(lang dune 3.8)
(name hello)

(package
(name hello)
(synopsis "An example F* application")
)

0 comments on commit 3f8b702

Please sign in to comment.