Commit Graph

60 Commits

Author SHA1 Message Date
sjg ec98624792 Fix parsing of SUNSHCMD style :sh = assigments.
Submitted by: Will Andrews at freebsd.org
2013-08-28 21:56:49 +00:00
sjg 7217d3f346 Fix unit-tests to cope with recent change to progname 2013-07-16 19:59:28 +00:00
sjg a577c98aa7 Add unit-test for export-env and gmake export 2013-03-22 16:36:46 +00:00
sjg 15b27c94a1 Add a unit-test for .ORDER 2012-11-09 19:08:28 +00:00
sjg d912c0b39e Add unit-tests for .for 2012-06-19 23:25:53 +00:00
sjg 123e6558cd Make sure .PHONY targets get .TARGET set.
This wasn't happening when a dependency of .END.
Set .PREFIX too and add a unit-test.

PR: 43534
2011-09-29 23:38:04 +00:00
sjg 873dae776d Some systems (eg. MirBSD) use a ksh, with an echo which cannot
be used for things containing \x: etc.
Check for print or printf as builtin and use if available.
Note that a builtin will fail, if make decides a shell is not needed.
2011-06-07 00:10:20 +00:00
sjg 43c87c739c ApplyModifiers: if we parse a variable in the modifier list,
do not consider it a nested modifier set, unless it is followed by
endc, a ':' or end of string.
2011-06-03 21:10:42 +00:00
sjg 2ac5d52245 Add a test case for sysV modifier subst 2011-04-11 15:10:15 +00:00
joerg 53d81ae021 Add the :hash modifier to compute a 32bit hash of an variable.
This uses MurmurHash3 to get a reasonable collission-free hash with
small code. The result is endian neutral.
2011-04-07 01:40:01 +00:00
sjg 8892f885fd Add unit tests to check that exists(some/dir/) works
Also fix handling of sysV substitutions when lhs and variable are empty.

Also that modifiers do not cause errors during conditional tests
when undefined variables should otherwise be ok.
Ie. .if defined(nosuch) && ${nosuch:Mx} != ""
2011-03-06 00:02:14 +00:00
sjg e2f0bc58ba fix style 2010-12-10 00:37:23 +00:00
sjg d196fd3962 Need to export LC_ALL=C too 2010-12-10 00:36:33 +00:00
sjg 3e3df25ba3 Don't missinterpret targets that start with .info 2010-05-24 21:04:49 +00:00
sjg 83fb10e649 PR: 42850
Reviewed by:

Reduced the "expected to exist" dirs in path to just
/ /bin and /tmp
and change the "not expected to exist" dir to something
even less likely.
Add a comment to suggest why.
2010-04-23 15:43:28 +00:00
sjg 1870812db3 Force LANG=C to ensure sort(1) behaves as expected 2010-04-22 21:41:11 +00:00
sjg 7254a559b2 PR: 42850
Reviewed by:

modmisc: since we apply an exists() test to $paths, be conservative
in what we expect.

Run the unit tests with -r -m / so that we do not fail if there
is no sys.mk present.
2010-04-22 19:15:23 +00:00
sjg 862d4ff05d If we do .export (all) and have any variables that involve :sh
we will hit an error (var is recursive) while trying to evaluate that.
Fix, and add a unit test for this.
2010-04-21 04:25:27 +00:00
sjg dc03377f35 Process .ERROR the same as .BEGIN, .END etc
so that it cannot be the default target.
Add unit-tests for .info - .error, and .ERROR.
2010-04-08 17:41:29 +00:00
sjg 9772f81de8 Add .unexport - the exact opposite of .export
and .unexport-env which unexport's all previously .export'd globals
as well as clearing environ[].
Allow's sys.mk near total controll.

Reviewed by: apb
2009-11-19 00:30:25 +00:00
sjg b87966b319 PR: make.unexport
Reviewed by:
2009-11-19 00:30:24 +00:00
sjg f3c8b50aa4 Add .unexport - the exact opposite of .export
and .unexport-env which unexport's all previously .export'd globals
as well as clearing environ[].
Allow's sys.mk near total controll.

Reviewed by: apb
2009-11-19 00:30:24 +00:00
sjg baca35f4e0 The parser used to break dependency lines at ';' without regard
for substitution patterns.  This (perhaps coupled with the
new handling of .for variables in ${:U<value>...) caused interesting
results for lines like:

.for file in ${LIST}
for-subst:       ${file:S;^;${here}/;g}

add a unit-test to keep an eye on this.
2009-10-07 16:40:30 +00:00
sjg cd5a3748ef PR: 41998
:Ufu\:goo

should expand to fu:goo even when it appears in :M${:Ufu\:goo}
When scanning for :M do not compress \: if we know we have
to call Var_Subst.
2009-09-07 17:56:23 +00:00
sjg 55d9c66506 Update expected results to match recent changes! 2009-02-03 23:11:12 +00:00
sjg 16d084a837 If Parse_Error is called after curFile is invalid, set it to a dummy
to avoid seg-fault.  Also the NULL filename will cause ParseVErrorInternal
to skip trying to report file and line number info.

If CondToken is called outside the context of a .if etc, variables in
the expression being parsed will already be expanded, so allow for
an unqouted number to jump us back into the compare logic.
This allows ${${SomeNumber:U42} > 0:?True:False} to work anywhere.

Job_Finish should process postCommands if it has commands or children.
2008-10-29 15:37:08 +00:00
apb f46c1de7cb Use ${TOOL_SED} instead if plain sed in Makefiles. 2008-10-25 22:27:34 +00:00
sjg f2c43a72d5 VAR_CMD context is used by conditionals and other purposes, so
actually set VAR_FROM_CMD when appropriate and only skip setting in
VAR_GLOBAL when that flag is set.
2008-05-15 21:05:54 +00:00
sjg db7f6ac403 Disable this for now, VAR_CMD is abused for other purposes... 2008-05-15 18:25:12 +00:00
sjg 20275ee931 Do not set vars in VAR_GLOBAL context, if they have been set on the
command line.
Add a suitable unit-test.
2008-05-14 14:27:02 +00:00
sjg 98deadff04 If the name passed to Var_Exists contains '$' run it through Var_Subst. 2008-03-31 00:12:21 +00:00
sjg 3a5409e4eb Fix an off-by-one error in handing mal-formed modifiers.
The issue seems to have been present for some time, only showed up
when running unit-tests on SunOS.
Make sure we get an error message, but otherwise behave as before.
2007-10-09 05:55:03 +00:00
sjg f28827375c Add the ability to .export variables to the environment. 2007-10-05 15:27:45 +00:00
sjg fc23c7c758 Remove the modterm case from moderrs, the syntax errors
generated by /bin/sh on other systems are not consistent.
2006-05-11 18:48:33 +00:00
sjg 03cbcf6532 Extract the variable modifier logic to a separate function.
This cuts Var_Parse in half! and allows the modifier logic to
be used recursively - when getting modifiers via variables.

Add new unit-test, to check that certain error cases are handled
correctly.
2006-05-11 15:37:07 +00:00
apb f34c12e989 Make ".WAIT" apply recursively to all children of nodes on the right
hand side of the .WAIT, except when the recursive interpretation would
cause a cycle in the dependency graph.

Discussed in tech-toolchain.  Reviewed by christos, sjg.
2006-02-26 22:45:46 +00:00
wiz 3ea7f78b57 Fix typo. 2006-02-26 22:40:50 +00:00
sjg 701c9d99a7 Using ./bin in the test case, causes problems when 'make test' is
run from 'unit-tests' rather than the parent dir.
2006-02-26 22:20:55 +00:00
sjg 2bc18a45e6 Update man page and add test case for specifying modifiers via variable.
Also allow said variable to appear anywhere in the modifier list.
2006-02-26 21:43:00 +00:00
apb c5bdb87cca Escape dots in sed regexps. Without this patch, and without
an OBJDIR, "make test" in usr.bin/make fails.
2006-02-13 18:17:36 +00:00
sjg c3c1fc597e Expected results were not updated for comment testing. 2005-07-11 17:55:19 +00:00
rpaulo a0c960912d Add a new test case to reflect the problem found on PR toolchain/30536.
Reviewed by sjg and hubertf.
2005-06-18 14:33:15 +00:00
rpaulo d0727c5f5b Add a unit-test for comments.
Addition to PR bin/17732.
Approved by sjg and christos.
2005-06-15 22:32:22 +00:00
sjg 5f60a7de65 Add :Ox for random ordering, based on patch from
Mike M. Volokhov <mishka@apk.od.ua>
2005-06-01 17:17:34 +00:00
jmc f648d12d47 Add missing NetBSD ID tags 2004-06-30 03:26:26 +00:00
sjg 4d3fc51f60 Remove use of sh -e when running in compat mode.
Its not posix compliant and serves very little purpose.
With this change compat and jobs modes are consistent wrt how
they treat each line of a script.

Add support for the '+' command line prefix as required by posix.
Lines prefixed with '+' are executed even when -n is given.
[Actually posix says they should also be done for -q and -t]

PR:
Reviewed by: jmc
2004-05-07 08:12:15 +00:00
sjg 3c6b696332 Allow "string" and "${varspec}" on lhs of conditionals.
This makes it possible to use expressions like
${("${LIST:Msomething"}):?present:absent}
it also makes treatment of lhs and rhs more consistent, and
makes CondToken easier to read.

Update unit-test/cond1 to test new features.
2004-04-13 16:06:23 +00:00
sjg df910819de Revised patch for catching extraneous .else's
We actually need to tack condTop and skipIfLevel.
Bump MAXIF while here.
Enhance the unit-test for conditionals to exercise more code.

PR: 24420
2004-04-08 07:24:26 +00:00
sjg 8bef426d13 Add check for extraneous .else's - based on patch from Arne H. Juul
in PR/24420.
Add a unit-test for conditionals.
Also in the unit-test makefile strip any .CURDIR in output.

PR: 24420
2004-04-08 00:59:01 +00:00
sjg a3cc11808b Fix :M so that modifiers in nested variables don't terminate parsing
early.  Add a unit-test to verify it works and keeps working.
Re-jig the unit-tests so that all are sub makefiles.
2004-02-20 09:03:26 +00:00