Skip to content

Commit b8e9a8a

Browse files
authored
Merge pull request #50 from jmid/lockfree-0.2
Update to lockfree 0.2.0
2 parents 7638b8f + d15f191 commit b8e9a8a

File tree

7 files changed

+41
-339
lines changed

7 files changed

+41
-339
lines changed

multicoretests.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pin-depends: [
3030
["ppx_deriving_qcheck.0.2.0" "git+https://github.com/c-cube/qcheck.git#master"]
3131

3232
["kcas.0.14" "git+https://github.com/ocaml-multicore/kcas#master"]
33-
["lockfree.0.13" "git+https://github.com/ocaml-multicore/lockfree#master"]
33+
["lockfree.v0.2.0" "git+https://github.com/ocaml-multicore/lockfree#main"]
3434
]
3535

3636
build: [

src/domainslib/dune

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,10 @@
1-
;; test of ws_deque from domainslib
1+
;; tests of Domainslib
22

33
;; this prevents the tests from running on a default build
44
(alias
55
(name default)
66
(package multicoretests)
7-
(deps ws_deque_test.exe task_one_dep.exe task_more_deps.exe task_parallel.exe))
8-
9-
(executable
10-
(name ws_deque_test)
11-
(modules ws_deque_test)
12-
(libraries qcheck STM domainslib)
13-
(preprocess (pps ppx_deriving.show)))
14-
15-
(env
16-
(_
17-
(binaries
18-
(../check_error_count.exe as check_error_count))))
19-
20-
(rule
21-
(alias runtest)
22-
(package multicoretests)
23-
(deps ws_deque_test.exe)
24-
(action
25-
(progn
26-
(bash "(./ws_deque_test.exe --no-colors --verbose || echo 'test run triggered an error') | tee wsd-output.txt")
27-
(run %{bin:check_error_count} "domainslib/ws_deque_test" 1 wsd-output.txt))))
28-
7+
(deps task_one_dep.exe task_more_deps.exe task_parallel.exe))
298

309
;; tests of Domainslib.Task's async functionality (non-STM)
3110

src/lockfree/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
Tests of the lockfree library
22
=============================
33

4-
Two linearizability tests fail:
4+
This contains a test of work-stealing deque - the only module in lockfree.v0.2.0.
5+
6+
- A previous version found an issue with `size` sometimes returning `-1` when invoked in parallel.
7+
This observation was taken into account for v.0.2.0, which would eliminate `size` and `is_empty` from the interface,
8+
leaving only `push`, `pop`, and `steal`.
9+
10+
We test the above in two ways:
11+
- a positive test lets an owner domain invoke `push` and `pop` and a parallel stealer domain invoke only `steal`.
12+
- a negative test lets both owner and stealer invoke all three operations, thus breaking the contract.
13+
14+
15+
16+
17+
Older tests
18+
-----------
19+
20+
An older version tested lockfree.0.1.3 in which two linearizability tests would fail:
521

622
- The Lockfree.Hash test in [lin_tests.ml](lin_tests.ml)
723

src/lockfree/dune

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
;; Test of the lockfree library
22

3+
;; test of ws_deque
4+
35
;; this prevents the tests from running on a default build
46
(alias
57
(name default)
68
(package multicoretests)
7-
(deps lf_list_test.exe lin_tests.exe))
9+
(deps ws_deque_test.exe))
810

911
(executable
10-
(name lf_list_test)
11-
(modules lf_list_test)
12+
(name ws_deque_test)
13+
(modules ws_deque_test)
1214
(libraries qcheck STM lockfree)
13-
(preprocess (pps ppx_deriving.show ppx_deriving.eq)))
15+
(preprocess (pps ppx_deriving.show)))
1416

1517
(env
1618
(_
@@ -20,24 +22,8 @@
2022
(rule
2123
(alias runtest)
2224
(package multicoretests)
23-
(deps lf_list_test.exe)
24-
(action (run ./%{deps} --no-colors --verbose)))
25-
26-
27-
;; Linearizability tests of the lockfree library
28-
29-
(executable
30-
(name lin_tests)
31-
(modules lin_tests)
32-
(flags (:standard -w -27))
33-
(libraries qcheck lin lockfree)
34-
(preprocess (pps ppx_deriving_qcheck ppx_deriving.show ppx_deriving.eq)))
35-
36-
(rule
37-
(alias runtest)
38-
(package multicoretests)
39-
(deps lin_tests.exe)
25+
(deps ws_deque_test.exe)
4026
(action
4127
(progn
42-
(bash "(./lin_tests.exe --no-colors --verbose || echo 'test run triggered an error') | tee lin-output.txt")
43-
(run %{bin:check_error_count} "lockfree/lin_tests" 2 lin-output.txt))))
28+
(bash "(./ws_deque_test.exe --no-colors --verbose || echo 'test run triggered an error') | tee wsd-output.txt")
29+
(run %{bin:check_error_count} "lockfree/ws_deque_test" 1 wsd-output.txt))))

src/lockfree/lf_list_test.ml

Lines changed: 0 additions & 116 deletions
This file was deleted.

src/lockfree/lin_tests.ml

Lines changed: 0 additions & 141 deletions
This file was deleted.

0 commit comments

Comments
 (0)