NetworkManager/src/tests
Thomas Haller 3ced486f41
libnm/match: extend syntax for match patterns with '|', '&', '!' and '\\'
For simple matches like match.interface-name, match.driver, and
match.path, arguably what we had was fine. There each element
(like "eth*") is a wildcard for a single name (like "eth1").

However, for match.kernel-command-line, the elements match individual
command line options, so we should have more flexibility of whether
a parameter is optional or mandatory. Extend the syntax for that.

- the elements can now be prefixed by either '|' or '&'. This makes
  optional or mandatory elements, respectively. The entire match
  evaluates to true if all mandatory elements match (if any) and
  at least one of the optional elements (if any).
  As before, if neither '|' nor '&' is specified, then the element
  is optional (that means, "foo" is the same as "|foo").

- the exclamation mark is still used to invert the match. If used
  alone (like "!foo") it is a shortcut for defining a mandatory match
  ("&!foo").

- the backslash can now be used to escape the special characters
  above. Basically, the special characters ('|', '&', '!') are
  stripped from the start of the element. If what is left afterwards
  is a backslash, it also gets stripped and the remainder is the
  pattern. For example, "\\&foo" has the pattern "&foo" where
  '&' is no longer treated specially. This special handling of
  the backslash is only done at the beginning of the element (after
  the optional special characters). The remaining string is part
  of the pattern, where backslashes might have their own meaning.

This change is mostly backward compatible, except for existing matches
that started with one of the special characters '|', '&', '!', and '\\'.

(cherry picked from commit 824ad6275d)
2020-06-26 13:33:41 +02:00
..
config meson: merge branch 'inigomartinez/meson-license' 2020-03-28 12:45:19 +01:00
meson.build license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
test-core-with-expect.c all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
test-core.c libnm/match: extend syntax for match patterns with '|', '&', '!' and '\\' 2020-06-26 13:33:41 +02:00
test-dcb.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
test-ip4-config.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
test-ip6-config.c tests: replace NMTST_SWAP() by new NM_SWAP() macro 2020-03-26 21:28:56 +01:00
test-secret-agent.py all: reformat python files with python black 2020-06-15 16:40:38 +02:00
test-systemd.c all: rename time related function to spell out nsec/usec/msec/sec 2019-12-13 16:54:40 +01:00
test-utils.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00
test-wired-defname.c all: manually drop code comments with file description 2019-10-01 07:50:52 +02:00