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

stdlib modules should run via megatest (or megatest_stdlib), with special isMainModule handling #10045

Closed
timotheecour opened this issue Dec 19, 2018 · 2 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Dec 19, 2018

This is a followup from #9581

testament uses testStdlib to compile and run stdlib modules.
It relies on this logic:

if "when isMainModule" notin contents:
       testObj.spec.action = actionCompile

This is ok-ish but can have false positives (if appears in a comment), or false negatives, eg with when defined(osx) and isMainModule.

Instead of fixing this logic, a much better way is to extend the megatest idea from #9581 to stdlib modules.
This can be done as follows, without having to patch any stdlib module:

  • add each stdlib file to megatest (minus a blacklist of non-joinable tests)
  • patch compiler so isMainModule is equal to true when -d:isMainModuleIsAlwaysTrue is provided

That'll give the speedup benefit from #9581, and make that logic less fragile

note

on my machine,

nim c -r testament/tester pcat lib # 102 seconds
nim c -r testament/tester all # 390 seconds

so we can save roughly 25% with this (minus time to compile/run the megatest)

But this saving will become more significant as we address remaining issues, eg I have ideas for joining certain failing tests using the new --errorMax:N flag (will discuss in other issue)

@Araq
Copy link
Member

Araq commented Dec 19, 2018

I had the same plan so go ahead already. :-)

@Araq
Copy link
Member

Araq commented May 25, 2019

I changed my mind, megatest is bad enough already, I don't want even more of the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants