Skip to content

Commit 1296f7c

Browse files
oharboeclaude
andcommitted
test: vars spell the flow's paths through FLOW_HOME
The vars spell the flow's paths through FLOW_HOME, so that they work wherever the flow is: a path under FLOW_HOME and one under the ORFS root above it (#1331), wherever in the value it is (#1976), and each one of several (#2673). The Tcl and gdb files read FLOW_HOME from the environment (#1386). SCRIPTS_DIR is the scripts next to the vars files, which an issue archive carries (#2012). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 238099e commit 1296f7c

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

‎flow/test/test_generate_vars.py‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,42 @@ def test_list_value(self):
160160
self.assertIn("set env GND_NETS_VOLTAGES VSS 0.0", lines["gdb"])
161161

162162

163+
class TestFlowHome(VarsTestCase):
164+
"""The vars spell the flow's paths through FLOW_HOME, so that they
165+
work wherever the flow is: a path under FLOW_HOME and one under the
166+
ORFS root above it (#1331), wherever in the value it is (#1976), and
167+
each one of several (#2673). Tcl and gdb read FLOW_HOME from the
168+
environment (#1386). SCRIPTS_DIR is the scripts next to the vars
169+
files, which an issue archive carries (#2012)."""
170+
171+
def test_flow_and_orfs_paths(self):
172+
lines = self.generate(
173+
f"VERILOG_FILES={self.flow}/designs/a.v {self.orfs}/tools/b.v\n"
174+
f"SYNTH_ARGS=-I{self.flow}/include\n"
175+
)
176+
self.assertIn(
177+
'export VERILOG_FILES="${FLOW_HOME}/designs/a.v ${FLOW_HOME}/../tools/b.v"',
178+
lines["sh"],
179+
)
180+
self.assertIn('export SYNTH_ARGS="-I${FLOW_HOME}/include"', lines["sh"])
181+
182+
def test_tcl_and_gdb_read_flow_home_from_the_environment(self):
183+
lines = self.generate(f"LIBS={self.flow}/a.lib {self.flow}/b.lib\n")
184+
self.assertIn(
185+
'set env(LIBS) "$::env(FLOW_HOME)/a.lib $::env(FLOW_HOME)/b.lib"',
186+
lines["tcl"],
187+
)
188+
self.assertIn(
189+
'set env LIBS getenv("FLOW_HOME")/a.lib getenv("FLOW_HOME")/b.lib',
190+
lines["gdb"],
191+
)
192+
193+
def test_scripts_dir_next_to_the_vars(self):
194+
lines = self.generate(f"SCRIPTS_DIR={self.flow}/scripts\n")
195+
self.assertIn('export SCRIPTS_DIR="./scripts"', lines["sh"])
196+
self.assertIn('set env(SCRIPTS_DIR) "./scripts"', lines["tcl"])
197+
198+
163199
class TestCommandLine(VarsTestCase):
164200
"""The flow's Makefile runs it as `generate_vars.py <basename>` with
165201
the variables in its environment."""

0 commit comments

Comments
 (0)