-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[firtool] Add include directory flag (#4539)
Can be used to provide nicer diagnostics or to help find supporting files like annotations.
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
; Test interaction between include directory and annotation files. | ||
|
||
; Setup: | ||
; RUN: rm -rf %t && mkdir -p %t | ||
; RUN: echo '[{ "class": "circt.test", "target": "~Test" }]' > %t/test.anno.json | ||
|
||
; Confirm annotation file not found without include directory provided: | ||
; RUN: not firtool %s --parse-only --annotation-file test.anno.json | ||
; Confirm annotation file is found. | ||
; RUN: firtool %s --parse-only --annotation-file test.anno.json -I %t | grep circt.test | ||
|
||
circuit Test: | ||
module Test: | ||
output o : UInt<1> | ||
o <= UInt<1>(0) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
; Test using "include directory" options for resolving source locators in diagnostics. | ||
|
||
; Setup: | ||
; RUN: rm -rf %t && mkdir -p %t/subdir %t/alt/subdir | ||
; RUN: echo -e "foo\ngenerate_bad_circuit" > %t/subdir/source.dummy | ||
; RUN: echo -e "foo\nalternate" > %t/alt/subdir/source.dummy | ||
|
||
; Check behavior when unable to find the mentioned file. | ||
; RUN: not firtool %s 2>&1 | FileCheck %s --check-prefixes=COMMON,MISSING | ||
; RUN: not firtool %s -I %t/subdir 2>&1 | FileCheck %s --check-prefixes=COMMON,MISSING | ||
|
||
; Check referenced file is found when its directory is specified. | ||
; RUN: not firtool %s -I %t -I %t/subdir 2>&1 | FileCheck %s --check-prefixes=COMMON,FOUND | ||
|
||
; Check search order. | ||
; RUN: not firtool %s -I %t/alt -I %t 2>&1 | FileCheck %s --check-prefixes=COMMON,ALTERNATE | ||
; RUN: not firtool %s -I %t -I %t/alt 2>&1 | FileCheck %s --check-prefixes=COMMON,FOUND | ||
|
||
; COMMON: subdir/source.dummy:2:3: | ||
; MISSING-NOT: alternate | ||
; MISSING-NOT: generate | ||
; ALTERNATE-NEXT: alternate | ||
; FOUND-NEXT: generate_bad_circuit | ||
|
||
; Invalid circuit that generates errors with the specified source locator: | ||
circuit Test: @[subdir/source.dummy 2:3] | ||
module Oops: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters