Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #16693: testament spec nimout too lax #16698

Merged
merged 21 commits into from
Apr 4, 2021
Merged

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Jan 12, 2021

fix #16693

@ringabout ringabout changed the title test PR fix #16693 Jan 13, 2021
@timotheecour
Copy link
Member

timotheecour commented Jan 13, 2021

annoying dots blocks this PR

how about we add --hint:processing:off to tests/config.nims?
tests that actually test this functionality can override this easily (that's exactly what i did in trunner.nim:

const
  defaultHintsOff = "--hint:successx:off --hint:exec:off --hint:link:off --hint:cc:off --hint:conf:off --hint:processing:off --hint:QuitCalled:off"
let opt = fmt"{defaultHintsOff} --hint:processing"

EDIT: see #16713

tests/test/test.nim Outdated Show resolved Hide resolved
@timotheecour timotheecour changed the title fix #16693 fix #16693: testament spec nimout too lax Jan 29, 2021
@timotheecour
Copy link
Member

friendly ping on this!

@ringabout
Copy link
Member Author

After I clean up all my working PRs.

@ringabout ringabout marked this pull request as ready for review April 3, 2021 10:30
@ringabout
Copy link
Member Author

will continue on this PR

Comment on lines 2 to 3
errormsg: "type mismatch: got <int>"
line: 17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need those 2 lines, given that we already capture

nimout: '''tprevent_forloopvar_mutations.nim(17, 7) Error: type mismatch: got <int>

I'd prefer simplicity here and in other tests; specifying separately line, col, errormsg is more work and nimout already captures what we want to test.

Ditto in other examples above, eg, replacing:

  errormsg: "undeclared identifier: 'undeclared'"
  line: 10
  column: 6

by:

  nimout: '''tcolumn.nim .nim(10, 6) undeclared identifier: 'undeclared''''

and similar examples

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then I need to change line number which is a huge work can be left in the future PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes can be deferred

then I need to change line number

no, you could just add empty newlines

@@ -1,5 +1,5 @@
discard """
nimout: "Warning: cannot prove that field 'x.s' is accessible [ProveField]"
nimout: "tcheckedfield1.nim(40, 6) Warning: cannot prove that field 'x.s' is accessible [ProveField]"
line:51
Copy link
Member

@timotheecour timotheecour Apr 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another bug: if i change this to line:1234, the test still passes

EDIT: filed #17636

can be fixed in future work

Copy link
Member Author

@ringabout ringabout Apr 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the logic? Related to my patch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-existing, it's unrelated to your PR, just that i noticed it while reviewing your PR

discard """
matrix: "--hint:processing"
nimout: '''
..
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
..
compile start
..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shoot, this fails on windows:

....compile start

(known bug IIRC)

given that we already have a similar test in trunner.nim, maybe add disabled: windows?

refs:

  block: # `hintProcessing` dots should not interfere with `static: echo` + friends
    let cmd = fmt"""{nim} r {defaultHintsOff} --hint:processing -f --eval:"static: echo 1+1""""
    let (outp, exitCode) = execCmdEx(cmd, options = {poStdErrToStdOut})
    template check3(cond) = doAssert cond, $(outp,)
    doAssert exitCode == 0
    let lines = outp.splitLines
    check3 lines.len == 3
    when not defined(windows): # xxx: on windows, dots not properly handled, gives: `....2\n\n`
      check3 lines[0].isDots
      check3 lines[1] == "2"
      check3 lines[2] == ""
    else:
      check3 "2" in outp

if line.len != 0:
while line != currentLine:
currentLine = strip(rhsIter())
if rhsIter.finished:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just use a seq for rhs, it'll be clearer than with rhs.finished + rhsIter() (which complicates readability because of iterator semantics which requires calling iter before finished)

Copy link
Member

@timotheecour timotheecour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after addressing CI failure on windows, for eg via #16698 (comment)

(remaining points can be addressed in this PR or in future PRs)

note: the targets: "c" became needed after this PR because now nimout whole lines must be matched, eg in

tests/testament/tshould_not_work.nim:32:24:FAIL: tests/shouldfail/ttimeout.nim c

to re-enable non-c targets (ie cpp here), we can in future work run tests/testament/tshould_not_work.nim via trunner.nim instead of via testament spec (only needs to be done for this file IIUC)

@timotheecour timotheecour merged commit 70a3031 into nim-lang:devel Apr 4, 2021
timotheecour added a commit to timotheecour/Nim that referenced this pull request May 6, 2021
timotheecour added a commit to timotheecour/Nim that referenced this pull request May 6, 2021
timotheecour added a commit to timotheecour/Nim that referenced this pull request May 8, 2021
Araq pushed a commit that referenced this pull request May 8, 2021
…work`; mitigate #17946 tchannels timeouts (#17947)

* refs #17946; refactor testament test summary, show test duration for failures; increase timeout tchannels

* revert workarounds from #16698 and add allowPrefixMatch optional param to greedyOrderedSubsetLines

* add test

* workaround for yet another testament bug
PMunch pushed a commit to PMunch/Nim that referenced this pull request Mar 28, 2022
PMunch pushed a commit to PMunch/Nim that referenced this pull request Mar 28, 2022
…work`; mitigate nim-lang#17946 tchannels timeouts (nim-lang#17947)

* refs nim-lang#17946; refactor testament test summary, show test duration for failures; increase timeout tchannels

* revert workarounds from nim-lang#16698 and add allowPrefixMatch optional param to greedyOrderedSubsetLines

* add test

* workaround for yet another testament bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

testament spec nimout too lax
3 participants