summaryrefslogtreecommitdiff
path: root/usr.bin/make/unit-tests/Makefile
AgeCommit message (Collapse)Author
2023-06-20make: allow targets to be used as multiple-inclusion guardsrillig
This style is used by FreeBSD, among others.
2023-06-16tests/make: add test for multiple-inclusion guardsrillig
2023-06-16tests/make: clean up tests for the ':M' and ':S' modifiersrillig
2023-06-01tests/make: clean up comments, extend a few testsrillig
2023-05-10tests/make: clean up tests for .for loopsrillig
Most of the tests from forloop.mk were already in directive-for.mk.
2023-05-09make: add :mtime to provide mtime of filesjg
The value of the variable is passed to stat(2) and st_mtime is new value. An optional arg can be used if stat(2) fails, otherwise the current time is used. See varmod-mtime.mk for usage examples.
2023-02-25make: meta-ignore tests will not work if TMPDIR is /tmpsjg
Since /tmp and /var/tmp are always part of .MAKE.META.IGNORE_PATHS the varname-dot-make-meta-ignore_* tests will not work if TMPDIR is either (or subdir) of those.
2023-02-23Add unit-tests for .MAKE.META.IGNORE_*sjg
These unit-tests should only be run if TEST_MAKE has a valid .MAKE.PATH_FILEMON to indicate that filemon is supported. All three tests use the same meta-ignore.inc which runs three sub-makes one to initialize the target .meta file two to ignore a file using .MAKE.META.IGNORE_{PATHS,PATTERNS,FILTER} three to verify that without .MAKE.META.IGNORE_* the target is out of date. Fix the order of _SED_CMDS to avoid errors when ${MAKE:T} appears in .OBJDIR
2023-01-24make: .SYSPATH: to add dirs to sysIncPathsjg
.SYSPATH: with no sources will clear sysIncPath otherwise sources are added Reviewed by: rillig
2023-01-23make: .[NO]READONLY for control of read-only variablessjg
Reviewed by: rillig
2023-01-19tests/make: rename files that are not test casesrillig
2023-01-19tests/make: add tests for whitespace in leading '@+-'rillig
2022-09-25tests/make: fix test for option '-e' (broken since 2022-01-23)rillig
2022-09-10tests/make: be more specific about the egrep compatibilityrillig
2022-09-09Handle deprecation of egrepsjg
2022-09-03Only update distrib/sets/lists/tests/mi with valid filessjg
sync-mi: use CVS/Entries to ensure we only update distrib/sets/lists/tests/mi with files known to CVS. Reviewed by: rillig
2022-09-02Enable make/unit-tests/directive-for-breaksjg
Also ensure MAKE_VERSION is ignored.
2022-09-02make: add .break to terminate .for loop earlysjg
When .break is encountered within a .for loop it causes immediate termination. Outside of a .for loop .break causes a parse error. Reviewed by: christos
2022-08-25tests/make: fix canonicalization for single-digit day of monthrillig
2022-08-24make: prevent future out-of-bounds errors when parsing expressionsrillig
A modifier in an expression ends not only at the next ':' or at the closing '}' or ')', but also at the end of the string. Previously, testing for the end of the string had been done separately, which was error-prone since 2006-05-11, when indirect modifiers were introduced. Since then, it was possible that the string terminator '\0' was accidentally skipped in cases where the loop condition only tested for the ending character. When parsing indirect modifiers, the ending character is indeed '\0', but when parsing direct modifiers, it is '}' or ')'. A welcome side effect is that in the case of unclosed expressions such as '${VAR:Modifier', the amount of error messages is reduced from 2 or 3 to only 1. The removed error messages were wrong and thus confusing anyway.
2022-07-26Pass MAKEOBJDIR to opt-m-include-dirsjg
Prevent makeing opt-m-include-dir.tmp in src tree. Reviewed by: rillig
2022-06-10tests/make: reword comment in Makefile to be more specificrillig
2022-06-02Increase the resource limit so these tests pass on hppa.skrll
LGTM from Roland
2022-05-23tests/make: document and demonstrate .for i containing .if empty(i)rillig
PR bin/43821 describes the inconsistency that in a '.for i' loop, the condition '.if ${i:M*.c}' works since 2009 while the seemingly equivalent condition '.if !empty(i:M*.c)' does not access the variable 'i' from the .for loop but instead the global 'i'. Resolving this situation in a backwards-compatible and non-surprising way is hard, as make has grown several features during the last 20 years that interact in various edge cases. For now, document the most obvious pitfalls.
2022-05-08tests/make: remove test varquoterillig
The test varmod-quote-dollar covers the same topic.
2022-05-08tests/make: migrate cond1 test to other, more specific testsrillig
The tests in cond1 were a mixture of "everything related to conditions", and the test cases were heavily dependent on each other, which made them hard to understand. Move each test case to its corresponding special-purpose test.
2022-05-07make: allow to randomize build order of targetsrillig
In complex dependency structures, when a build fails, a probable cause is a missing dependency declaration between some files. In compat mode, the build order is deterministic, in jobs mode, it is somewhat deterministic. To explore more edge cases, add the line ".MAKE.MODE += randomize-targets" somewhere in the makefile. Fixes PR bin/45226 by riastradh. Reviewed by christos.
2022-04-18make: only switch to POSIX mode if '.POSIX:' is the first linerillig
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html says that in order to make a makefile POSIX-conforming, its first non-comment line must be the special dependency line '.POSIX:' without any source dependencies. Previously, make switched to POSIX mode even if such a line occurred anywhere else, which was allowed by POSIX but was deep in the "unspecified behavior" area. For NetBSD make, there is no big difference since it doesn't ship any <posix.mk> file, this change mainly affects the bmake distribution. Previously, makefiles that contain '.POSIX:' somewhere in the middle could fail due to <posix.mk> resetting .SUFFIXES, among other things. Suggested by Simon J. Gerraty, who also reviewed an earlier version of this change.
2022-03-26make: fix crash on .undef of an environment variable (since 2020-10-06)rillig
2022-03-25tests/make: suppress -DCLEANUP output in test deptgt-phonyrillig
2022-02-12tests/make: document the history of bugs in '-k' moderillig
Reported in PR#49720 in 2015, fixed independently in compat.c 1.199 from 2020-12-07.
2022-02-12tests/make: demonstrate bug for .SILENT in jobs mode (since 2003)rillig
Reported 2011 in PR#45356.
2022-02-09tests/make: remove redundant 'echo' from variable assignmentsrillig
Before main.c 1.231 from 2014-09-09, a variable assignment using the operator '!=' generated a warning "Couldn't read shell's output" if the output of the command was empty. The simplest way to suppress this wrong warning was to add an empty 'echo' to the command. This hack is no longer needed.
2022-02-09make: fix mistakes, spelling and typos in comments and manual pagerillig
No binary change for -DNDEBUG.
2022-02-09make: prefix the warning about read-only .OBJDIR with a colonrillig
For consistency with the other warnings.
2022-02-09tests/make: use more distinctive placeholder for TMPDIRrillig
2022-02-07tests/make: demonstrate combination of .USE with transformation rulerillig
Reported in 2003 in PR toolchain/20993. Linking a transformation rule with .USE or .USEBEFORE node makes the transformation rule fail.
2022-01-27numEntries can varysjg
2022-01-27Do not allow /usr/obj to cause failure.sjg
2022-01-23tests/make: migrate modts to varmod-to-separator and explainrillig
2022-01-23tests/make: rename var-class to var-scoperillig
There is no such concept as a "variable class" in make, these tests focus on the variable scope instead.
2022-01-23tests/make: extend test suite, move old tests to 2020 schemerillig
The tests from envfirst.mk are now in opt-env.mk. The tests from modword.mk are now in varmod-select-words.mk.
2022-01-22tests/make: explore edge cases involving .ifmakerillig
2022-01-19tests/make: demonstrate wrong location in diagnostic (since 2018-12-22)rillig
When a target has multiple places where commands are defined, the diagnostics mixed up the filename in some cases.
2022-01-11tests/make: clean up after test for option '-dF'rillig
When the file for the debug log cannot be opened, make exits immediately. This doesn't give the test a chance to clean up the temporary log file. Instead of trying to treat a regular file as a directory and create a file in it, assume that the directory /nonexistent-$uuid is actually nonexistent. This leads to the same kind of error message, independent of strerror(3).
2022-01-09tests/make: add placeholders for .PARSEDIR and .INCLUDEDFROMDIRrillig
When run via 'cd usr.bin/make/unit-tests && make test', the tests are in the current directory. When run via ATF, the tests are in /usr/tests/usr.bin/make/unit-tests, while the current directory is a temporary directory. Allow both variants, plus others that may occur in the bmake distribution.
2021-12-28tests/make: clean up after test 'opt-debug-file'rillig
2021-12-28tests/make: document inconsistencies between '!=' and '::!='rillig
Found while trying to make the error messages from Cmd_Exec more detailed.
2021-12-23tests/make: explain the current behavior of the option '--version'rillig
2021-12-14make: remove unreachable code for parsing the dependency operatorrillig
At the point where ParseDependencyOp is called, cp is guaranteed to point to either ':' or '!'. No functional change.