Up to [cvs.NetBSD.org] / src / usr.bin / make / unit-tests
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
tests/make: add tests for legacy local variables and sorting
make: fix mistakes, spelling and typos in comments and manual page No binary change for -DNDEBUG.
make: use fixed type for comparing numbers using the modifier ':On' When the modifier ':On' was added on 2021-07-30, there were concerns that pre-C99 environments would not have the type 'long long', therefore the type was made configurable, but parsing such numbers was hard-coded to using strtoll. To improve compatibility with C90 environments, use 'long' and 'strtol' in these environments. In C99 environments, use 'long long' and 'strtoll', to account for larger file sizes. If the flexibility of choosing yet another type for these numbers should ever arise, it can still be implemented. Until then, reduce the number of possible build configurations.
tests/make: fix test for the variable modifier ':On' The variable modifier ':On' sorts words numerically. If these words are not numeric at all, they get assigned the numeric value 0. Internally, ':On' uses qsort for sorting the words. Since qsort is not specified to use a stable sorting algorithm, the test data must only use words that either are written in the same way or that are numerically different. The test varmod-order failed this requirement by trying to numerically sort a list of non-numeric words. This led to different results on BSD and Ubuntu, as could be expected. To fix the tests, distinguish between words and numbers in the tests. While here, clean up the tests for all variants of the variable modifier ':O'. Found by sjg on Ubuntu.
tests/make: split tests for the variable modifier ':O' The tests for parse errors are now in varmod-order, which lets the other tests focus on the desired behavior of the modifiers.
make: handle parse errors in ':O' uniformly Previously, the error handling for the variable modifier ':O' differed depending on the exact variant and in some cases led to misleading or missing diagnostics.
make: fix typo in manual page, add more tests for the new ':On'
Add :On for numeric sort Reviewed by: christos rillig