Commit graph

177 commits

Author SHA1 Message Date
rillig
c7a475a5e0 regress/infra-unittests: add example tests for mk/help/help.awk
There are many more scenarios that need test cases, but this is a start.
2020-03-30 06:40:53 +00:00
rillig
5ae9338639 regress/infra-unittests: add test for SUBST_FILES without effect 2020-03-28 12:08:28 +00:00
rillig
b17ebc4cec regress/infra-unittests: rewrite documentation, adjust code a little
The documentation now starts with a high-level introduction instead of
listing only the details.

The name of the function test_file had to be changed since the old name
was not expressive enough. Same for the variable real_pkgsrcdir.
2020-03-27 22:56:29 +00:00
rillig
f2cbf3686f regress/infra-unittests: add more tests for mk/extract/extract
These tests demonstrate that it is not easy to exclude only one top-level
directory from being extracted, using the example of lang/gcc*, which has
a top-level directory contrib/ that contains shell programs with
non-portable code, but the same archive also contains libjava/contrib, and
that should still be extracted.
2020-03-27 21:41:33 +00:00
rillig
83a0097b05 regress/infra-unittests: add test for not extracting certain files 2020-03-25 07:47:10 +00:00
rillig
b885ff75ea mk/subst.mk: ignore directories in SUBST_FILES
Seen in multimedia/libmp4v2, where a pattern also matches the CVS
directory from the distfiles.
2020-03-22 13:19:50 +00:00
rillig
4d12683e99 mk/subst.mk: use the same severity for all messages
The severity now depends only on the setting of SUBST_NOOP_OK. Right now
this means that some former warnings will be reported as info only, but
that will change after switching the default of SUBST_NOOP_OK after
2020Q1. Then they will all be reported as warnings, followed by the final
error saying that the pattern has no effect.

This change makes it easier to detect inconsistencies and outdated
definitions, for example by setting the global SUBST_NOOP_OK=no and
redefining WARNING_MSG to actuall fail.
2020-03-22 12:15:59 +00:00
rillig
e9be1468cd regress: migrate SUBST test to the other SUBST tests
In the old test code, the input and output data for each test case were
in different files. This was too far apart to relate them. In addition,
all test cases were merged into a single big test, which made it hard to
tell the topics apart.
2020-03-21 18:43:02 +00:00
rillig
8e82112864 mk/subst.mk: add global SUBST_SHOW_DIFF variable
This is useful in bulk builds or when trying to understand what happens
under the hood, since the SUBST code leaves no .orig files around.
2020-03-21 13:30:35 +00:00
rillig
f5ff99ee4e regress/infra-unittests: add more tests for subst.mk 2020-03-21 12:47:13 +00:00
rillig
68730ad3f1 mk/subst.mk: fix bmake warnings in case of duplicate SUBST classes 2020-03-21 12:22:31 +00:00
rillig
968d84b496 regress/infra-unittests: fix assertion --file-is-lines
It had compared the actual output with itself, instead of comparing it to
the expected output.
2020-03-21 06:53:18 +00:00
rillig
5fb2a28139 regress/infra-unittests: add tests for special characters in subst.mk 2020-03-20 21:27:04 +00:00
rillig
caf5567d50 show-all: fix output for list variables containing dollar characters
Before, variables containing dollar characters displayed so wrong that it
was hard to explain.

To fix the problem, I typed almost random characters into the code until
the output was exactly as expected. I still do not understand:

* why the list variables need 8 dollars to survive the @x@ loop,
* why the code only works if the dollars come from an external variable
  instead of being written inline,
* why the backslash in the :C modifier needs to be doubled.

Anyway, the output of "bmake show-all-extract" now contains the shell
variable $${extract_file}, just as it should. The dollars are now doubled
in the output and thereby match the source code from the Makefile
exactly.
2020-03-20 16:39:03 +00:00
rillig
2f3031cc27 regress/show-all: demonstrate wrong output of show-all
A real-life example of this pattern is EXTRACT_CMD_DEFAULT, which refers
to DOWNLOADED_DISTFILE, which is defined as "$${extract_file}".

Until mk/extract/extract.mk r1.40, that argument was discarded from the
output completely. With the surrounding quotes at least the quotes are
visible in the output of "bmake show-all-extract".
2020-03-20 15:45:12 +00:00
rillig
d1f0656e94 mk/subst.mk: evaluate SUBST_MESSAGE only once, and late
The default value of SUBST_MESSAGE is based on SUBST_FILES, and that
variable may use the :sh modifier to list files from WRKSRC, which may
not exist at load time.
2020-03-20 09:00:44 +00:00
rillig
5f9f5de3b2 regress/infra-unittests: restructure test infrastructure
Before, the first assertion failure quit immediately. This prevented
getting a complete picture of the situation that failed. Now the
assertions continue the test and fail at the very end.
2020-03-20 08:56:42 +00:00
rillig
59545c5e44 mk/subst.mk: fix early evaluation of SUBST_FILES
In the case of pkglocaledir, the SUBST_FILES are generated by a shell
command. That command assumes that the WRKDIR already exists. Therefore
SUBST_FILES must be evaluated as late as possible.

See mk/configure/replace-localedir.mk; an example package that fails is
devel/gettext-tools.
2020-03-20 06:17:48 +00:00
rillig
9f551a7b5a regress/infra-unittests: add more tests for subst.mk failures 2020-03-19 22:46:34 +00:00
rillig
7c75c44ec7 regress/pkg-options: remove obsolete _PKG_SILENT 2020-03-19 19:56:47 +00:00
rillig
9ca0fcba18 regress/infra-unittests: add tests for mk/subst.mk 2020-03-19 16:58:35 +00:00
rillig
538c9b877c mk/pkginstall/files: allow spaces in configuration file names
Fixes PR pkg/42191.
2020-02-11 01:59:30 +00:00
rillig
3d253ab785 mk/bsd.pkg.mk: support spaces in PATH directories
Fixes PR pkg/53959.
2020-02-09 22:39:20 +00:00
rillig
93997228c5 regress/path: demonstrate wrong handling of PATH directories with spaces
See PR pkg/53959.
2020-02-09 22:28:58 +00:00
rillig
7f191db6be mk/pkgformat: include only relevant ident strings in +BUILD_VERSION
Before, not only files containing an RCS Id were recorded in the
+BUILD_VERSION file but also files containing text that looked similar to
an RCS Id were recorded, even though these didn't contain any valuable
version information.

The effect was that before this change, pkgtools/pkglint was built over
and over again by the bulk builds since pbulk uses a different regular
expression for detecting modified files.

The regular expression for unexpanded RCS Ids is added to record files
that have never been checked in to CVS, just to have them recorded and to
distinguish them from the final committed version.

See https://mail-index.netbsd.org/tech-pkg/2020/01/11/msg022489.html.
2020-01-15 20:11:11 +00:00
rillig
8b2c7d624a mk/pkgformat: include only relevant ident strings in +BUILD_VERSION
Before, not only files containing an RCS Id were recorded in the
+BUILD_VERSION file but also files containing text that looked similar to
an RCS Id were recorded, even though these didn't contain any valuable
version information.

The effect was that before this change, pkgtools/pkglint was built over
and over again by the bulk builds since pbulk uses a different regular
expression for detecting modified files.

The regular expression for unexpanded RCS Ids is added to record files
that have never been checked in to CVS, just to have them recorded and to
distinguish them from the final committed version.

See https://mail-index.netbsd.org/tech-pkg/2020/01/11/msg022489.html.
2020-01-15 20:03:10 +00:00
rillig
9e5c981f22 regress/plus_build_version: fix test 2020-01-15 19:37:24 +00:00
rillig
20ce8f0b79 regress/plus_build_version: document obvious uses of RCS Ids 2020-01-11 13:04:21 +00:00
rillig
bcedb05abc regress/plus_build_version: adjust the expanded RCS Ids
These values could not be guessed before the previous commit.
2020-01-11 12:26:37 +00:00
rillig
155c26548f regress/plus_build_version: RCS Id extraction for +BUILD_VERSION
In pkgtools/pkglint, there are several lines that look almost like RCS
Ids. Some parts of the pkgsrc infrastructure expand them and some others
don't. This needs to be fixed so that all parts of pkgsrc agree what is a
complete RCS Id and what isn't.

As long as that is not the case, pbulk unnecessarily builds pkglint over
and over again, even if nothing changed. There are probably other
unintended side effects as well that just haven't been discovered or
considered grave enough.
2020-01-11 12:24:32 +00:00
rillig
7fb2cc5c7b regress: remove Makefile
The regress/ directory does not contain pkgsrc packages, therefore it
should not be listed as a SUBDIR in the top-level Makefile.

This wrong impression could be caused because most of the regression
tests have a Makefile that looks like an actual package Makefile. But
this alone doesn't mean that these are packages. The only relevant file
for a regression test is the spec file. If that test uses a package
Makefile or not is an implementation detail of each test.
2020-01-11 11:09:35 +00:00
rillig
f2a99a9dbc regress/make-env-phases: fix test by ignoring changes to *FLAGS
The CPPFLAGS, CFLAGS, CXXFLAGS and LDFLAGS differ between the build phase
and the install phase. It's only a minor difference but may still
influence packages that use these flags at install time, even though they
shouldn't.

For now just document that the flags differ.
2019-12-17 16:01:28 +00:00
wiz
86a6754eff regress/Makefile: add reasons for commenting out entries 2019-12-12 04:35:21 +00:00
wiz
4222b21e25 regress: comment out two directories without Makefiles 2019-12-08 10:22:09 +00:00
rillig
9a544993f5 regress/check-perms: add test for broken CHECK_PERMS_AUTOFIX
The variable CHECK_PERMS_AUTOFIX has been existing since 2006 but is not
used in any package. This may be because it is not helpful in any way.
When a package sets this variables to yes, the permission errors are not
silently fixed, but the build still fails instead. This behavior is not
useful in any way and thus needs to be fixed.

See https://mail-index.netbsd.org/tech-pkg/2019/08/thread1.html#021828
2019-09-19 23:53:36 +00:00
rillig
7c3ef3e6ea lang/python: fix PYVERSSUFFIX escaping for print-PLIST
Before, the filename "3270" was wrongly replaced with "${PYVERSSUFFIX}"
since the version number "3.7", when interpreted as a regular expression,
matched that filename.
2019-07-17 18:34:16 +00:00
rillig
106ef90f5c regress/print-plist: fix syntax error after almost 15 years
The race for the oldest undiscovered pkgsrc bug still goes on. 15 years
is hard to beat, but definitely possible.
2019-07-17 17:56:22 +00:00
rillig
122d791da2 mk/tools: in the wrapper log, quote arguments containing = naturally 2019-05-22 20:47:05 +00:00
rillig
51148ded41 regress: add gnu-configure-strict to SUBDIRS 2019-05-04 15:17:39 +00:00
rillig
bc4f604de5 mk/configure: assist in finding unrecognized configure options
Instead of giving instructions, just to the work automatically as far as
it can be automated.
2019-05-04 15:16:50 +00:00
rillig
5b57509b90 regress/buildlink-libtool: fix failing test
The comment above that test was a copy-and-paste error. It got almost 15
years old.
2019-03-24 21:09:21 +00:00
rillig
4bfb903a41 regress/pkg-options: fix regression test for PKG_OPTIONS framework
Just a few changes in the wording, which have been introduced in 2007.
2019-03-24 20:57:59 +00:00
rillig
81a41d0b94 mk/tools: correctly quote arguments in the tool wrapper log
Before, the tool arguments were written to the log as plain strings. Now
the arguments are properly quoted, which makes it possible to replay the
commands by copying them from the .work.log file.

This only affects tools that are shell builtins (echo, true, false), get
additional arguments (mkdir -p) or define a custom TOOLS_SCRIPT
(pkg-config, to set an environment variable; or autotools). Tools that
are symlinked to the real tool are not affected.

The calls to the compiler are already properly logged since cwrappers
takes care of that. This commit therefore makes the log entries for the
compilers and the other tools more similar.
2019-03-24 11:29:19 +00:00
rillig
575f219e37 mk/tools: fix quoting when logging tool invocations
When a package or the infrastructure defined a tool with custom
TOOLS_ARGS or TOOLS_SCRIPT containing special characters, these could
lead to unintuitive interactions at the time when that tool invocation
was logged in the tool wrapper log. Some of the logging output ended up
on stdout, while some of the normal output ended up in the log, and parts
of the quoted arguments were even evaluated as shell commands.

The logging of the wrapped tool commands is not perfect yet, but at least
it's much more predictable now.
2019-03-24 08:40:07 +00:00
rillig
492beb29f5 regress/tools: show that TOOLS_SCRIPT is not always logged properly 2019-03-23 22:59:11 +00:00
rillig
70fd82fc7e regress/tools: demonstrate wrong shell quoting in the tools wrapper 2019-03-22 22:41:06 +00:00
rillig
23128f791d mk/tools: fix unintended filename expansion in the tool wrapper log file 2019-03-22 22:13:21 +00:00
rillig
32d0165e0f regress/tools: demonstrate wrong quoting in tools wrapper logging 2019-03-22 20:56:16 +00:00
rillig
40cf71365f regress/infra-unittests: add small framework for testing mk/ with mocks 2019-03-21 21:45:30 +00:00
rillig
ffb8542f3f regress/compiler: fix regression test 2019-03-17 12:20:09 +00:00