3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-06 06:16:04 +00:00

Add tests/verilog/local_include.*

`read_verilog` supports checking both the current directory and the source directory for relative includes.  Make sure we aren't regressing that.
This commit is contained in:
Krystine Sherwin 2025-10-14 14:12:24 +13:00 committed by Emil J. Tywoniak
parent d1a628ab26
commit 1eb5181700
3 changed files with 36 additions and 0 deletions

30
tests/verilog/local_include.sh Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -eu
# only works with read_verilog
yosys='../../yosys -f verilog'
test='-p hierarchy'
subdir=subdir
source=local_include.v
include=temp_foo.v
# no include file should fail
rm -f $include
echo "logger -expect error $include 1; read_verilog $source" | $yosys
# both files local
echo 'module foo (input a, output b); assign b = a; endmodule' > $include
$yosys $test $source
# include local to cwd
mkdir -p $subdir
cp -t $subdir $source
$yosys $test $subdir/$source
# include local to source
mv -t $subdir $include
$yosys $test $subdir/$source
# include local to source, and source is given as an absolute path
$yosys $test $(pwd)/$subdir/$source