Skip to content

Commit 238099e

Browse files
oharboeclaude
andcommitted
test: vars values are written as make holds them
A value is written as make holds it: an empty one too, which make spells '' (#1336), one with '=' in it (#3292), and a list such as GND_NETS_VOLTAGES, one quoted value in every file now that its special case is retired (#2673). The blanks make's foreach puts around each line are not part of the value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent d25c3c5 commit 238099e

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎flow/test/test_generate_vars.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@ def test_flow_home_set_once(self):
136136
self.assertEqual([l for l in sh if "FLOW_HOME=" in l], [sh[0]])
137137

138138

139+
class TestValues(VarsTestCase):
140+
"""A value is written as make holds it: an empty one too, which make
141+
spells '' (#1336), one with '=' in it (#3292), and a list such as
142+
GND_NETS_VOLTAGES, a single quoted value in every file (#2673). The
143+
blanks make's foreach puts around each line are not part of it."""
144+
145+
def test_empty_value(self):
146+
lines = self.generate("EMPTY=''\n BLANK= \n")
147+
for name in ["EMPTY", "BLANK"]:
148+
self.assertIn(f'export {name}=""', lines["sh"])
149+
self.assertIn(f'set env({name}) ""', lines["tcl"])
150+
self.assertIn(f"set env {name} ", lines["gdb"])
151+
152+
def test_value_with_equals(self):
153+
lines = self.generate("SYNTH_ARGS=-flatten -abc9=1\n")
154+
self.assertIn('export SYNTH_ARGS="-flatten -abc9=1"', lines["sh"])
155+
156+
def test_list_value(self):
157+
lines = self.generate("GND_NETS_VOLTAGES=VSS 0.0\n")
158+
self.assertIn('export GND_NETS_VOLTAGES="VSS 0.0"', lines["sh"])
159+
self.assertIn('set env(GND_NETS_VOLTAGES) "VSS 0.0"', lines["tcl"])
160+
self.assertIn("set env GND_NETS_VOLTAGES VSS 0.0", lines["gdb"])
161+
162+
139163
class TestCommandLine(VarsTestCase):
140164
"""The flow's Makefile runs it as `generate_vars.py <basename>` with
141165
the variables in its environment."""

0 commit comments

Comments
 (0)