Up to [cvs.NetBSD.org] / src / usr.bin / make / unit-tests
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.5, Sun Jan 23 16:25:54 2022 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +0 -0
lines
FILE REMOVED
tests/make: rename var-class to var-scope There is no such concept as a "variable class" in make, these tests focus on the variable scope instead.
Revision 1.4 / (download) - annotate - [select for diffs], Tue Feb 23 21:59:31 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
CVS Tags: cjep_sun2x-base1,
cjep_sun2x-base,
cjep_sun2x,
cjep_staticlib_x-base1,
cjep_staticlib_x-base,
cjep_staticlib_x
Changes since 1.3: +2 -2
lines
Diff to previous 1.3 (colored)
make: document the history of bugs in "cmdline overrides global" For performance reasons, the implementation of the simple rule "cmdline overrides global" grew into code that is much more complicated than a straight-forward implementation. This added complexity made it easy for bugs to sneak in.
Revision 1.3 / (download) - annotate - [select for diffs], Tue Feb 23 14:17:21 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.2: +1 -1
lines
Diff to previous 1.2 (colored)
make: demonstrate how to undefine variables during evaluation For a very long time now, I had thought that it would be impossible to undefine global variables during the evaluation of variable expressions. This is something that the memory management in Var_Parse relies upon, see the comment 'the value of the variable must not change'. After several unsuccessful attempts at referring to an already freed previous value of a variable, today I discovered how to unset a global variable while evaluating an expression, which has the same effect. To demonstrate that this use-after-free can reliably crash make, it would need a memory allocator with a debug mode that never re-allocates the same memory block after it has been used once. This is something that jemalloc cannot do at the moment. Valgrind would be another idea, but that has not been ported to NetBSD. Undefining a global variable while evaluating an expression is made possible by an implementation detail of the modifier ':@'. That modifier undefines the loop variable, without restoring its previous value, see ApplyModifier_Loop. By the very old conventions of ODE Make, these loop variables are named '.V.' and thus do not conflict with variables from other naming conventions. In NetBSD and pkgsrc, these loop variables are typically called 'var', sometimes '_var' with a leading underscore, which also doesn't conflict with the typical form 'VAR' of variables in the global namespace. Therefore, in practice these loop variables don't interfere with other variables. One case that can practically arise is when an outer variable has a modifier ':@word@${VAR.${word}}@' and one of the referenced variables uses the same variable name in the modifier, see varmod-loop.mk 1.10 line 91 for a detailed explanation. By using the ${:@VAR@@} modifier in a place that is evaluated with cmdline scope, it is not only possible to undefine global variables, it is possible to undefine cmdline variables as well. When evaluated in a specific make target, the expression ${:@\@@@} can even be used to undefine the variable '.TARGET', which will probably crash make with an assertion failure.
Revision 1.2 / (download) - annotate - [select for diffs], Mon Feb 22 22:04:28 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.1: +3 -0
lines
Diff to previous 1.1 (colored)
make: add test for cmdline variables overriding global variables
Revision 1.1 / (download) - annotate - [select for diffs], Sun Aug 16 12:07:51 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
make(1): add dummies for fine-grained tests, one per single feature The test names have been derived from the current manual page. All these tests are dummies right now, and the code from the existing tests will be moved into the new tests step by step. This is done to prevent modmisc, escape, varmod-edge and varmisc from growing without any bounds, and to reduce the side-effects of one test to the others.