fix #18385 followup, by building nimsuggest with -d:release during testing (#18581)

This commit is contained in:
Timothee Cour 2021-07-29 19:28:33 -07:00 • committed by GitHub
commit afc0259b12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View file

@ -6,6 +6,7 @@
# `nim r nimsuggest/tester.nim nimsuggest/tests/tsug_accquote.nim`
import os, osproc, strutils, streams, re, sexp, net
from sequtils import toSeq
type
Test = object
@ -23,7 +24,7 @@ import std/compilesettings
proc parseTest(filename: string; epcMode=false): Test =
const cursorMarker = "#[!]#"
let nimsug = "bin" / addFileExt("nimsuggest", ExeExt)
let nimsug = "bin" / addFileExt("nimsuggest_testing", ExeExt)
doAssert nimsug.fileExists, nimsug
const libpath = querySetting(libPath)
result.filename = filename
@ -272,6 +273,7 @@ proc runEpcTest(filename: string): int =
let a = outp.readAll().strip()
let port = parseInt(a)
socket.connect("localhost", Port(port))
for req, resp in items(s.script):
if not runCmd(req, s.dest):
socket.sendEpcStr(req)
@ -279,8 +281,12 @@ proc runEpcTest(filename: string): int =
if not req.startsWith("mod "):
let answer = sexpToAnswer(sx)
doReport(filename, answer, resp, report)
finally:
socket.sendEpcStr "return arg"
# bugfix: this was in `finally` block, causing the original error to be
# potentially masked by another one in case `socket.sendEpcStr` raises
# (e.g. if socket couldn't connect in the 1st place)
finally:
close(p)
if report.len > 0:
echo "==== EPC ========================================"
@ -336,8 +342,9 @@ proc main() =
failures += runTest(xx)
failures += runEpcTest(xx)
else:
for x in walkFiles(tpath / "t*.nim"):
echo "Test ", x
let files = toSeq(walkFiles(tpath / "t*.nim"))
for i, x in files:
echo "$#/$# test: $#" % [$i, $files.len, x]
when defined(i386):
if x == "nimsuggest/tests/tmacro_highlight.nim":
echo "skipping" # workaround bug #17945