-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlockfreequeues.nimble
More file actions
79 lines (61 loc) · 3.13 KB
/
lockfreequeues.nimble
File metadata and controls
79 lines (61 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import os
# Package
version = "4.1.0"
author = "Elijah Shaw-Rutschman"
description = "Lock-free queue implementations for Nim."
license = "MIT"
srcDir = "src"
entryPoints = @["tests/test.nim"]
# Dependencies
requires "nim >= 2.2.0"
requires "unittest2"
requires "typestates >= 0.7.2"
requires "debra >= 0.7.0"
# Tasks
task test, "Runs the test suite":
# C with default MM (orc)
exec "nim c --threads:on -r -f tests/test.nim"
# C++
exec "nim cpp --threads:on -r -f tests/test.nim"
# Test with different memory managers
exec "nim c --mm:arc --threads:on -r -f tests/test.nim"
exec "nim c --mm:refc --threads:on -r -f tests/test.nim"
# Test with lock-free enforcement (ensures no spinlock fallback)
exec "nim c --mm:arc -d:nimEnforceLockFreeAtomics --threads:on -r -f tests/test.nim"
exec "nim c --mm:orc -d:nimEnforceLockFreeAtomics --threads:on -r -f tests/test.nim"
if getEnv("SANITIZE_THREADS") != "no":
# C (with thread sanitization, requires atomicArc for thread-safe refcounting)
exec "nim c --cc:clang --mm:atomicArc --passC:\"-fsanitize=thread\" --passL:\"-fsanitize=thread\" --threads:on -r -f tests/test.nim"
if getEnv("SANITIZE_ADDRESS") != "no":
# C (with address sanitization)
exec "nim c --cc:clang --passC:\"-fsanitize=address\" --passL:\"-fsanitize=address\" --threads:on -r -f tests/test.nim"
task examples, "Runs the examples":
# Bounded queue examples
exec "nim c --threads:on -r -f examples/sipsic.nim"
exec "nim c --threads:on -r -f examples/sipmuc.nim"
exec "nim c --threads:on -r -f examples/mupsic.nim"
exec "nim c --threads:on -r -f examples/mupmuc.nim"
# Advanced examples
exec "nim c --threads:on -r -f examples/audio_buffer.nim"
exec "nim c --threads:on -r -f examples/task_fanout.nim"
exec "nim c --threads:on -r -f examples/event_collector.nim"
exec "nim c --threads:on -r -f examples/job_scheduler.nim"
task benchmarks, "Runs the benchmark suite":
exec "nim c -d:release --threads:on benchmarks/nim/bench_main.nim"
exec "benchmarks/nim/bench_main --runs=10 -o=benchmarks/results/latest.json"
task stresstests, "Runs the stress test suite (multi-threaded)":
# C with default MM (orc)
exec "nim c --path:src --threads:on -r -f stress-tests/stress_test.nim"
# C++
exec "nim cpp --path:src --threads:on -r -f stress-tests/stress_test.nim"
# Test with different memory managers
exec "nim c --mm:arc --path:src --threads:on -r -f stress-tests/stress_test.nim"
exec "nim c --mm:refc --path:src --threads:on -r -f stress-tests/stress_test.nim"
# Test with lock-free enforcement
exec "nim c --mm:arc -d:nimEnforceLockFreeAtomics --path:src --threads:on -r -f stress-tests/stress_test.nim"
if getEnv("SANITIZE_THREADS") != "no":
# C (with thread sanitization)
exec "nim c --cc:clang --mm:atomicArc --path:src --passC:\"-fsanitize=thread\" --passL:\"-fsanitize=thread\" --threads:on -r -f stress-tests/stress_test.nim"
if getEnv("SANITIZE_ADDRESS") != "no":
# C (with address sanitization)
exec "nim c --cc:clang --path:src --passC:\"-fsanitize=address\" --passL:\"-fsanitize=address\" --threads:on -r -f stress-tests/stress_test.nim"