blob: 27f4f5b061a3cfc7ffa51d8da399c0f3a8b59ea8 (
plain) (
blame)
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
|
discard """
matrix: "--hints:off"
nimout: '''
Found 2 tests to run.
Found 3 benches to compile.
--passC:-Wno-stringop-overflow --passL:-Wno-stringop-overflow
--passC:-Wno-stringop-overflow --passL:-Wno-stringop-overflow
--passC:-Wno-stringop-overflow --passL:-Wno-stringop-overflow
'''
"""
# bug #21704
import std/strformat
const testDesc: seq[string] = @[
"tests/t_hash_sha256_vs_openssl.nim",
"tests/t_cipher_chacha20.nim"
]
const benchDesc = [
"bench_sha256",
"bench_hash_to_curve",
"bench_ethereum_bls_signatures"
]
proc setupTestCommand(flags, path: string): string =
return "nim c -r " &
flags &
&" --nimcache:nimcache/{path} " & # Commenting this out also solves the issue
path
proc testBatch(commands: var string, flags, path: string) =
commands &= setupTestCommand(flags, path) & '\n'
proc setupBench(benchName: string): string =
var runFlags = if false: " -r "
else: " " # taking this branch is needed to trigger the bug
echo runFlags # Somehow runflags isn't reset in corner cases
runFlags &= " --passC:-Wno-stringop-overflow --passL:-Wno-stringop-overflow "
echo runFlags
return "nim c " &
runFlags &
&" benchmarks/{benchName}.nim"
proc buildBenchBatch(commands: var string, benchName: string) =
let command = setupBench(benchName)
commands &= command & '\n'
proc addTestSet(cmdFile: var string) =
echo "Found " & $testDesc.len & " tests to run."
for path in testDesc:
var flags = "" # This is important
cmdFile.testBatch(flags, path)
proc addBenchSet(cmdFile: var string) =
echo "Found " & $benchDesc.len & " benches to compile."
for bd in benchDesc:
cmdFile.buildBenchBatch(bd)
proc task_bug() =
var cmdFile: string
cmdFile.addTestSet() # Comment this out and there is no bug
cmdFile.addBenchSet()
static: task_bug()
|