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
parent 6b3c77e7f4
commit afc0259b12
2 changed files with 16 additions and 4 deletions

View File

@@ -592,6 +592,11 @@ proc runCI(cmd: string) =
execFold("Run rst2html tests", "nim r nimdoc/rsttester")
execFold("Run nimpretty tests", "nim r nimpretty/tester.nim")
when defined(posix):
# refs #18385, build with -d:release instead of -d:danger for testing
# We could also skip building nimsuggest in buildTools, or build it with -d:release
# in bundleNimsuggest depending on some environment variable when we are in CI. One advantage
# of rebuilding is this won't affect bin/nimsuggest when running runCI locally
execFold("build nimsuggest_testing", "nim c -o:bin/nimsuggest_testing -d:release nimsuggest/nimsuggest")
execFold("Run nimsuggest tests", "nim r nimsuggest/tester")
execFold("Run atlas tests", "nim c -r -d:atlasTests tools/atlas/atlas.nim clone https://github.com/disruptek/balls")

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