@@ -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" ,
@@ -582,7 +582,12 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
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 }
@@ -598,11 +603,14 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
598603 }
599604
600605 it(" should NOT include source line and caret with an incorrect --source-root" ) {
606+ val incorrectRoot = new File (s " incorrect_root " )
607+ incorrectRoot.mkdirs()
608+
601609 val (stdout, stderr, _) = grabStdOutErr {
602610 intercept[java.lang.Exception ] {
603611 (new ChiselStage )
604612 .execute(
605- Array (" --target" , " chirrtl" , " --source-root" , " .github " ),
613+ Array (" --target" , " chirrtl" , " --source-root" , incorrectRoot.toString ),
606614 Seq (ChiselGeneratorAnnotation (() => new ChiselStageSpec .RecoverableError ))
607615 )
608616 }
@@ -628,7 +636,7 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
628636 " --source-root" ,
629637 " ." ,
630638 " --source-root" ,
631- " src/test/resources /chisel3/sourceroot1"
639+ s " ${sys.env.get( " MILL_TEST_RESOURCE_DIR " ).get} /chisel3/sourceroot1 "
632640 ),
633641 Seq (ChiselGeneratorAnnotation (() => new ChiselStageSpec .RecoverableErrorFakeSourceInfo ))
634642 )
@@ -651,9 +659,9 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
651659 " --target" ,
652660 " chirrtl" ,
653661 " --source-root" ,
654- " src/test/resources /chisel3/sourceroot2" ,
662+ s " ${sys.env.get( " MILL_TEST_RESOURCE_DIR " ).get} /chisel3/sourceroot2 " ,
655663 " --source-root" ,
656- " src/test/resources /chisel3/sourceroot1"
664+ s " ${sys.env.get( " MILL_TEST_RESOURCE_DIR " ).get} /chisel3/sourceroot1 "
657665 ),
658666 Seq (ChiselGeneratorAnnotation (() => new ChiselStageSpec .RecoverableErrorFakeSourceInfo ))
659667 )
@@ -671,7 +679,12 @@ class ChiselStageSpec extends AnyFunSpec with Matchers with chiselTests.LogUtils
671679 val e = intercept[java.lang.Exception ] {
672680 (new ChiselStage )
673681 .execute(
674- Array (" --target" , " systemverilog" , " --source-root" , " src/test/resources/chisel3/sourceroot1" ),
682+ Array (
683+ " --target" ,
684+ " systemverilog" ,
685+ " --source-root" ,
686+ s " ${sys.env.get(" MILL_TEST_RESOURCE_DIR" ).get}/chisel3/sourceroot1 "
687+ ),
675688 Seq (ChiselGeneratorAnnotation (() => new ChiselStageSpec .ErrorCaughtByFirtool ))
676689 )
677690 }
0 commit comments