-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathlakefile.lean
135 lines (98 loc) · 2.91 KB
/
lakefile.lean
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import Lake
open Lake DSL System
package scilean
def moreLinkArgs : Array String := #[] -- #["-lm"]
@[default_target]
lean_lib SciLean {
-- precompileModules := true
roots := #[`SciLean]
moreLinkArgs := moreLinkArgs
}
@[test_driver]
lean_lib Test {
globs := #[Glob.submodules `Test]
moreLinkArgs := moreLinkArgs
}
lean_lib CompileTactics where
-- options for SciLean.Tactic.MySimpProc (and below) modules
precompileModules := true
roots := #[`SciLean.Tactic.LSimp.LetNormalize,`SciLean.Tactic.CompiledTactics]
lean_exe Doodle {
root := `examples.Doodle
}
lean_exe WaveEquation {
root := `examples.WaveEquation
moreLinkArgs := moreLinkArgs
}
lean_exe HelloWorld {
root := `examples.HelloWorld
}
lean_exe HarmonicOscillator {
root := `examples.HarmonicOscillator
moreLinkArgs := moreLinkArgs
}
lean_exe CircleOptimisation {
root := `examples.CircleOptimisation
}
lean_exe Ballistic {
root := `examples.Ballistic
}
lean_exe WalkOnSpheres {
root := `examples.WalkOnSpheres
}
lean_exe BFGS {
root := `Test.optimjl.bfgs
}
lean_exe LBFGS {
root := `Test.optimjl.lbfgs
}
lean_exe GMM {
root := `SciLean.Examples.GMM.Main
}
lean_exe ForLoopTest {
buildType := .release
moreLinkArgs := #["-O3", "-UNDEBUG"]
root := `tests.sum_speed_test
}
lean_exe SurfaceMeshTests {
root := `examples.SurfaceMeshTests
moreLinkArgs := moreLinkArgs
}
lean_exe MNISTClassifier where
root := `examples.MNISTClassifier
meta if get_config? doc = some "dev" then -- do not download and build doc-gen4 by default
require «doc-gen4» from git "https://github.com/leanprover/doc-gen4" @ "master"
require mathlib from git "https://github.com/leanprover-community/mathlib4" @ "master"
-- require leanblast from git "https://github.com/lecopivo/LeanBLAS" @ "master"
set_option linter.unusedVariables false
/--
Compiles all lean files 'test/*.lean
lake script run tests
-/
script tests (args) do
let cwd ← IO.currentDir
-- let testDir := cwd / "test"
let searchPath := SearchPath.toString
["build" / "lib",
"lean_packages" / "mathlib" / "build" / "lib"]
let mut testNum : Nat := 0
let mut failedTests : Array (FilePath × IO.Process.Output) := #[]
for test in (← (cwd / "test").readDir) do
if test.path.extension == some "lean" then
testNum := testNum + (1 : Nat)
let r ← timeit s!"Running test: {test.fileName}\t" (IO.Process.output {
cmd := "lean"
args := #[test.path.toString]
env := #[("LEAN_PATH", searchPath)]
})
if r.exitCode == (0 : UInt32) then
IO.println " Success!"
else
failedTests := failedTests.append #[(test.path, r)]
IO.println " Failed!"
if failedTests.size != 0 then
IO.println "\nFailed tests:"
for (test, _) in failedTests do
IO.println s!" {test}"
IO.println s!"\nSuccessful tests: {testNum - failedTests.size} / {testNum}"
return 0