Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Clean annex related items from test stack traces #147

Open
andyscott opened this issue Dec 2, 2018 · 1 comment
Open

Clean annex related items from test stack traces #147

andyscott opened this issue Dec 2, 2018 · 1 comment

Comments

@andyscott
Copy link
Member

andyscott commented Dec 2, 2018

We should prune annex items from stack traces.

Current formatted as diff of desired change:

INFO: From Testing //src/test/scala/io/higherkindness/arktika/scalac:ArktikaPhaseChecks:
==================== Test output for //src/test/scala/io/higherkindness/arktika/scalac:ArktikaPh
aseChecks:                                                                                     
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.j
ava:62)                                                                                        
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccess
orImpl.java:45)                                                                                
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.scalacheck.Platform$.newInstance(Platform.scala:66)
        at org.scalacheck.ScalaCheckRunner$BaseTask.<init>(ScalaCheckFramework.scala:57)
        at org.scalacheck.ScalaCheckRunner$$anon$1.<init>(ScalaCheckFramework.scala:88)
        at org.scalacheck.ScalaCheckRunner.rootTask(ScalaCheckFramework.scala:88)
        at org.scalacheck.ScalaCheckRunner.$anonfun$tasks$2(ScalaCheckFramework.scala:47)
        at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
        at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
        at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:194)
        at scala.collection.TraversableLike.map(TraversableLike.scala:233)
        at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
        at scala.collection.mutable.ArrayOps$ofRef.map(ArrayOps.scala:194)
        at org.scalacheck.ScalaCheckRunner.tasks(ScalaCheckFramework.scala:45)
-       at annex.BasicTestRunner.$anonfun$execute$2(TestFrameworkRunner.scala:13)
-       at annex.BasicTestRunner.$anonfun$execute$2$adapted(TestFrameworkRunner.scala:11)
-       at annex.TestHelper$.withRunner(Test.scala:32)
-       at annex.BasicTestRunner.$anonfun$execute$1(TestFrameworkRunner.scala:11)
-       at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12)
-       at annex.ClassLoader$.withContextClassLoader(ClassLoader.scala:10)
-       at annex.BasicTestRunner.execute(TestFrameworkRunner.scala:11)
-       at annex.TestRunner$.$anonfun$main$10(TestRunner.scala:167)
-       at annex.TestRunner$.$anonfun$main$10$adapted(TestRunner.scala:143)
-       at scala.collection.IndexedSeqOptimized.prefixLengthImpl(IndexedSeqOptimized.scala:37)
-       at scala.collection.IndexedSeqOptimized.forall(IndexedSeqOptimized.scala:42)
-       at scala.collection.IndexedSeqOptimized.forall$(IndexedSeqOptimized.scala:42)
-       at scala.collection.mutable.ArrayBuffer.forall(ArrayBuffer.scala:48)
-       at annex.TestRunner$.main(TestRunner.scala:143)
-       at annex.TestRunner.main(TestRunner.scala)
Caused by: java.lang.NullPointerException
        at scala.tools.util.PathResolver$Calculated$.basis(PathResolver.scala:246)
        at scala.tools.util.PathResolver$Calculated$.containers$lzycompute(PathResolver.scala:25
7)                                                                                             
        at scala.tools.util.PathResolver$Calculated$.containers(PathResolver.scala:257)
        at scala.tools.util.PathResolver.containers(PathResolver.scala:273)
        at scala.tools.util.PathResolver.computeResult(PathResolver.scala:295)
        at scala.tools.util.PathResolver.result(PathResolver.scala:278)
        at scala.tools.util.PathResolver.resultAsURLs(PathResolver.scala:290)
        at scala.tools.reflect.ReflectMain$.classloaderFromSettings(ReflectMain.scala:13)
        at scala.tools.reflect.ReflectMain$.newCompiler(ReflectMain.scala:17)
        at io.higherkindness.arktika.scalac.ArktikaPhaseChecks.<init>(ArktikaPhaseChecks.scala:1
0)                                                                                             
        ... 32 more
@pauldraper
Copy link
Contributor

pauldraper commented Oct 11, 2019

That is usually up to the test framework.

For example, the existing //test-framework/classpath:bad shows a truncated stack trace.

FAIL: //test-frameworks/classpath:bad (see /home/paul/.cache/bazel/_bazel_paul/f84776a0618f0e3dcf1c416f8fd69d56/execroot/__main__/bazel-out/k8-fastbuild/testlogs/test-frameworks/classpath/bad/test.log)
INFO: From Testing //test-frameworks/classpath:bad:
==================== Test output for //test-frameworks/classpath:bad:
org.specs2.runner.Specs2Framework: 1 tests

Test
    Test
    
    Classpath should
      ! load class
       java.lang.ClassNotFoundException: sbt.internal.inc.schema.APIsFile (CLassLoaders.scala:20)
    higherkindness.rules_scala.common.sbt_testing.ClassLoaders$$anon$1.findClass(CLassLoaders.scala:20)
    Test$.$anonfun$new$2(Test.scala:7)
    
    
    
    Total for specification Test
    Finished in 575 ms
1 example, 0 failure, 1 error
    

1 failure:
    Test

In your example, I believe the test framework has not caught the error and reported it via the usual test mechanisms, but rather allowed it to propagate all the way to main().

And in the case of a runaway error, I would not want to prune the stack trace at all.

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

No branches or pull requests

2 participants