forked from red/red
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-all-tests.r
123 lines (107 loc) · 3.05 KB
/
run-all-tests.r
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
REBOL [
Title: "Builds and Runs All Red and Red/System Tests"
File: %run-all.r
Author: "Peter W A Wood"
Version: 0.5.0
License: "BSD-3 - https://github.com/dockimbel/Red/blob/master/BSD-3-License.txt"
]
;; function to find and run-tests
run-all-script: func [
dir [file!]
file [file!]
][
qt/tests-dir: system/script/path/:dir
foreach line read/lines dir/:file [
if any [
find line "===start-group"
find line "--run-"
][
do line
]
]
]
batch-mode: false
each-mode: false
binary-compiler?: false
args: any [system/script/args system/options/args]
if args [
;; should we run non-interactively?
batch-mode: find system/script/args "--batch"
;; should we run each file individually?
each-mode: find system/script/args "--each"
;; should we use the binary compiler?
args: parse system/script/args " "
if find system/script/args "--binary" [
binary-compiler?: true
bin-compiler: select args "--binary"
if any [
bin-compiler = "--batch"
bin-compiler = "--each"
][
bin-compiler: none ;; use default
]
if bin-compiler [
if not attempt [exists? to file! bin-compiler] [
either batch-mode [
write %quick-test/quick-test.log "Invalid compiler path"
quit/return 1
][
print "Invalid compiler path supplied"
print args
print ""
halt
]
]
]
]
]
;; supress script messages
store-quiet-mode: system/options/quiet
system/options/quiet: true
store-current-dir: what-dir
do %quick-test/quick-test.r
if binary-compiler? [
qt/binary-compiler?: binary-compiler?
if bin-compiler [qt/bin-compiler: bin-compiler]
]
qt/tests-dir: clean-path %system/tests/
do %system/tests/source/units/make-red-system-auto-tests.r
do %system/tests/source/units/prepare-dependencies.r
qt/tests-dir: clean-path %tests/
do %tests/source/units/run-all-init.r
;; run the tests
print ["Quick-Test v" qt/version]
print ["REBOL " system/version]
start-time: now/precise
print ["This test started at" start-time]
***start-run-quiet*** "Complete Red Test Suite"
qt/script-header: "Red []"
do %tests/source/units/run-pre-extra-tests.r
either each-mode [
do %tests/source/units/auto-tests/run-each-comp.r
do %tests/source/units/auto-tests/run-each-interp.r
][
--run-test-file-quiet %source/units/auto-tests/run-all-comp1.red
--run-test-file-quiet %source/units/auto-tests/run-all-comp2.red
--run-test-file-quiet %source/units/auto-tests/run-all-interp.red
]
do %tests/source/units/run-post-extra-tests.r
===start-group=== "View Engine Tests"
--run-test-file-quiet %source/view/base-self-test.red
===end-group===
qt/script-header: "Red/System []"
qt/tests-dir: clean-path %system/tests/
run-all-script %system/tests/ %run-all.r
***end-run-quiet***
end-time: now/precise
print [" in" difference end-time start-time newline]
print ["The test finished at" end-time]
system/options/quiet: store-quiet-mode
either batch-mode [
quit/return either qt/test-run/failures > 0 [1] [0]
][
print ["The test output was logged to" qt/log-file]
ask "hit enter to finish"
print ""
qt/test-run/failures
]