@@ -342,7 +342,7 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
342342 }
343343
344344 it(" should emit Annotations inline in emitted CHIRRTL" ) {
345- val targetDir = os.pwd / " ChiselStageSpec" / " should-inline-Annotations-in-emitted-CHIRRTL"
345+ val targetDir = baseDir / " ChiselStageSpec" / " should-inline-Annotations-in-emitted-CHIRRTL"
346346
347347 val args : Array [String ] = Array (
348348 " --target" ,
@@ -578,16 +578,22 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
578578 }
579579
580580 it(" should include source line and a caret for recoverable errors" ) {
581- val (stdout, stderr, _ ) = grabStdOutErr {
581+ val (stdout, stderr, ret ) = grabStdOutErr {
582582 intercept[java.lang.Exception ] {
583583 (new ChiselStage )
584584 .execute(
585- Array (" --target" , " chirrtl" ),
585+ Array (
586+ " --target" ,
587+ " chirrtl" ,
588+ " --source-root" ,
589+ s " ${sys.env.get(" MILL_WORKSPACE_ROOT" ).get}"
590+ ),
586591 Seq (ChiselGeneratorAnnotation (() => new ChiselStageSpec .RecoverableError ))
587592 )
588593 }
589594 }
590595
596+ println(ret)
591597 val lines = stdout.split(" \n " )
592598 // Fuzzy includes aren't ideal but there is ANSI color in these strings that is hard to match
593599 lines(0 ) should include(
@@ -598,11 +604,14 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
598604 }
599605
600606 it(" should NOT include source line and caret with an incorrect --source-root" ) {
607+ val incorrectRoot = new File (s " incorrect_root " )
608+ incorrectRoot.mkdirs()
609+
601610 val (stdout, stderr, _) = grabStdOutErr {
602611 intercept[java.lang.Exception ] {
603612 (new ChiselStage )
604613 .execute(
605- Array (" --target" , " chirrtl" , " --source-root" , " .github " ),
614+ Array (" --target" , " chirrtl" , " --source-root" , incorrectRoot.toString ),
606615 Seq (ChiselGeneratorAnnotation (() => new ChiselStageSpec .RecoverableError ))
607616 )
608617 }
@@ -628,7 +637,7 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
628637 " --source-root" ,
629638 " ." ,
630639 " --source-root" ,
631- " src/test/resources /chisel3/sourceroot1"
640+ s " ${sys.env.get( " MILL_TEST_RESOURCE_DIR " ).get} /chisel3/sourceroot1 "
632641 ),
633642 Seq (ChiselGeneratorAnnotation (() => new ChiselStageSpec .RecoverableErrorFakeSourceInfo ))
634643 )
@@ -651,9 +660,9 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
651660 " --target" ,
652661 " chirrtl" ,
653662 " --source-root" ,
654- " src/test/resources /chisel3/sourceroot2" ,
663+ s " ${sys.env.get( " MILL_TEST_RESOURCE_DIR " ).get} /chisel3/sourceroot2 " ,
655664 " --source-root" ,
656- " src/test/resources /chisel3/sourceroot1"
665+ s " ${sys.env.get( " MILL_TEST_RESOURCE_DIR " ).get} /chisel3/sourceroot1 "
657666 ),
658667 Seq (ChiselGeneratorAnnotation (() => new ChiselStageSpec .RecoverableErrorFakeSourceInfo ))
659668 )
@@ -671,7 +680,12 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
671680 val e = intercept[java.lang.Exception ] {
672681 (new ChiselStage )
673682 .execute(
674- Array (" --target" , " systemverilog" , " --source-root" , " src/test/resources/chisel3/sourceroot1" ),
683+ Array (
684+ " --target" ,
685+ " systemverilog" ,
686+ " --source-root" ,
687+ s " ${sys.env.get(" MILL_TEST_RESOURCE_DIR" ).get}/chisel3/sourceroot1 "
688+ ),
675689 Seq (ChiselGeneratorAnnotation (() => new ChiselStageSpec .ErrorCaughtByFirtool ))
676690 )
677691 }
0 commit comments