Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/usr.bin/make/unit-tests
Date: Thu, 9 Dec 2021 23:57:19 +0000
From: "Roland Illig" <rillig%netbsd.org@localhost>
Message-ID: <20211209235719.CDE20FAEC%cvs.NetBSD.org@localhost>
| Log Message:
| tests/make: prevent the bug from cond.c 1.283 from happening again
This new test (while OK of itself) would not have done that.
I suspect this test would have passed with that broken version.
The actual condition that failed was (effectively)
.if 1 && (defined(VAR) || ${VAR} != "string")
not .if 0
In that, the "i &&" part is largely irrelevant, you didn't
touch && parsing in the change that broke things, just ||
parsing, so implementing a test that tests short circuit
eval of && will not help (this one, it could help others).
This is actually not a good text of short circuit eval of
&& though, it is complicated by the complex (and breakable,
as seen) condition on the rhs, better would be
.if defined(VAR) && ${VAR} == "yes"
or something simple like that.
With simple tests for basic short circuit eval, you can then add
tests for more complex cases
.if 1 && 1 && defined(VAR) && ${VAR} == "yes"
(and similar for ||), and after those pass, tests for various complicated
combinations of || and && (all with something relying on short circuit eval
to verify that things are not tested which should not be).
kre
Home |
Main Index |
Thread Index |
Old Index