forked from rebolsource/rebol-test
/
run-recover.r
61 lines (52 loc) · 1.51 KB
/
run-recover.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
Rebol [
Title: "Core tests run with crash recovery"
File: %run-recover.r
Copyright: [2012 "Saphirion AG"]
License: {
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
}
Author: "Ladislav Mecir"
Purpose: "Core tests"
]
do %test-framework.r
; Example runner for the REBOL/Core tests which chooses
; appropriate flags depending on the interpreter version.
do-core-tests: has [
flags result log-file summary interpreter-checksum log-file-prefix
] [
; Check if we run R3 or R2.
set 'flags pick [
[#64bit #r3only #r3]
[#32bit #r2only]
] found? in system 'catalog
; calculate interpreter checksum
case [
all [file? system/options/boot #"/" = first system/options/boot] [
interpreter-checksum: checksum/method read-binary
system/options/boot 'sha1
]
string? system/script/args [
interpreter-checksum: checksum/method read-binary
to-rebol-file system/script/args 'sha1
]
'else [
; use system/build
interpreter-checksum: checksum/method to binary!
mold system/build 'sha1
]
]
log-file-prefix: %r
repeat i length? version: system/version [
append log-file-prefix "_"
append log-file-prefix mold version/:i
]
print "Testing ..."
result: do-recover %core-tests.r flags interpreter-checksum log-file-prefix
set [log-file summary] result
print ["Done, see the log file:" log-file]
print summary
]
do-core-tests