Skip to content

Commit 760998b

Browse files
committed
update lines and dune file - preparing to rebase on main
1 parent 4d058d6 commit 760998b

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

src/sys/dune

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,11 @@
22

33
;; this prevents the tests from running on a default build
44

5-
(alias
6-
(name default)
7-
(package multicoretests)
8-
(deps stm_tests.exe))
9-
10-
(executable
5+
(test
116
(name stm_tests)
127
(modules stm_tests)
13-
(libraries qcheck-stm.sequential qcheck-stm.domain)
14-
(preprocess
15-
(pps ppx_deriving.show)))
16-
17-
(rule
18-
(alias runtest)
198
(package multicoretests)
20-
(deps stm_tests.exe)
21-
(action
22-
(run ./%{deps} --verbose)))
9+
(libraries qcheck-stm.sequential qcheck-stm.domain)
10+
(preprocess (pps ppx_deriving.show))
11+
(action (run %{test} --verbose))
12+
)

src/sys/stm_tests.ml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
open QCheck
2-
open STM_base
2+
open STM
33

44
module SConf =
55
struct
@@ -32,10 +32,10 @@ struct
3232
QCheck.make ~print:show_cmd
3333
Gen.(oneof
3434
[
35-
map (fun path -> File_exists (path)) path_gen ;
35+
map (fun path -> File_exists path) path_gen ;
3636
map3 (fun path new_dir_name perm -> Mkdir (path, new_dir_name, perm)) path_gen name_gen perm_gen;
3737
map2 (fun path delete_dir_name -> Rmdir (path, delete_dir_name)) path_gen name_gen;
38-
map (fun path -> Readdir (path)) path_gen;
38+
map (fun path -> Readdir path) path_gen;
3939
map3 (fun path new_file_name perm -> Touch (path, new_file_name, perm)) path_gen name_gen perm_gen;
4040
])
4141

@@ -127,7 +127,7 @@ struct
127127

128128
let next_state c fs =
129129
match c with
130-
| File_exists (_path) -> fs
130+
| File_exists _path -> fs
131131
| Mkdir (path, new_dir_name, perm) ->
132132
if mem fs (path @ [new_dir_name])
133133
then fs
@@ -163,12 +163,12 @@ struct
163163

164164
let run c _file_name =
165165
match c with
166-
| File_exists (path) -> Res (bool, Sys.file_exists (p path))
166+
| File_exists path -> Res (bool, Sys.file_exists (p path))
167167
| Mkdir (path, new_dir_name, perm) ->
168168
Res (result unit exn, protect (Sys.mkdir ((p path) / new_dir_name)) perm)
169169
| Rmdir (path, delete_dir_name) ->
170170
Res (result unit exn, protect (Sys.rmdir) ((p path) / delete_dir_name))
171-
| Readdir (path) ->
171+
| Readdir path ->
172172
Res (result (array string) exn, protect (Sys.readdir) (p path))
173173
| Touch (path, new_file_name, _perm) ->
174174
(match Sys.os_type with
@@ -185,7 +185,7 @@ struct
185185

186186
let postcond c (fs: filesys) res =
187187
match c, res with
188-
| File_exists (path), Res ((Bool,_),b) -> b = mem fs path
188+
| File_exists path, Res ((Bool,_),b) -> b = mem fs path
189189
| Mkdir (path, new_dir_name, _perm), Res ((Result (Unit,Exn),_), res) ->
190190
let complete_path = (path @ [new_dir_name]) in
191191
(match res with
@@ -202,16 +202,15 @@ struct
202202
let complete_path = (path @ [delete_dir_name]) in
203203
(match res with
204204
| Error err ->
205-
(match err with
205+
(match err with
206206
| Sys_error s ->
207207
(s = (p complete_path) ^ ": Directory not empty" && not (readdir fs complete_path = Some [])) ||
208208
(s = (p complete_path) ^ ": No such file or directory" && not (mem fs complete_path)) ||
209209
(s = (p complete_path) ^ ": Not a directory" && not (path_is_a_dir fs complete_path))
210210
| _ -> false)
211211
| Ok () ->
212-
let is_empty = readdir fs complete_path = Some [] in
213-
mem fs complete_path && is_empty && path_is_a_dir fs complete_path)
214-
| Readdir (path), Res ((Result (Array String,Exn),_), res) ->
212+
mem fs complete_path && path_is_a_dir fs complete_path && readdir fs complete_path = Some [])
213+
| Readdir path, Res ((Result (Array String,Exn),_), res) ->
215214
(match res with
216215
| Error err ->
217216
(match err with
@@ -226,7 +225,7 @@ struct
226225
(match readdir fs path with
227226
| None -> false
228227
| Some l -> List.sort (fun a b -> -(String.compare a b)) l = sut) in
229-
same_result && mem fs path && path_is_a_dir fs path)
228+
mem fs path && path_is_a_dir fs path && same_result)
230229
| Touch (_path, _new_dir_name, _perm), Res ((Unit,_),_) -> true
231230
| _,_ -> false
232231
end

0 commit comments

Comments
 (0)