Skip to content

Commit 1e01651

Browse files
authored
testament: remove deadcode related to realtimeGC, testC, callCCompiler (#18087)
1 parent 3b1aabd commit 1e01651

File tree

6 files changed

+15
-162
lines changed

6 files changed

+15
-162
lines changed

testament/categories.nim

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const
2828
"js",
2929
"ic",
3030
"lib",
31-
"longgc",
3231
"manyloc",
3332
"nimble-packages",
3433
"niminaction",
@@ -39,7 +38,6 @@ const
3938
"coroutines",
4039
"osproc",
4140
"shouldfail",
42-
"dir with space",
4341
"destructor"
4442
]
4543

@@ -156,19 +154,6 @@ proc gcTests(r: var TResults, cat: Category, options: string) =
156154
test "cyclecollector"
157155
testWithoutBoehm "trace_globals"
158156

159-
proc longGCTests(r: var TResults, cat: Category, options: string) =
160-
when defined(windows):
161-
let cOptions = "-ldl -DWIN"
162-
else:
163-
let cOptions = "-ldl"
164-
165-
var c = initResults()
166-
# According to ioTests, this should compile the file
167-
testSpec c, makeTest("tests/realtimeGC/shared", options, cat)
168-
# ^- why is this not appended to r? Should this be discarded?
169-
testC r, makeTest("tests/realtimeGC/cmain", cOptions, cat), actionRun
170-
testSpec r, makeTest("tests/realtimeGC/nmain", options & "--threads: on", cat)
171-
172157
# ------------------------- threading tests -----------------------------------
173158

174159
proc threadTests(r: var TResults, cat: Category, options: string) =
@@ -186,6 +171,11 @@ proc ioTests(r: var TResults, cat: Category, options: string) =
186171
# dummy compile result:
187172
var c = initResults()
188173
testSpec c, makeTest("tests/system/helpers/readall_echo", options, cat)
174+
# ^- why is this not appended to r? Should this be discarded?
175+
# EDIT: this should be replaced by something like in D20210524T180826,
176+
# likewise in similar instances where `testSpec c` is used, or more generally
177+
# when a test depends on another test, as it makes tests non-independent,
178+
# creating complications for batching and megatest logic.
189179
testSpec r, makeTest("tests/system/tio", options, cat)
190180

191181
# ------------------------- async tests ---------------------------------------
@@ -687,8 +677,6 @@ proc processCategory(r: var TResults, cat: Category,
687677
dllTests(r, cat, options)
688678
of "gc":
689679
gcTests(r, cat, options)
690-
of "longgc":
691-
longGCTests(r, cat, options)
692680
of "debugger":
693681
debuggerTests(r, cat, options)
694682
of "manyloc":

testament/testament.nim

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -221,53 +221,6 @@ proc callNimCompiler(cmdTemplate, filename, options, nimcache: string,
221221
result.msg = matches[0]
222222
trimUnitSep result.msg
223223

224-
proc callCCompiler(cmdTemplate, filename, options: string,
225-
target: TTarget): TSpec =
226-
let cmd = prepareTestCmd(cmdTemplate, filename, options, nimcache = "", target)
227-
doAssert false
228-
#[
229-
this code hasn't been run in a while, and should be removed which simplifies code
230-
there are better ways to do this anyways (e.g. running c code from a nim file)
231-
232-
the only place where this is called is:
233-
`testC r, makeTest("tests/realtimeGC/cmain", cOptions, cat), actionRun`
234-
which isn't run unless you call:
235-
XDG_CONFIG_HOME= nim r --lib:lib --stacktrace:on testament/testament.nim r longgc
236-
237-
and this fails since at least nim 1.0 with:
238-
testament/testament.nim(851) testament
239-
testament/testament.nim(822) main
240-
testament/categories.nim(713) processCategory
241-
testament/categories.nim(189) longGCTests
242-
testament/testament.nim(644) makeTest
243-
testament/specs.nim(251) parseSpec
244-
testament/specs.nim(184) extractSpec
245-
lib/system/io.nim(861) readFile
246-
Error: unhandled exception: cannot open: tests/realtimeGC/cmain.nim [IOError]
247-
248-
Also, `c[5 .. ^1]` is too magical.
249-
]#
250-
let c = cmd.parseCmdLine
251-
var p = startProcess(command = "gcc", args = c[5 .. ^1],
252-
options = {poStdErrToStdOut, poUsePath, poEvalCommand})
253-
let outp = p.outputStream
254-
var x = newStringOfCap(120)
255-
result.nimout = ""
256-
result.msg = ""
257-
result.file = ""
258-
result.output = ""
259-
result.line = -1
260-
while true:
261-
if outp.readLine(x):
262-
result.nimout.add(x & '\n')
263-
elif not running(p):
264-
break
265-
close(p)
266-
if p.peekExitCode == 0:
267-
result.err = reSuccess
268-
else:
269-
result.err = reNimcCrash
270-
271224
proc initResults: TResults =
272225
result.total = 0
273226
result.passed = 0
@@ -628,22 +581,6 @@ proc testSpecWithNimcache(r: var TResults, test: TTest; nimcache: string) {.used
628581
var testClone = test
629582
testSpecHelper(r, testClone, test.spec, target, nimcache)
630583

631-
proc testC(r: var TResults, test: TTest, action: TTestAction) =
632-
# runs C code. Doesn't support any specs, just goes by exit code.
633-
if not checkDisabled(r, test): return
634-
635-
let tname = test.name.addFileExt(".c")
636-
inc(r.total)
637-
maybeStyledEcho "Processing ", fgCyan, extractFilename(tname)
638-
var given = callCCompiler(getCmd(TSpec()), test.name & ".c", test.options, targetC)
639-
if given.err != reSuccess:
640-
r.addResult(test, targetC, "", given.msg, given.err)
641-
elif action == actionRun:
642-
let exeFile = changeFileExt(test.name, ExeExt)
643-
var (_, exitCode) = execCmdEx(exeFile, options = {poStdErrToStdOut, poUsePath})
644-
if exitCode != 0: given.err = reExitcodesDiffer
645-
if given.err == reSuccess: inc(r.passed)
646-
647584
proc makeTest(test, options: string, cat: Category): TTest =
648585
result.cat = cat
649586
result.name = test

tests/readme.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,4 @@ testing, which is slower).
5555
The folder ``dll`` contains simple DLL tests.
5656

5757
The folder ``realtimeGC`` contains a test for validating that the realtime GC
58-
can run properly without linking against the nimrtl.dll/so. It includes a C
59-
client and platform specific build files for manual compilation.
58+
can run properly without linking against the nimrtl.dll/so.

tests/realtimeGC/cmain.c

Lines changed: 0 additions & 69 deletions
This file was deleted.

tests/realtimeGC/readme.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/realtimeGC/tmain.nim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,24 @@ these dont' seem needed --debuginfo
99
nor these from the previous main.nim.cfg: --app:console
1010
]#
1111

12+
#[
13+
Test the realtime GC without linking nimrtl.dll/so.
14+
15+
To build by hand and run the test for 35 minutes:
16+
`nim r --threads:on -d:runtimeSecs:2100 tests/realtimeGC/tmain.nim`
17+
]#
18+
1219
import times, os, strformat, strutils
1320
from stdtest/specialpaths import buildDir
1421
# import threadpool
1522

1623
const runtimeSecs {.intdefine.} = 5
1724

1825
const file = "shared.nim"
19-
const dllname = buildDir / (DynlibFormat % file)
26+
const dllname = buildDir / (DynlibFormat % "shared_D20210524T180506")
2027

2128
static:
29+
# D20210524T180826:here we compile the dependency on the fly
2230
let nim = getCurrentCompilerExe()
2331
let (output, exitCode) = gorgeEx(fmt"{nim} c -o:{dllname} --debuginfo --app:lib --threads:on -d:release -d:useRealtimeGC {file}")
2432
doAssert exitCode == 0, output

0 commit comments

Comments
 (0)