zinc icon indicating copy to clipboard operation
zinc copied to clipboard

Document how to enable debug info on scripted tests and/or make it much simpler

Open smarter opened this issue 8 years ago • 9 comments

This is the process currently:

  1. Edit https://github.com/sbt/zinc/blob/1.0/project/Scripted.scala
  2. At the end of the file, replace
bridge.run(sourcePath, true, args.toArray)

by

bridge.run(sourcePath, false, args.toArray)

smarter avatar Apr 05 '17 15:04 smarter

In my opinion, this should be the default option. What do you think @eed3si9n @dwijnand?

jvican avatar Apr 05 '17 15:04 jvican

I think the problem is that if we dumped the debug log without buffering, it will end up flooding Travis CI. We should print out the log when it the test fails.

eed3si9n avatar Apr 05 '17 15:04 eed3si9n

Sometimes it's useful to print the logs when the test doesn't fail for debugging purpose too.

smarter avatar Apr 05 '17 15:04 smarter

In scripted plugin there's a setting for it actually. We should probably that over.

eed3si9n avatar Apr 05 '17 15:04 eed3si9n

I think we could dump the debug log in the following situations:

  • Test fails.
  • User adds a name of a scripted test to a setting in the build that enables debugging for that scripted test.

If all this is possible, that's perfect.

jvican avatar Apr 05 '17 15:04 jvican

User adds a name of a scripted test to a setting in the build that enables debugging for that scripted test.

That requires reloading the build which is always annoying, and you have to remember to not commit that change, I'd like to be able to do something like debugScripted a/b in sbt instead.

smarter avatar Apr 05 '17 16:04 smarter

User adds a name of a scripted test to a setting in the build that enables debugging for that scripted test.

I actually misread Jorge's comment above before giving 👍 . I thought it would automatically dump the log if the scripted is invoked as scripted a/b.

eed3si9n avatar Apr 05 '17 16:04 eed3si9n

Oh, that's fine too. Actually it's a better solution.

jvican avatar Apr 05 '17 16:04 jvican

Okay, thinking out loud here. As scripted failures are most of the times unexpected and we're only interested in seeing the logs when a scripted test fail, I think the best thing to do is to enrich Zinc's scripted implementation to compress the contents of the failed scripted working directory and make it available somewhere for further inspection. These contents should also contain the scripted logs.

The "make it available somewhere for further inspection" can be fancy, in the future. For example, we could upload a zip somewhere in the internet so that we can see what went wrong in the CI without re-running scripted tests. However, we can start small here by doing it locally at the beginning: putting the contents in the temporary directory and printing its absolute path.

Does this make sense? Pros? Cons?

jvican avatar Oct 12 '17 12:10 jvican