diff --git a/.travis.yml b/.travis.yml index ea5d54eadc1c..0e55d3affc89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,9 +42,12 @@ before_script: - cd .. - export PATH=$(pwd)/bin${PATH:+:$PATH} - echo PATH:${PATH} + - set +e # prevents breaking after_failure script: + - echo "travis_fold:start:nim_c_koch" - nim c koch + - echo "travis_fold:end:nim_c_koch" - ./koch runCI before_deploy: @@ -59,3 +62,6 @@ deploy: # https://nim-lang.github.io/Nim keep-history: false on: branch: devel + +# Extract failed tests +after_failure: nim c -r tools/ci_testresults.nim diff --git a/changelog.md b/changelog.md index eb97ac9a6f95..85e06112bb7b 100644 --- a/changelog.md +++ b/changelog.md @@ -38,6 +38,8 @@ - The procs `parseutils.parseBiggsetInt`, `parseutils.parseInt`, `parseutils.parseBiggestUInt` and `parseutils.parseUInt` now raise a `ValueError` when the parsed integer is outside of the valid range. Previously they sometimes raised a `OverflowError` and sometimes returned `0`. +- `streams.StreamObject` now restricts its fields to only raise `system.Defect`, `system.IOError` and `system.OSError`. This change only affects custom stream implementations. + - nre's `RegexMatch.{captureBounds,captures}[]` no longer return `Option` or `nil`/`""`, respectivly. Use the newly added `n in p.captures` method to check if a group is captured, otherwise you'll recieve an exception. diff --git a/config/nimdoc.cfg b/config/nimdoc.cfg index f89739df6984..f534264a0a6a 100644 --- a/config/nimdoc.cfg +++ b/config/nimdoc.cfg @@ -1314,11 +1314,8 @@ dt pre > span.Identifier, dt pre > span.Operator { color: #155da4; font-weight: 700; } -dt pre > span.Identifier ~ span.Identifier, dt pre > span.Operator ~ span.Identifier { - color: inherit; - font-weight: inherit; } - -dt pre > span.Operator ~ span.Identifier { +dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier, +dt pre > span.Operator ~ span.Identifier, dt pre > span.Operator ~ span.Identifier { color: inherit; font-weight: inherit; } diff --git a/koch.nim b/koch.nim index d21c5240e575..89ee28d5a7c1 100644 --- a/koch.nim +++ b/koch.nim @@ -163,7 +163,7 @@ proc bundleNimsuggest() = nimCompile("nimsuggest/nimsuggest.nim", options = "-d:release") proc buildVccTool() = - nimCompile("tools/vccexe/vccexe.nim") + nimCompileFold("Compile Vcc", "tools/vccexe/vccexe.nim") proc bundleWinTools() = # TODO: consider building under `bin` instead of `.` @@ -208,10 +208,10 @@ proc buildTool(toolname, args: string) = proc buildTools() = bundleNimsuggest() - nimCompile("tools/nimgrep.nim", options = "-d:release") + nimCompileFold("Compile nimgrep", "tools/nimgrep.nim", options = "-d:release") when defined(windows): buildVccTool() - nimCompile("nimpretty/nimpretty.nim", options = "-d:release") - nimCompile("tools/nimfind.nim", options = "-d:release") + nimCompileFold("Compile nimpretty", "nimpretty/nimpretty.nim", options = "-d:release") + nimCompileFold("Compile nimfind", "tools/nimfind.nim", options = "-d:release") proc nsis(latest: bool; args: string) = bundleNimbleExe(latest) diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 10de86e9f307..b6e77bbc0226 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -45,17 +45,22 @@ type ## here shouldn't be used directly. They are ## accessible so that a stream implementation ## can override them. - closeImpl*: proc (s: Stream) {.nimcall, tags: [], gcsafe.} - atEndImpl*: proc (s: Stream): bool {.nimcall, tags: [], gcsafe.} - setPositionImpl*: proc (s: Stream, pos: int) {.nimcall, tags: [], gcsafe.} - getPositionImpl*: proc (s: Stream): int {.nimcall, tags: [], gcsafe.} - readDataImpl*: proc (s: Stream, buffer: pointer, - bufLen: int): int {.nimcall, tags: [ReadIOEffect], gcsafe.} - peekDataImpl*: proc (s: Stream, buffer: pointer, - bufLen: int): int {.nimcall, tags: [ReadIOEffect], gcsafe.} - writeDataImpl*: proc (s: Stream, buffer: pointer, bufLen: int) {.nimcall, - tags: [WriteIOEffect], gcsafe.} - flushImpl*: proc (s: Stream) {.nimcall, tags: [WriteIOEffect], gcsafe.} + closeImpl*: proc (s: Stream) + {.nimcall, raises: [Defect, IOError, OSError], tags: [], gcsafe.} + atEndImpl*: proc (s: Stream): bool + {.nimcall, raises: [Defect, IOError, OSError], tags: [], gcsafe.} + setPositionImpl*: proc (s: Stream, pos: int) + {.nimcall, raises: [Defect, IOError, OSError], tags: [], gcsafe.} + getPositionImpl*: proc (s: Stream): int + {.nimcall, raises: [Defect, IOError, OSError], tags: [], gcsafe.} + readDataImpl*: proc (s: Stream, buffer: pointer, bufLen: int): int + {.nimcall, raises: [Defect, IOError, OSError], tags: [ReadIOEffect], gcsafe.} + peekDataImpl*: proc (s: Stream, buffer: pointer, bufLen: int): int + {.nimcall, raises: [Defect, IOError, OSError], tags: [ReadIOEffect], gcsafe.} + writeDataImpl*: proc (s: Stream, buffer: pointer, bufLen: int) + {.nimcall, raises: [Defect, IOError, OSError], tags: [WriteIOEffect], gcsafe.} + flushImpl*: proc (s: Stream) + {.nimcall, raises: [Defect, IOError, OSError], tags: [WriteIOEffect], gcsafe.} proc flush*(s: Stream) = ## flushes the buffers that the stream `s` might use. @@ -65,10 +70,6 @@ proc close*(s: Stream) = ## closes the stream `s`. if not isNil(s.closeImpl): s.closeImpl(s) -proc close*(s, unused: Stream) {.deprecated.} = - ## closes the stream `s`. - s.closeImpl(s) - proc atEnd*(s: Stream): bool = ## checks if more data can be read from `f`. Returns true if all data has ## been read. @@ -111,12 +112,6 @@ proc writeData*(s: Stream, buffer: pointer, bufLen: int) = ## to the stream `s`. s.writeDataImpl(s, buffer, bufLen) -proc writeData*(s, unused: Stream, buffer: pointer, - bufLen: int) {.deprecated.} = - ## low level proc that writes an untyped `buffer` of `bufLen` size - ## to the stream `s`. - s.writeDataImpl(s, buffer, bufLen) - proc write*[T](s: Stream, x: T) = ## generic write procedure. Writes `x` to the stream `s`. Implementation: ## diff --git a/nimdoc/testproject/expected/subdir/subdir_b/utils.html b/nimdoc/testproject/expected/subdir/subdir_b/utils.html index f057df7e3659..58108b5f2143 100644 --- a/nimdoc/testproject/expected/subdir/subdir_b/utils.html +++ b/nimdoc/testproject/expected/subdir/subdir_b/utils.html @@ -1139,11 +1139,8 @@ color: #155da4; font-weight: 700; } -dt pre > span.Identifier ~ span.Identifier, dt pre > span.Operator ~ span.Identifier { - color: inherit; - font-weight: inherit; } - -dt pre > span.Operator ~ span.Identifier { +dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier, +dt pre > span.Operator ~ span.Identifier, dt pre > span.Operator ~ span.Identifier { color: inherit; font-weight: inherit; } diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html index 21a7a0cf836b..63e7bcd6a816 100644 --- a/nimdoc/testproject/expected/testproject.html +++ b/nimdoc/testproject/expected/testproject.html @@ -1139,11 +1139,8 @@ color: #155da4; font-weight: 700; } -dt pre > span.Identifier ~ span.Identifier, dt pre > span.Operator ~ span.Identifier { - color: inherit; - font-weight: inherit; } - -dt pre > span.Operator ~ span.Identifier { +dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier, +dt pre > span.Operator ~ span.Identifier, dt pre > span.Operator ~ span.Identifier { color: inherit; font-weight: inherit; } diff --git a/nimdoc/testproject/expected/theindex.html b/nimdoc/testproject/expected/theindex.html index 5a6e575bf5b7..4a8744b96a2d 100644 --- a/nimdoc/testproject/expected/theindex.html +++ b/nimdoc/testproject/expected/theindex.html @@ -1139,11 +1139,8 @@ color: #155da4; font-weight: 700; } -dt pre > span.Identifier ~ span.Identifier, dt pre > span.Operator ~ span.Identifier { - color: inherit; - font-weight: inherit; } - -dt pre > span.Operator ~ span.Identifier { +dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier, +dt pre > span.Operator ~ span.Identifier, dt pre > span.Operator ~ span.Identifier { color: inherit; font-weight: inherit; } diff --git a/tools/ci_testresults.nim b/tools/ci_testresults.nim new file mode 100644 index 000000000000..3201606d7fab --- /dev/null +++ b/tools/ci_testresults.nim @@ -0,0 +1,24 @@ +## Print summary of failed tests for CI + +import os, json, sets, strformat + +const skip = toSet(["reDisabled", "reIgnored", "reSuccess", "reJoined"]) + +when isMainModule: + for fn in walkFiles("testresults/*.json"): + let entries = fn.readFile().parseJson() + for j in entries: + let res = j["result"].getStr() + if skip.contains(res): + continue + echo fmt """ +Category: {j["category"].getStr()} +Name: {j["name"].getStr()} +Action: {j["action"].getStr()} +Result: {res} +-------- Expected ------- +{j["expected"].getStr()} +--------- Given -------- +{j["given"].getStr()} +------------------------- +""" diff --git a/tools/kochdocs.nim b/tools/kochdocs.nim index 7919deec68b1..c0e7ce66b7fc 100644 --- a/tools/kochdocs.nim +++ b/tools/kochdocs.nim @@ -42,10 +42,10 @@ proc execFold*(desc, cmd: string, errorcode: int = QuitFailure, additionalPath = ## Execute shell command. Add log folding on Travis CI. # https://github.com/travis-ci/travis-ci/issues/2285#issuecomment-42724719 if existsEnv("TRAVIS"): - echo "travis_fold:start:" & desc.replace(" ", "") + echo "travis_fold:start:" & desc.replace(" ", "_") exec(cmd, errorcode, additionalPath) if existsEnv("TRAVIS"): - echo "travis_fold:end:" & desc.replace(" ", "") + echo "travis_fold:end:" & desc.replace(" ", "_") proc execCleanPath*(cmd: string, additionalPath = ""; errorcode: int = QuitFailure) = @@ -69,6 +69,11 @@ proc nimCompile*(input: string, outputDir = "bin", mode = "c", options = "") = let cmd = findNim() & " " & mode & " -o:" & output & " " & options & " " & input exec cmd +proc nimCompileFold*(desc, input: string, outputDir = "bin", mode = "c", options = "") = + let output = outputDir / input.splitFile.name.exe + let cmd = findNim() & " " & mode & " -o:" & output & " " & options & " " & input + execFold(desc, cmd) + const pdf = """ doc/manual.rst