diff mbox series

[1/3] test-diff-suppr: Improve regexes in tests.

Message ID 20200420164153.5213-1-gprocida@google.com
State Changes Requested
Headers show
Series [1/3] test-diff-suppr: Improve regexes in tests. | expand

Commit Message

Giuliano Procida April 20, 2020, 4:41 p.m. UTC
The are some (mostly inconsequential) issues with regexes:

  - Leading and trailing .* are redundant and can be removed.
    However, "match anything" should still be written as .* as the
    parser will treat an empty regex as if it were absent.
    - There are various cases where there's a trailing .* but no
      initial ^. These would be good for whole string matches, not the
      substring matches libabigail does.
  - File name matches are full path so should start with (^|/) if
    trying to match a base name, assuming a Unix-like filesystem.
    Given these are just tests, it's not that important, but they
    still serve as examples.
    - In cases where the ^ anchor was used, full paths would usually
      fail to match. In such cases, the regex was being ignored for
      other reasons (see later patch) or is expected not to match
      anyway.
    - In many cases, the $ anchor could be considered to be missing.
  - The .ini parser unescapes string values, so escaping regex
    metacharacters requires a double backslash. Single backslashes
    are pointless.
  - The dot metacharacter is used unescaped in a few places where a
    literal was likely intended, so should be escaped.
  - The characters [ and ] don't need to be (.ini) escaped.

This patch resolves these issues, for a subset of files.

	* tests/data/test-diff-suppr/libtest31.suppr: Fix regexes.
	* tests/data/test-diff-suppr/libtest32-0.suppr: Ditto.
	* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt:
	Ditto.
	* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt:
	Ditto.
	* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt:
	Ditto.
	* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt:
	Ditto.
	* tests/data/test-diff-suppr/test0-type-suppr-0.suppr: Ditto.
	* tests/data/test-diff-suppr/test0-type-suppr-3.suppr: Ditto.
	* tests/data/test-diff-suppr/test0-type-suppr-4.suppr: Ditto.
	* tests/data/test-diff-suppr/test0-type-suppr-5.suppr: Ditto.
	* tests/data/test-diff-suppr/test0-type-suppr-6.suppr: Ditto.
	* tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr:
	Ditto.
	* tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr:
	Ditto.
	* tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr:
	Ditto.
	* tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr:
	Ditto.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr:
	Ditto.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr:
	Ditto.
	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr:
	Ditto.
	* tests/data/test-diff-suppr/test23-alias-filter-1.suppr:
	Ditto.
	* tests/data/test-diff-suppr/test23-alias-filter-2.suppr:
	Ditto.
	* tests/data/test-diff-suppr/test24-soname-suppr-10.txt:
	Ditto.
	* tests/data/test-diff-suppr/test24-soname-suppr-11.txt:
	Ditto.
	* tests/data/test-diff-suppr/test24-soname-suppr-12.txt:
	Ditto.
	* tests/data/test-diff-suppr/test24-soname-suppr-6.txt: Ditto.
	* tests/data/test-diff-suppr/test24-soname-suppr-8.txt: Ditto.
	* tests/data/test-diff-suppr/test4-local-suppr-0.suppr: Ditto.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 tests/data/test-diff-suppr/libtest31.suppr                 | 2 +-
 tests/data/test-diff-suppr/libtest32-0.suppr               | 2 +-
 .../test-diff-suppr/libtest48-soname-abixml-suppr-2.txt    | 2 +-
 .../test-diff-suppr/libtest48-soname-abixml-suppr-3.txt    | 2 +-
 .../test-diff-suppr/libtest48-soname-abixml-suppr-4.txt    | 2 +-
 .../data/test-diff-suppr/libtest48-soname-abixml-suppr.txt | 2 +-
 tests/data/test-diff-suppr/test0-type-suppr-0.suppr        | 2 +-
 tests/data/test-diff-suppr/test0-type-suppr-3.suppr        | 4 +---
 tests/data/test-diff-suppr/test0-type-suppr-4.suppr        | 5 ++---
 tests/data/test-diff-suppr/test0-type-suppr-5.suppr        | 7 +++----
 tests/data/test-diff-suppr/test0-type-suppr-6.suppr        | 6 ++----
 tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr  | 2 +-
 tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr  | 2 +-
 tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr  | 2 +-
 tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr  | 2 +-
 .../test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr    | 2 +-
 .../test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr    | 4 ++--
 .../test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr    | 2 +-
 tests/data/test-diff-suppr/test23-alias-filter-1.suppr     | 2 +-
 tests/data/test-diff-suppr/test23-alias-filter-2.suppr     | 2 +-
 tests/data/test-diff-suppr/test24-soname-suppr-10.txt      | 2 +-
 tests/data/test-diff-suppr/test24-soname-suppr-11.txt      | 2 +-
 tests/data/test-diff-suppr/test24-soname-suppr-12.txt      | 2 +-
 tests/data/test-diff-suppr/test24-soname-suppr-2.txt       | 2 +-
 tests/data/test-diff-suppr/test24-soname-suppr-3.txt       | 2 +-
 tests/data/test-diff-suppr/test24-soname-suppr-4.txt       | 2 +-
 tests/data/test-diff-suppr/test24-soname-suppr-6.txt       | 2 +-
 tests/data/test-diff-suppr/test24-soname-suppr-8.txt       | 2 +-
 tests/data/test-diff-suppr/test24-soname-suppr-9.txt       | 2 +-
 tests/data/test-diff-suppr/test26-loc-suppr-1.suppr        | 2 +-
 tests/data/test-diff-suppr/test26-loc-suppr-2.suppr        | 2 +-
 tests/data/test-diff-suppr/test29-suppr-1.txt              | 2 +-
 tests/data/test-diff-suppr/test29-suppr-5.txt              | 2 +-
 tests/data/test-diff-suppr/test29-suppr-6.txt              | 2 +-
 tests/data/test-diff-suppr/test29-suppr-7.txt              | 2 +-
 tests/data/test-diff-suppr/test29-suppr-8.txt              | 2 +-
 tests/data/test-diff-suppr/test33-suppr-1.txt              | 2 +-
 .../data/test-diff-suppr/test38-char-class-in-ini.abignore | 2 +-
 tests/data/test-diff-suppr/test4-local-suppr-0.suppr       | 2 +-
 tests/data/test-diff-suppr/test6-fn-suppr-1.suppr          | 2 +-
 tests/data/test-diff-suppr/test7-var-suppr-9.suppr         | 4 ++--
 41 files changed, 47 insertions(+), 53 deletions(-)

Comments

Matthias Maennich April 21, 2020, 10:19 a.m. UTC | #1
Hi Giuliano!

On Mon, Apr 20, 2020 at 05:41:50PM +0100, Giuliano Procida wrote:
>The are some (mostly inconsequential) issues with regexes:
>
>  - Leading and trailing .* are redundant and can be removed.
>    However, "match anything" should still be written as .* as the
>    parser will treat an empty regex as if it were absent.
>    - There are various cases where there's a trailing .* but no
>      initial ^. These would be good for whole string matches, not the
>      substring matches libabigail does.
>  - File name matches are full path so should start with (^|/) if
>    trying to match a base name, assuming a Unix-like filesystem.
>    Given these are just tests, it's not that important, but they
>    still serve as examples.
>    - In cases where the ^ anchor was used, full paths would usually
>      fail to match. In such cases, the regex was being ignored for
>      other reasons (see later patch) or is expected not to match
>      anyway.
>    - In many cases, the $ anchor could be considered to be missing.
>  - The .ini parser unescapes string values, so escaping regex
>    metacharacters requires a double backslash. Single backslashes
>    are pointless.
>  - The dot metacharacter is used unescaped in a few places where a
>    literal was likely intended, so should be escaped.
>  - The characters [ and ] don't need to be (.ini) escaped.
>
>This patch resolves these issues, for a subset of files.
>
>	* tests/data/test-diff-suppr/libtest31.suppr: Fix regexes.
>	* tests/data/test-diff-suppr/libtest32-0.suppr: Ditto.
>	* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt:
>	Ditto.
>	* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt:
>	Ditto.
>	* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt:
>	Ditto.
>	* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt:
>	Ditto.
>	* tests/data/test-diff-suppr/test0-type-suppr-0.suppr: Ditto.
>	* tests/data/test-diff-suppr/test0-type-suppr-3.suppr: Ditto.
>	* tests/data/test-diff-suppr/test0-type-suppr-4.suppr: Ditto.
>	* tests/data/test-diff-suppr/test0-type-suppr-5.suppr: Ditto.
>	* tests/data/test-diff-suppr/test0-type-suppr-6.suppr: Ditto.
>	* tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr:
>	Ditto.
>	* tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr:
>	Ditto.
>	* tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr:
>	Ditto.
>	* tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr:
>	Ditto.
>	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr:
>	Ditto.
>	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr:
>	Ditto.
>	* tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr:
>	Ditto.
>	* tests/data/test-diff-suppr/test23-alias-filter-1.suppr:
>	Ditto.
>	* tests/data/test-diff-suppr/test23-alias-filter-2.suppr:
>	Ditto.
>	* tests/data/test-diff-suppr/test24-soname-suppr-10.txt:
>	Ditto.
>	* tests/data/test-diff-suppr/test24-soname-suppr-11.txt:
>	Ditto.
>	* tests/data/test-diff-suppr/test24-soname-suppr-12.txt:
>	Ditto.
>	* tests/data/test-diff-suppr/test24-soname-suppr-6.txt: Ditto.
>	* tests/data/test-diff-suppr/test24-soname-suppr-8.txt: Ditto.
>	* tests/data/test-diff-suppr/test4-local-suppr-0.suppr: Ditto.
>
>Signed-off-by: Giuliano Procida <gprocida@google.com>
>---
> tests/data/test-diff-suppr/libtest31.suppr                 | 2 +-
> tests/data/test-diff-suppr/libtest32-0.suppr               | 2 +-
> .../test-diff-suppr/libtest48-soname-abixml-suppr-2.txt    | 2 +-
> .../test-diff-suppr/libtest48-soname-abixml-suppr-3.txt    | 2 +-
> .../test-diff-suppr/libtest48-soname-abixml-suppr-4.txt    | 2 +-
> .../data/test-diff-suppr/libtest48-soname-abixml-suppr.txt | 2 +-
> tests/data/test-diff-suppr/test0-type-suppr-0.suppr        | 2 +-
> tests/data/test-diff-suppr/test0-type-suppr-3.suppr        | 4 +---
> tests/data/test-diff-suppr/test0-type-suppr-4.suppr        | 5 ++---
> tests/data/test-diff-suppr/test0-type-suppr-5.suppr        | 7 +++----
> tests/data/test-diff-suppr/test0-type-suppr-6.suppr        | 6 ++----
> tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr  | 2 +-
> tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr  | 2 +-
> tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr  | 2 +-
> tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr  | 2 +-
> .../test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr    | 2 +-
> .../test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr    | 4 ++--
> .../test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr    | 2 +-
> tests/data/test-diff-suppr/test23-alias-filter-1.suppr     | 2 +-
> tests/data/test-diff-suppr/test23-alias-filter-2.suppr     | 2 +-
> tests/data/test-diff-suppr/test24-soname-suppr-10.txt      | 2 +-
> tests/data/test-diff-suppr/test24-soname-suppr-11.txt      | 2 +-
> tests/data/test-diff-suppr/test24-soname-suppr-12.txt      | 2 +-
> tests/data/test-diff-suppr/test24-soname-suppr-2.txt       | 2 +-
> tests/data/test-diff-suppr/test24-soname-suppr-3.txt       | 2 +-
> tests/data/test-diff-suppr/test24-soname-suppr-4.txt       | 2 +-
> tests/data/test-diff-suppr/test24-soname-suppr-6.txt       | 2 +-
> tests/data/test-diff-suppr/test24-soname-suppr-8.txt       | 2 +-
> tests/data/test-diff-suppr/test24-soname-suppr-9.txt       | 2 +-
> tests/data/test-diff-suppr/test26-loc-suppr-1.suppr        | 2 +-
> tests/data/test-diff-suppr/test26-loc-suppr-2.suppr        | 2 +-
> tests/data/test-diff-suppr/test29-suppr-1.txt              | 2 +-
> tests/data/test-diff-suppr/test29-suppr-5.txt              | 2 +-
> tests/data/test-diff-suppr/test29-suppr-6.txt              | 2 +-
> tests/data/test-diff-suppr/test29-suppr-7.txt              | 2 +-
> tests/data/test-diff-suppr/test29-suppr-8.txt              | 2 +-
> tests/data/test-diff-suppr/test33-suppr-1.txt              | 2 +-
> .../data/test-diff-suppr/test38-char-class-in-ini.abignore | 2 +-
> tests/data/test-diff-suppr/test4-local-suppr-0.suppr       | 2 +-
> tests/data/test-diff-suppr/test6-fn-suppr-1.suppr          | 2 +-
> tests/data/test-diff-suppr/test7-var-suppr-9.suppr         | 4 ++--
> 41 files changed, 47 insertions(+), 53 deletions(-)
>
>diff --git a/tests/data/test-diff-suppr/libtest31.suppr b/tests/data/test-diff-suppr/libtest31.suppr
>index 57929eca..3fe933a6 100644
>--- a/tests/data/test-diff-suppr/libtest31.suppr
>+++ b/tests/data/test-diff-suppr/libtest31.suppr
>@@ -1,3 +1,3 @@
> [suppress_function]
>   drop = yes
>-  name_regexp = hidden::.*
>+  name_regexp = ^hidden::
>diff --git a/tests/data/test-diff-suppr/libtest32-0.suppr b/tests/data/test-diff-suppr/libtest32-0.suppr
>index b79bb965..04179b48 100644
>--- a/tests/data/test-diff-suppr/libtest32-0.suppr
>+++ b/tests/data/test-diff-suppr/libtest32-0.suppr
>@@ -1,3 +1,3 @@
> [suppress_function]
>-  name_not_regexp = ^pub::.*
>+  name_not_regexp = ^pub::
>   drop_artifact = true
>diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt
>index c9b7ad46..7d99a709 100644
>--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt
>+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt
>@@ -1,2 +1,2 @@
> [suppress_file]
>-  soname_regexp = test48<typo>-soname-abixml-v.*
>+  soname_regexp = test48<typo>-soname-abixml-v
>diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt
>index c69c2504..64470ca4 100644
>--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt
>+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt
>@@ -1,2 +1,2 @@
> [suppress_file]
>-  file_name_regexp = ^libtest48-soname-abixml-v.*$
>+  file_name_regexp = (^|/)libtest48-soname-abixml-v
>diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt
>index 1a205275..dd4235f9 100644
>--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt
>+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt
>@@ -1,2 +1,2 @@
> [suppress_file]
>-  file_name_regexp = ^libtest48<typo>-soname-abixml-v.*$
>+  file_name_regexp = (^|/)libtest48<typo>-soname-abixml-v
>diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt
>index 08d61c0f..bc44c4fd 100644
>--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt
>+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt
>@@ -1,2 +1,2 @@
> [suppress_file]
>-  soname_regexp = test48-soname-abixml-v.*
>+  soname_regexp = test48-soname-abixml-v
>diff --git a/tests/data/test-diff-suppr/test0-type-suppr-0.suppr b/tests/data/test-diff-suppr/test0-type-suppr-0.suppr
>index be876c77..151005e1 100644
>--- a/tests/data/test-diff-suppr/test0-type-suppr-0.suppr
>+++ b/tests/data/test-diff-suppr/test0-type-suppr-0.suppr
>@@ -1,2 +1,2 @@
> [suppress_type]
>-  name_regexp = .*Private$
>+  name_regexp = Private$
>diff --git a/tests/data/test-diff-suppr/test0-type-suppr-3.suppr b/tests/data/test-diff-suppr/test0-type-suppr-3.suppr
>index b84fcc41..eb63bc53 100644
>--- a/tests/data/test-diff-suppr/test0-type-suppr-3.suppr
>+++ b/tests/data/test-diff-suppr/test0-type-suppr-3.suppr
>@@ -1,5 +1,3 @@
> [suppress_file]
>-  #
>   # Do not load files test0-type-suppr-v0.o or test0-type-suppr-v1.o
>-  #
>-  file_name_regexp = (test0-type-suppr-v0.o|test0-type-suppr-v1.o)
>+  file_name_regexp = (^|/)(test0-type-suppr-v0\\.o|test0-type-suppr-v1\\.o)$

Maybe
    file_name_regexp = (^|/)test0-type-suppr-v(0|1)\\.o$

But while I was at it, changing this to

    file_name_regexp = (^|/)test0-type-suppr-v0\\.o$

did not make the test fail. Shouldn't it?

>diff --git a/tests/data/test-diff-suppr/test0-type-suppr-4.suppr b/tests/data/test-diff-suppr/test0-type-suppr-4.suppr
>index 32552acb..5d122b4e 100644
>--- a/tests/data/test-diff-suppr/test0-type-suppr-4.suppr
>+++ b/tests/data/test-diff-suppr/test0-type-suppr-4.suppr
>@@ -1,5 +1,4 @@
> [suppress_file]
>-  # Do not load files foo.o.  This is practically going to allow the
>+  # Do not load files *foo.o*.  This is practically going to allow the
>   # loading of files test0-type-suppr-v0.o and test0-type-suppr-v1.o.
>-  file_name_regexp = foo.*
>-
>+  file_name_regexp = foo\\.o
>diff --git a/tests/data/test-diff-suppr/test0-type-suppr-5.suppr b/tests/data/test-diff-suppr/test0-type-suppr-5.suppr
>index 1fa3b1ce..0a06e8d0 100644
>--- a/tests/data/test-diff-suppr/test0-type-suppr-5.suppr
>+++ b/tests/data/test-diff-suppr/test0-type-suppr-5.suppr
>@@ -1,6 +1,5 @@
> [suppress_file]
>-  # Avoid loading files which name does *NOT* match the regexp name
>-  # foo.* This is practically going to forbid the loading of files
>+  # Avoid loading files which name does *NOT* match *foo.o*.
>+  # This is practically going to forbid the loading of files
>   # test0-type-suppr-v0.o and test0-type-suppr-v1.o
>-  file_name_not_regexp = foo.*
>-
>+  file_name_not_regexp = foo\\.o
>diff --git a/tests/data/test-diff-suppr/test0-type-suppr-6.suppr b/tests/data/test-diff-suppr/test0-type-suppr-6.suppr
>index ee297fff..c0c5d078 100644
>--- a/tests/data/test-diff-suppr/test0-type-suppr-6.suppr
>+++ b/tests/data/test-diff-suppr/test0-type-suppr-6.suppr
>@@ -1,5 +1,3 @@
> [suppress_file]
>-  # Avoid loading files which name does *NOT* match the regexp name
>-  # foo.* This is practically going to forbid the loading of files
>-  # test0-type-suppr-v0.o and test0-type-suppr-v1.o
>-  file_name_not_regexp = (test0-type-suppr-v0.o|test0-type-suppr-v1.o)
>+  # Only load files test0-type-suppr-v0.o or test0-type-suppr-v1.o
>+  file_name_not_regexp = (^|/)(test0-type-suppr-v0\\.o|test0-type-suppr-v1\\.o)$

As above.

Other than that this looks good to me.

Reviewed-by: Matthias Maennich <maennich@google.com>

Cheers,
Matthias

>diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr
>index 0ecaea27..9f24f89f 100644
>--- a/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr
>+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr
>@@ -1,2 +1,2 @@
> [suppress_variable]
>-  name_regexp = .*var.$
>+  name_regexp = var.$
>diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr
>index d0321556..0024c66b 100644
>--- a/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr
>+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr
>@@ -1,3 +1,3 @@
> [suppress_variable]
>-  name_regexp = .*var.$
>+  name_regexp = var.$
>   change_kind = added-variable
>diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr
>index 42f55bbc..fabf4e25 100644
>--- a/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr
>+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr
>@@ -1,3 +1,3 @@
> [suppress_variable]
>-  name_regexp = .*var.$
>+  name_regexp = var.$
>   change_kind = variable-subtype-change
>diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr
>index 7ad5cacb..3f2a565c 100644
>--- a/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr
>+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr
>@@ -1,3 +1,3 @@
> [suppress_variable]
>-  name_regexp = .*var.$
>+  name_regexp = var.$
>   change_kind = all
>diff --git a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr
>index 61f4a6a7..f86ea294 100644
>--- a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr
>+++ b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr
>@@ -1,3 +1,3 @@
> [suppress_function]
>-  symbol_name_regexp = _Z3.*
>+  symbol_name_regexp = ^_Z3
>   change_kind = deleted-function
>diff --git a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr
>index a32db428..0c2e2c21 100644
>--- a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr
>+++ b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr
>@@ -1,3 +1,3 @@
> [suppress_function]
>-  symbol_name_regexp = _Z.*
>-  change_kind = all
>\ No newline at end of file
>+  symbol_name_regexp = ^_Z
>+  change_kind = all
>diff --git a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr
>index 21387c5c..a0562842 100644
>--- a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr
>+++ b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr
>@@ -1,2 +1,2 @@
> [suppress_function]
>-  symbol_name_regexp = _Z.*
>+  symbol_name_regexp = ^_Z
>diff --git a/tests/data/test-diff-suppr/test23-alias-filter-1.suppr b/tests/data/test-diff-suppr/test23-alias-filter-1.suppr
>index c0ffa797..3c0788c5 100644
>--- a/tests/data/test-diff-suppr/test23-alias-filter-1.suppr
>+++ b/tests/data/test-diff-suppr/test23-alias-filter-1.suppr
>@@ -1,3 +1,3 @@
> [suppress_function]
>-  name_regexp = ^__private_.*
>+  name_regexp = ^__private_
>   allow_other_aliases = yes
>diff --git a/tests/data/test-diff-suppr/test23-alias-filter-2.suppr b/tests/data/test-diff-suppr/test23-alias-filter-2.suppr
>index e8660292..c7d4220e 100644
>--- a/tests/data/test-diff-suppr/test23-alias-filter-2.suppr
>+++ b/tests/data/test-diff-suppr/test23-alias-filter-2.suppr
>@@ -1,3 +1,3 @@
> [suppress_function]
>-  name_regexp = ^__private_.*
>+  name_regexp = ^__private_
>   allow_other_aliases = no
>diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-10.txt b/tests/data/test-diff-suppr/test24-soname-suppr-10.txt
>index 004952fe..75103163 100644
>--- a/tests/data/test-diff-suppr/test24-soname-suppr-10.txt
>+++ b/tests/data/test-diff-suppr/test24-soname-suppr-10.txt
>@@ -1,3 +1,3 @@
> [suppress_type]
>-  file_name_not_regexp = libtest24-soname.*\\.so
>+  file_name_not_regexp = (^|/)libtest24-soname.*\\.so
>
>diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-11.txt b/tests/data/test-diff-suppr/test24-soname-suppr-11.txt
>index 0f5db1d1..d1baf90c 100644
>--- a/tests/data/test-diff-suppr/test24-soname-suppr-11.txt
>+++ b/tests/data/test-diff-suppr/test24-soname-suppr-11.txt
>@@ -1,3 +1,3 @@
> [suppress_function]
>-  file_name_not_regexp = libtest24-soname-wrong-name.*\\.so
>+  file_name_not_regexp = (^|/)libtest24-soname-wrong-name.*\\.so
>
>diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-12.txt b/tests/data/test-diff-suppr/test24-soname-suppr-12.txt
>index 59a14335..3e6c4e97 100644
>--- a/tests/data/test-diff-suppr/test24-soname-suppr-12.txt
>+++ b/tests/data/test-diff-suppr/test24-soname-suppr-12.txt
>@@ -1,2 +1,2 @@
> [suppress_function]
>-  file_name_not_regexp = libtest24-soname.*\\.so
>+  file_name_not_regexp = (^|/)libtest24-soname.*\\.so
>diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-2.txt b/tests/data/test-diff-suppr/test24-soname-suppr-2.txt
>index 439321d8..65b50fbb 100644
>--- a/tests/data/test-diff-suppr/test24-soname-suppr-2.txt
>+++ b/tests/data/test-diff-suppr/test24-soname-suppr-2.txt
>@@ -1,4 +1,4 @@
> [suppress_type]
>-  file_name_regexp = .*/libtest24-soname-v0.so$
>+  file_name_regexp = (^|/)libtest24-soname-v0\\.so$
>   name = S
>   reached_through = reference_or_pointer
>diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-3.txt b/tests/data/test-diff-suppr/test24-soname-suppr-3.txt
>index 1e23370e..f72fd141 100644
>--- a/tests/data/test-diff-suppr/test24-soname-suppr-3.txt
>+++ b/tests/data/test-diff-suppr/test24-soname-suppr-3.txt
>@@ -1,4 +1,4 @@
> [suppress_type]
>-  file_name_regexp = .*/libtest24-soname-v1.so$
>+  file_name_regexp = (^|/)libtest24-soname-v1\\.so$
>   name = S
>   reached_through = reference_or_pointer
>diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-4.txt b/tests/data/test-diff-suppr/test24-soname-suppr-4.txt
>index 1893ae6e..29a0b6ec 100644
>--- a/tests/data/test-diff-suppr/test24-soname-suppr-4.txt
>+++ b/tests/data/test-diff-suppr/test24-soname-suppr-4.txt
>@@ -1,4 +1,4 @@
> [suppress_type]
>-  file_name_regexp = ^libtest24-soname-<wrong-file-name>.so$
>+  file_name_regexp = (^|/)libtest24-soname-<wrong-file-name>\\.so$
>   name = S
>   reached_through = reference_or_pointer
>diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-6.txt b/tests/data/test-diff-suppr/test24-soname-suppr-6.txt
>index aae7f346..d10956ea 100644
>--- a/tests/data/test-diff-suppr/test24-soname-suppr-6.txt
>+++ b/tests/data/test-diff-suppr/test24-soname-suppr-6.txt
>@@ -1,2 +1,2 @@
> [suppress_function]
>-  file_name_regexp = libtest24-soname.*\\.so
>+  file_name_regexp = (^|/)libtest24-soname.*\\.so
>diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-8.txt b/tests/data/test-diff-suppr/test24-soname-suppr-8.txt
>index 15292cd4..53028b91 100644
>--- a/tests/data/test-diff-suppr/test24-soname-suppr-8.txt
>+++ b/tests/data/test-diff-suppr/test24-soname-suppr-8.txt
>@@ -1,2 +1,2 @@
> [suppress_type]
>-  file_name_regexp = libtest24-soname.*\\.so
>+  file_name_regexp = (^|/)libtest24-soname.*\\.so
>diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-9.txt b/tests/data/test-diff-suppr/test24-soname-suppr-9.txt
>index c5dc2562..23d15d4d 100644
>--- a/tests/data/test-diff-suppr/test24-soname-suppr-9.txt
>+++ b/tests/data/test-diff-suppr/test24-soname-suppr-9.txt
>@@ -1,3 +1,3 @@
> [suppress_type]
>-  file_name_not_regexp = libtest24-soname-wrong-name.*\\.so
>+  file_name_not_regexp = (^|/)libtest24-soname-wrong-name.*\\.so$
>
>diff --git a/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr b/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr
>index b0c0675f..734bbe1d 100644
>--- a/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr
>+++ b/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr
>@@ -1,2 +1,2 @@
> [suppress_type]
>-  source_location_not_regexp = test26-loc.*\\.h
>+  source_location_not_regexp = (^|/)test26-loc.*\\.h$
>diff --git a/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr b/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr
>index 282702c6..576d87c6 100644
>--- a/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr
>+++ b/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr
>@@ -1,2 +1,2 @@
> [suppress_type]
>-  source_location_not_regexp = test26-loc.*\\.cc
>+  source_location_not_regexp = (^|/)test26-loc.*\\.cc$
>diff --git a/tests/data/test-diff-suppr/test29-suppr-1.txt b/tests/data/test-diff-suppr/test29-suppr-1.txt
>index 14012181..19a270f5 100644
>--- a/tests/data/test-diff-suppr/test29-suppr-1.txt
>+++ b/tests/data/test-diff-suppr/test29-suppr-1.txt
>@@ -1,2 +1,2 @@
> [suppress_variable]
>-  file_name_regexp = libtest29-soname.*\\.so
>+  file_name_regexp = (^|/)libtest29-soname.*\\.so$
>diff --git a/tests/data/test-diff-suppr/test29-suppr-5.txt b/tests/data/test-diff-suppr/test29-suppr-5.txt
>index c195ede5..2d6efeb6 100644
>--- a/tests/data/test-diff-suppr/test29-suppr-5.txt
>+++ b/tests/data/test-diff-suppr/test29-suppr-5.txt
>@@ -1,3 +1,3 @@
> [suppress_variable]
>-  file_name_not_regexp = ^libtest29-soname-wrong.*\\.so$
>+  file_name_not_regexp = (^|/)libtest29-soname-wrong.*\\.so$
>
>diff --git a/tests/data/test-diff-suppr/test29-suppr-6.txt b/tests/data/test-diff-suppr/test29-suppr-6.txt
>index 55cfbc76..4d8c8d1b 100644
>--- a/tests/data/test-diff-suppr/test29-suppr-6.txt
>+++ b/tests/data/test-diff-suppr/test29-suppr-6.txt
>@@ -1,3 +1,3 @@
> [suppress_variable]
>-  file_name_not_regexp = .*libtest29-soname.*\\.so$
>+  file_name_not_regexp = (^|/)libtest29-soname.*\\.so$
>
>diff --git a/tests/data/test-diff-suppr/test29-suppr-7.txt b/tests/data/test-diff-suppr/test29-suppr-7.txt
>index ba799b3e..5c0aa653 100644
>--- a/tests/data/test-diff-suppr/test29-suppr-7.txt
>+++ b/tests/data/test-diff-suppr/test29-suppr-7.txt
>@@ -1,2 +1,2 @@
> [suppress_type]
>-  file_name_not_regexp = ^libtest29-soname-wrong.*\\.so$
>+  file_name_not_regexp = (^|/)libtest29-soname-wrong.*\\.so$
>diff --git a/tests/data/test-diff-suppr/test29-suppr-8.txt b/tests/data/test-diff-suppr/test29-suppr-8.txt
>index 6c86f5b8..cc8b20e6 100644
>--- a/tests/data/test-diff-suppr/test29-suppr-8.txt
>+++ b/tests/data/test-diff-suppr/test29-suppr-8.txt
>@@ -1,2 +1,2 @@
> [suppress_type]
>-  file_name_not_regexp = .*libtest29-soname.*\\.so$
>+  file_name_not_regexp = (^|/)libtest29-soname.*\\.so$
>diff --git a/tests/data/test-diff-suppr/test33-suppr-1.txt b/tests/data/test-diff-suppr/test33-suppr-1.txt
>index 32d46796..069e345d 100644
>--- a/tests/data/test-diff-suppr/test33-suppr-1.txt
>+++ b/tests/data/test-diff-suppr/test33-suppr-1.txt
>@@ -1,4 +1,4 @@
> [suppress_type]
>   type_kind = class
>-  source_location_not_regexp = test33-v\[0-9\]*\\.h
>+  source_location_not_regexp = (^|/)test33-v[0-9]*\\.h$
>   drop = true
>diff --git a/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore b/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore
>index 07f3f91f..9318d513 100644
>--- a/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore
>+++ b/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore
>@@ -1,4 +1,4 @@
> [suppress_function]
>- filename_regexp = ^test38-char-class-in-ini-v[[:digit:]].*
>+ file_name_regexp = (^|/)test38-char-class-in-ini-v[[:digit:]]
>  symbol_name_regexp = bar
>  change_kind = added-function
>diff --git a/tests/data/test-diff-suppr/test4-local-suppr-0.suppr b/tests/data/test-diff-suppr/test4-local-suppr-0.suppr
>index b7c6271b..d917d350 100644
>--- a/tests/data/test-diff-suppr/test4-local-suppr-0.suppr
>+++ b/tests/data/test-diff-suppr/test4-local-suppr-0.suppr
>@@ -1,3 +1,3 @@
> [suppress_type]
>   # Types whose name start with "private" should not be flagged
>-  name_regexp = ^private.*
>+  name_regexp = ^private
>diff --git a/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr b/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr
>index 0bead6d7..f6a361db 100644
>--- a/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr
>+++ b/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr
>@@ -1,2 +1,2 @@
> [suppress_function]
>-  symbol_version_regexp = VERSION_1\.*
>+  symbol_version_regexp = ^VERSION_1
>diff --git a/tests/data/test-diff-suppr/test7-var-suppr-9.suppr b/tests/data/test-diff-suppr/test7-var-suppr-9.suppr
>index cbe8b0bc..5d0bdd70 100644
>--- a/tests/data/test-diff-suppr/test7-var-suppr-9.suppr
>+++ b/tests/data/test-diff-suppr/test7-var-suppr-9.suppr
>@@ -1,7 +1,7 @@
> [suppress_function]
> # This one shouldn't catch anything, but it must be parsed fine.
>-  symbol_version_regexp = ^VERSION_\[0-9\]\\.\[0-9\]$
>+  symbol_version_regexp = ^VERSION_[0-9]\\.[0-9]$
>
> [suppress_variable]
> # This one should be parsed fine too.
>-  symbol_version_regexp = ^VERSION_\[0-9\]\\.\[0-9\]$
>\ No newline at end of file
>+  symbol_version_regexp = ^VERSION_[0-9]\\.[0-9]$
>-- 
>2.26.1.301.g55bc3eb7cb9-goog
>
Giuliano Procida April 21, 2020, 10:57 a.m. UTC | #2
I could simplify the regex, but it's correct as-is.

>From https://sourceware.org/libabigail/manual/libabigail-concepts.html#suppress-file:

"... if the directive prevents it from loading either one of the
files, then no comparison is performed."

So it's working as intended, though perhaps not with full test coverage.

Regards,
Giuliano.

On Tue, 21 Apr 2020 at 11:19, Matthias Maennich <maennich@google.com> wrote:
>
> Hi Giuliano!
>
> On Mon, Apr 20, 2020 at 05:41:50PM +0100, Giuliano Procida wrote:
> >The are some (mostly inconsequential) issues with regexes:
> >
> >  - Leading and trailing .* are redundant and can be removed.
> >    However, "match anything" should still be written as .* as the
> >    parser will treat an empty regex as if it were absent.
> >    - There are various cases where there's a trailing .* but no
> >      initial ^. These would be good for whole string matches, not the
> >      substring matches libabigail does.
> >  - File name matches are full path so should start with (^|/) if
> >    trying to match a base name, assuming a Unix-like filesystem.
> >    Given these are just tests, it's not that important, but they
> >    still serve as examples.
> >    - In cases where the ^ anchor was used, full paths would usually
> >      fail to match. In such cases, the regex was being ignored for
> >      other reasons (see later patch) or is expected not to match
> >      anyway.
> >    - In many cases, the $ anchor could be considered to be missing.
> >  - The .ini parser unescapes string values, so escaping regex
> >    metacharacters requires a double backslash. Single backslashes
> >    are pointless.
> >  - The dot metacharacter is used unescaped in a few places where a
> >    literal was likely intended, so should be escaped.
> >  - The characters [ and ] don't need to be (.ini) escaped.
> >
> >This patch resolves these issues, for a subset of files.
> >
> >       * tests/data/test-diff-suppr/libtest31.suppr: Fix regexes.
> >       * tests/data/test-diff-suppr/libtest32-0.suppr: Ditto.
> >       * tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt:
> >       Ditto.
> >       * tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt:
> >       Ditto.
> >       * tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt:
> >       Ditto.
> >       * tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test0-type-suppr-0.suppr: Ditto.
> >       * tests/data/test-diff-suppr/test0-type-suppr-3.suppr: Ditto.
> >       * tests/data/test-diff-suppr/test0-type-suppr-4.suppr: Ditto.
> >       * tests/data/test-diff-suppr/test0-type-suppr-5.suppr: Ditto.
> >       * tests/data/test-diff-suppr/test0-type-suppr-6.suppr: Ditto.
> >       * tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test23-alias-filter-1.suppr:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test23-alias-filter-2.suppr:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test24-soname-suppr-10.txt:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test24-soname-suppr-11.txt:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test24-soname-suppr-12.txt:
> >       Ditto.
> >       * tests/data/test-diff-suppr/test24-soname-suppr-6.txt: Ditto.
> >       * tests/data/test-diff-suppr/test24-soname-suppr-8.txt: Ditto.
> >       * tests/data/test-diff-suppr/test4-local-suppr-0.suppr: Ditto.
> >
> >Signed-off-by: Giuliano Procida <gprocida@google.com>
> >---
> > tests/data/test-diff-suppr/libtest31.suppr                 | 2 +-
> > tests/data/test-diff-suppr/libtest32-0.suppr               | 2 +-
> > .../test-diff-suppr/libtest48-soname-abixml-suppr-2.txt    | 2 +-
> > .../test-diff-suppr/libtest48-soname-abixml-suppr-3.txt    | 2 +-
> > .../test-diff-suppr/libtest48-soname-abixml-suppr-4.txt    | 2 +-
> > .../data/test-diff-suppr/libtest48-soname-abixml-suppr.txt | 2 +-
> > tests/data/test-diff-suppr/test0-type-suppr-0.suppr        | 2 +-
> > tests/data/test-diff-suppr/test0-type-suppr-3.suppr        | 4 +---
> > tests/data/test-diff-suppr/test0-type-suppr-4.suppr        | 5 ++---
> > tests/data/test-diff-suppr/test0-type-suppr-5.suppr        | 7 +++----
> > tests/data/test-diff-suppr/test0-type-suppr-6.suppr        | 6 ++----
> > tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr  | 2 +-
> > tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr  | 2 +-
> > tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr  | 2 +-
> > tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr  | 2 +-
> > .../test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr    | 2 +-
> > .../test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr    | 4 ++--
> > .../test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr    | 2 +-
> > tests/data/test-diff-suppr/test23-alias-filter-1.suppr     | 2 +-
> > tests/data/test-diff-suppr/test23-alias-filter-2.suppr     | 2 +-
> > tests/data/test-diff-suppr/test24-soname-suppr-10.txt      | 2 +-
> > tests/data/test-diff-suppr/test24-soname-suppr-11.txt      | 2 +-
> > tests/data/test-diff-suppr/test24-soname-suppr-12.txt      | 2 +-
> > tests/data/test-diff-suppr/test24-soname-suppr-2.txt       | 2 +-
> > tests/data/test-diff-suppr/test24-soname-suppr-3.txt       | 2 +-
> > tests/data/test-diff-suppr/test24-soname-suppr-4.txt       | 2 +-
> > tests/data/test-diff-suppr/test24-soname-suppr-6.txt       | 2 +-
> > tests/data/test-diff-suppr/test24-soname-suppr-8.txt       | 2 +-
> > tests/data/test-diff-suppr/test24-soname-suppr-9.txt       | 2 +-
> > tests/data/test-diff-suppr/test26-loc-suppr-1.suppr        | 2 +-
> > tests/data/test-diff-suppr/test26-loc-suppr-2.suppr        | 2 +-
> > tests/data/test-diff-suppr/test29-suppr-1.txt              | 2 +-
> > tests/data/test-diff-suppr/test29-suppr-5.txt              | 2 +-
> > tests/data/test-diff-suppr/test29-suppr-6.txt              | 2 +-
> > tests/data/test-diff-suppr/test29-suppr-7.txt              | 2 +-
> > tests/data/test-diff-suppr/test29-suppr-8.txt              | 2 +-
> > tests/data/test-diff-suppr/test33-suppr-1.txt              | 2 +-
> > .../data/test-diff-suppr/test38-char-class-in-ini.abignore | 2 +-
> > tests/data/test-diff-suppr/test4-local-suppr-0.suppr       | 2 +-
> > tests/data/test-diff-suppr/test6-fn-suppr-1.suppr          | 2 +-
> > tests/data/test-diff-suppr/test7-var-suppr-9.suppr         | 4 ++--
> > 41 files changed, 47 insertions(+), 53 deletions(-)
> >
> >diff --git a/tests/data/test-diff-suppr/libtest31.suppr b/tests/data/test-diff-suppr/libtest31.suppr
> >index 57929eca..3fe933a6 100644
> >--- a/tests/data/test-diff-suppr/libtest31.suppr
> >+++ b/tests/data/test-diff-suppr/libtest31.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_function]
> >   drop = yes
> >-  name_regexp = hidden::.*
> >+  name_regexp = ^hidden::
> >diff --git a/tests/data/test-diff-suppr/libtest32-0.suppr b/tests/data/test-diff-suppr/libtest32-0.suppr
> >index b79bb965..04179b48 100644
> >--- a/tests/data/test-diff-suppr/libtest32-0.suppr
> >+++ b/tests/data/test-diff-suppr/libtest32-0.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_function]
> >-  name_not_regexp = ^pub::.*
> >+  name_not_regexp = ^pub::
> >   drop_artifact = true
> >diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt
> >index c9b7ad46..7d99a709 100644
> >--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt
> >+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt
> >@@ -1,2 +1,2 @@
> > [suppress_file]
> >-  soname_regexp = test48<typo>-soname-abixml-v.*
> >+  soname_regexp = test48<typo>-soname-abixml-v
> >diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt
> >index c69c2504..64470ca4 100644
> >--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt
> >+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt
> >@@ -1,2 +1,2 @@
> > [suppress_file]
> >-  file_name_regexp = ^libtest48-soname-abixml-v.*$
> >+  file_name_regexp = (^|/)libtest48-soname-abixml-v
> >diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt
> >index 1a205275..dd4235f9 100644
> >--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt
> >+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt
> >@@ -1,2 +1,2 @@
> > [suppress_file]
> >-  file_name_regexp = ^libtest48<typo>-soname-abixml-v.*$
> >+  file_name_regexp = (^|/)libtest48<typo>-soname-abixml-v
> >diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt
> >index 08d61c0f..bc44c4fd 100644
> >--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt
> >+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt
> >@@ -1,2 +1,2 @@
> > [suppress_file]
> >-  soname_regexp = test48-soname-abixml-v.*
> >+  soname_regexp = test48-soname-abixml-v
> >diff --git a/tests/data/test-diff-suppr/test0-type-suppr-0.suppr b/tests/data/test-diff-suppr/test0-type-suppr-0.suppr
> >index be876c77..151005e1 100644
> >--- a/tests/data/test-diff-suppr/test0-type-suppr-0.suppr
> >+++ b/tests/data/test-diff-suppr/test0-type-suppr-0.suppr
> >@@ -1,2 +1,2 @@
> > [suppress_type]
> >-  name_regexp = .*Private$
> >+  name_regexp = Private$
> >diff --git a/tests/data/test-diff-suppr/test0-type-suppr-3.suppr b/tests/data/test-diff-suppr/test0-type-suppr-3.suppr
> >index b84fcc41..eb63bc53 100644
> >--- a/tests/data/test-diff-suppr/test0-type-suppr-3.suppr
> >+++ b/tests/data/test-diff-suppr/test0-type-suppr-3.suppr
> >@@ -1,5 +1,3 @@
> > [suppress_file]
> >-  #
> >   # Do not load files test0-type-suppr-v0.o or test0-type-suppr-v1.o
> >-  #
> >-  file_name_regexp = (test0-type-suppr-v0.o|test0-type-suppr-v1.o)
> >+  file_name_regexp = (^|/)(test0-type-suppr-v0\\.o|test0-type-suppr-v1\\.o)$
>
> Maybe
>     file_name_regexp = (^|/)test0-type-suppr-v(0|1)\\.o$
>
> But while I was at it, changing this to
>
>     file_name_regexp = (^|/)test0-type-suppr-v0\\.o$
>
> did not make the test fail. Shouldn't it?
>
> >diff --git a/tests/data/test-diff-suppr/test0-type-suppr-4.suppr b/tests/data/test-diff-suppr/test0-type-suppr-4.suppr
> >index 32552acb..5d122b4e 100644
> >--- a/tests/data/test-diff-suppr/test0-type-suppr-4.suppr
> >+++ b/tests/data/test-diff-suppr/test0-type-suppr-4.suppr
> >@@ -1,5 +1,4 @@
> > [suppress_file]
> >-  # Do not load files foo.o.  This is practically going to allow the
> >+  # Do not load files *foo.o*.  This is practically going to allow the
> >   # loading of files test0-type-suppr-v0.o and test0-type-suppr-v1.o.
> >-  file_name_regexp = foo.*
> >-
> >+  file_name_regexp = foo\\.o
> >diff --git a/tests/data/test-diff-suppr/test0-type-suppr-5.suppr b/tests/data/test-diff-suppr/test0-type-suppr-5.suppr
> >index 1fa3b1ce..0a06e8d0 100644
> >--- a/tests/data/test-diff-suppr/test0-type-suppr-5.suppr
> >+++ b/tests/data/test-diff-suppr/test0-type-suppr-5.suppr
> >@@ -1,6 +1,5 @@
> > [suppress_file]
> >-  # Avoid loading files which name does *NOT* match the regexp name
> >-  # foo.* This is practically going to forbid the loading of files
> >+  # Avoid loading files which name does *NOT* match *foo.o*.
> >+  # This is practically going to forbid the loading of files
> >   # test0-type-suppr-v0.o and test0-type-suppr-v1.o
> >-  file_name_not_regexp = foo.*
> >-
> >+  file_name_not_regexp = foo\\.o
> >diff --git a/tests/data/test-diff-suppr/test0-type-suppr-6.suppr b/tests/data/test-diff-suppr/test0-type-suppr-6.suppr
> >index ee297fff..c0c5d078 100644
> >--- a/tests/data/test-diff-suppr/test0-type-suppr-6.suppr
> >+++ b/tests/data/test-diff-suppr/test0-type-suppr-6.suppr
> >@@ -1,5 +1,3 @@
> > [suppress_file]
> >-  # Avoid loading files which name does *NOT* match the regexp name
> >-  # foo.* This is practically going to forbid the loading of files
> >-  # test0-type-suppr-v0.o and test0-type-suppr-v1.o
> >-  file_name_not_regexp = (test0-type-suppr-v0.o|test0-type-suppr-v1.o)
> >+  # Only load files test0-type-suppr-v0.o or test0-type-suppr-v1.o
> >+  file_name_not_regexp = (^|/)(test0-type-suppr-v0\\.o|test0-type-suppr-v1\\.o)$
>
> As above.
>
> Other than that this looks good to me.
>
> Reviewed-by: Matthias Maennich <maennich@google.com>
>
> Cheers,
> Matthias
>
> >diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr
> >index 0ecaea27..9f24f89f 100644
> >--- a/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr
> >+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr
> >@@ -1,2 +1,2 @@
> > [suppress_variable]
> >-  name_regexp = .*var.$
> >+  name_regexp = var.$
> >diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr
> >index d0321556..0024c66b 100644
> >--- a/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr
> >+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_variable]
> >-  name_regexp = .*var.$
> >+  name_regexp = var.$
> >   change_kind = added-variable
> >diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr
> >index 42f55bbc..fabf4e25 100644
> >--- a/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr
> >+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_variable]
> >-  name_regexp = .*var.$
> >+  name_regexp = var.$
> >   change_kind = variable-subtype-change
> >diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr
> >index 7ad5cacb..3f2a565c 100644
> >--- a/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr
> >+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_variable]
> >-  name_regexp = .*var.$
> >+  name_regexp = var.$
> >   change_kind = all
> >diff --git a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr
> >index 61f4a6a7..f86ea294 100644
> >--- a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr
> >+++ b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_function]
> >-  symbol_name_regexp = _Z3.*
> >+  symbol_name_regexp = ^_Z3
> >   change_kind = deleted-function
> >diff --git a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr
> >index a32db428..0c2e2c21 100644
> >--- a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr
> >+++ b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_function]
> >-  symbol_name_regexp = _Z.*
> >-  change_kind = all
> >\ No newline at end of file
> >+  symbol_name_regexp = ^_Z
> >+  change_kind = all
> >diff --git a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr
> >index 21387c5c..a0562842 100644
> >--- a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr
> >+++ b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr
> >@@ -1,2 +1,2 @@
> > [suppress_function]
> >-  symbol_name_regexp = _Z.*
> >+  symbol_name_regexp = ^_Z
> >diff --git a/tests/data/test-diff-suppr/test23-alias-filter-1.suppr b/tests/data/test-diff-suppr/test23-alias-filter-1.suppr
> >index c0ffa797..3c0788c5 100644
> >--- a/tests/data/test-diff-suppr/test23-alias-filter-1.suppr
> >+++ b/tests/data/test-diff-suppr/test23-alias-filter-1.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_function]
> >-  name_regexp = ^__private_.*
> >+  name_regexp = ^__private_
> >   allow_other_aliases = yes
> >diff --git a/tests/data/test-diff-suppr/test23-alias-filter-2.suppr b/tests/data/test-diff-suppr/test23-alias-filter-2.suppr
> >index e8660292..c7d4220e 100644
> >--- a/tests/data/test-diff-suppr/test23-alias-filter-2.suppr
> >+++ b/tests/data/test-diff-suppr/test23-alias-filter-2.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_function]
> >-  name_regexp = ^__private_.*
> >+  name_regexp = ^__private_
> >   allow_other_aliases = no
> >diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-10.txt b/tests/data/test-diff-suppr/test24-soname-suppr-10.txt
> >index 004952fe..75103163 100644
> >--- a/tests/data/test-diff-suppr/test24-soname-suppr-10.txt
> >+++ b/tests/data/test-diff-suppr/test24-soname-suppr-10.txt
> >@@ -1,3 +1,3 @@
> > [suppress_type]
> >-  file_name_not_regexp = libtest24-soname.*\\.so
> >+  file_name_not_regexp = (^|/)libtest24-soname.*\\.so
> >
> >diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-11.txt b/tests/data/test-diff-suppr/test24-soname-suppr-11.txt
> >index 0f5db1d1..d1baf90c 100644
> >--- a/tests/data/test-diff-suppr/test24-soname-suppr-11.txt
> >+++ b/tests/data/test-diff-suppr/test24-soname-suppr-11.txt
> >@@ -1,3 +1,3 @@
> > [suppress_function]
> >-  file_name_not_regexp = libtest24-soname-wrong-name.*\\.so
> >+  file_name_not_regexp = (^|/)libtest24-soname-wrong-name.*\\.so
> >
> >diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-12.txt b/tests/data/test-diff-suppr/test24-soname-suppr-12.txt
> >index 59a14335..3e6c4e97 100644
> >--- a/tests/data/test-diff-suppr/test24-soname-suppr-12.txt
> >+++ b/tests/data/test-diff-suppr/test24-soname-suppr-12.txt
> >@@ -1,2 +1,2 @@
> > [suppress_function]
> >-  file_name_not_regexp = libtest24-soname.*\\.so
> >+  file_name_not_regexp = (^|/)libtest24-soname.*\\.so
> >diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-2.txt b/tests/data/test-diff-suppr/test24-soname-suppr-2.txt
> >index 439321d8..65b50fbb 100644
> >--- a/tests/data/test-diff-suppr/test24-soname-suppr-2.txt
> >+++ b/tests/data/test-diff-suppr/test24-soname-suppr-2.txt
> >@@ -1,4 +1,4 @@
> > [suppress_type]
> >-  file_name_regexp = .*/libtest24-soname-v0.so$
> >+  file_name_regexp = (^|/)libtest24-soname-v0\\.so$
> >   name = S
> >   reached_through = reference_or_pointer
> >diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-3.txt b/tests/data/test-diff-suppr/test24-soname-suppr-3.txt
> >index 1e23370e..f72fd141 100644
> >--- a/tests/data/test-diff-suppr/test24-soname-suppr-3.txt
> >+++ b/tests/data/test-diff-suppr/test24-soname-suppr-3.txt
> >@@ -1,4 +1,4 @@
> > [suppress_type]
> >-  file_name_regexp = .*/libtest24-soname-v1.so$
> >+  file_name_regexp = (^|/)libtest24-soname-v1\\.so$
> >   name = S
> >   reached_through = reference_or_pointer
> >diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-4.txt b/tests/data/test-diff-suppr/test24-soname-suppr-4.txt
> >index 1893ae6e..29a0b6ec 100644
> >--- a/tests/data/test-diff-suppr/test24-soname-suppr-4.txt
> >+++ b/tests/data/test-diff-suppr/test24-soname-suppr-4.txt
> >@@ -1,4 +1,4 @@
> > [suppress_type]
> >-  file_name_regexp = ^libtest24-soname-<wrong-file-name>.so$
> >+  file_name_regexp = (^|/)libtest24-soname-<wrong-file-name>\\.so$
> >   name = S
> >   reached_through = reference_or_pointer
> >diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-6.txt b/tests/data/test-diff-suppr/test24-soname-suppr-6.txt
> >index aae7f346..d10956ea 100644
> >--- a/tests/data/test-diff-suppr/test24-soname-suppr-6.txt
> >+++ b/tests/data/test-diff-suppr/test24-soname-suppr-6.txt
> >@@ -1,2 +1,2 @@
> > [suppress_function]
> >-  file_name_regexp = libtest24-soname.*\\.so
> >+  file_name_regexp = (^|/)libtest24-soname.*\\.so
> >diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-8.txt b/tests/data/test-diff-suppr/test24-soname-suppr-8.txt
> >index 15292cd4..53028b91 100644
> >--- a/tests/data/test-diff-suppr/test24-soname-suppr-8.txt
> >+++ b/tests/data/test-diff-suppr/test24-soname-suppr-8.txt
> >@@ -1,2 +1,2 @@
> > [suppress_type]
> >-  file_name_regexp = libtest24-soname.*\\.so
> >+  file_name_regexp = (^|/)libtest24-soname.*\\.so
> >diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-9.txt b/tests/data/test-diff-suppr/test24-soname-suppr-9.txt
> >index c5dc2562..23d15d4d 100644
> >--- a/tests/data/test-diff-suppr/test24-soname-suppr-9.txt
> >+++ b/tests/data/test-diff-suppr/test24-soname-suppr-9.txt
> >@@ -1,3 +1,3 @@
> > [suppress_type]
> >-  file_name_not_regexp = libtest24-soname-wrong-name.*\\.so
> >+  file_name_not_regexp = (^|/)libtest24-soname-wrong-name.*\\.so$
> >
> >diff --git a/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr b/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr
> >index b0c0675f..734bbe1d 100644
> >--- a/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr
> >+++ b/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr
> >@@ -1,2 +1,2 @@
> > [suppress_type]
> >-  source_location_not_regexp = test26-loc.*\\.h
> >+  source_location_not_regexp = (^|/)test26-loc.*\\.h$
> >diff --git a/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr b/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr
> >index 282702c6..576d87c6 100644
> >--- a/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr
> >+++ b/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr
> >@@ -1,2 +1,2 @@
> > [suppress_type]
> >-  source_location_not_regexp = test26-loc.*\\.cc
> >+  source_location_not_regexp = (^|/)test26-loc.*\\.cc$
> >diff --git a/tests/data/test-diff-suppr/test29-suppr-1.txt b/tests/data/test-diff-suppr/test29-suppr-1.txt
> >index 14012181..19a270f5 100644
> >--- a/tests/data/test-diff-suppr/test29-suppr-1.txt
> >+++ b/tests/data/test-diff-suppr/test29-suppr-1.txt
> >@@ -1,2 +1,2 @@
> > [suppress_variable]
> >-  file_name_regexp = libtest29-soname.*\\.so
> >+  file_name_regexp = (^|/)libtest29-soname.*\\.so$
> >diff --git a/tests/data/test-diff-suppr/test29-suppr-5.txt b/tests/data/test-diff-suppr/test29-suppr-5.txt
> >index c195ede5..2d6efeb6 100644
> >--- a/tests/data/test-diff-suppr/test29-suppr-5.txt
> >+++ b/tests/data/test-diff-suppr/test29-suppr-5.txt
> >@@ -1,3 +1,3 @@
> > [suppress_variable]
> >-  file_name_not_regexp = ^libtest29-soname-wrong.*\\.so$
> >+  file_name_not_regexp = (^|/)libtest29-soname-wrong.*\\.so$
> >
> >diff --git a/tests/data/test-diff-suppr/test29-suppr-6.txt b/tests/data/test-diff-suppr/test29-suppr-6.txt
> >index 55cfbc76..4d8c8d1b 100644
> >--- a/tests/data/test-diff-suppr/test29-suppr-6.txt
> >+++ b/tests/data/test-diff-suppr/test29-suppr-6.txt
> >@@ -1,3 +1,3 @@
> > [suppress_variable]
> >-  file_name_not_regexp = .*libtest29-soname.*\\.so$
> >+  file_name_not_regexp = (^|/)libtest29-soname.*\\.so$
> >
> >diff --git a/tests/data/test-diff-suppr/test29-suppr-7.txt b/tests/data/test-diff-suppr/test29-suppr-7.txt
> >index ba799b3e..5c0aa653 100644
> >--- a/tests/data/test-diff-suppr/test29-suppr-7.txt
> >+++ b/tests/data/test-diff-suppr/test29-suppr-7.txt
> >@@ -1,2 +1,2 @@
> > [suppress_type]
> >-  file_name_not_regexp = ^libtest29-soname-wrong.*\\.so$
> >+  file_name_not_regexp = (^|/)libtest29-soname-wrong.*\\.so$
> >diff --git a/tests/data/test-diff-suppr/test29-suppr-8.txt b/tests/data/test-diff-suppr/test29-suppr-8.txt
> >index 6c86f5b8..cc8b20e6 100644
> >--- a/tests/data/test-diff-suppr/test29-suppr-8.txt
> >+++ b/tests/data/test-diff-suppr/test29-suppr-8.txt
> >@@ -1,2 +1,2 @@
> > [suppress_type]
> >-  file_name_not_regexp = .*libtest29-soname.*\\.so$
> >+  file_name_not_regexp = (^|/)libtest29-soname.*\\.so$
> >diff --git a/tests/data/test-diff-suppr/test33-suppr-1.txt b/tests/data/test-diff-suppr/test33-suppr-1.txt
> >index 32d46796..069e345d 100644
> >--- a/tests/data/test-diff-suppr/test33-suppr-1.txt
> >+++ b/tests/data/test-diff-suppr/test33-suppr-1.txt
> >@@ -1,4 +1,4 @@
> > [suppress_type]
> >   type_kind = class
> >-  source_location_not_regexp = test33-v\[0-9\]*\\.h
> >+  source_location_not_regexp = (^|/)test33-v[0-9]*\\.h$
> >   drop = true
> >diff --git a/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore b/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore
> >index 07f3f91f..9318d513 100644
> >--- a/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore
> >+++ b/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore
> >@@ -1,4 +1,4 @@
> > [suppress_function]
> >- filename_regexp = ^test38-char-class-in-ini-v[[:digit:]].*
> >+ file_name_regexp = (^|/)test38-char-class-in-ini-v[[:digit:]]
> >  symbol_name_regexp = bar
> >  change_kind = added-function
> >diff --git a/tests/data/test-diff-suppr/test4-local-suppr-0.suppr b/tests/data/test-diff-suppr/test4-local-suppr-0.suppr
> >index b7c6271b..d917d350 100644
> >--- a/tests/data/test-diff-suppr/test4-local-suppr-0.suppr
> >+++ b/tests/data/test-diff-suppr/test4-local-suppr-0.suppr
> >@@ -1,3 +1,3 @@
> > [suppress_type]
> >   # Types whose name start with "private" should not be flagged
> >-  name_regexp = ^private.*
> >+  name_regexp = ^private
> >diff --git a/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr b/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr
> >index 0bead6d7..f6a361db 100644
> >--- a/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr
> >+++ b/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr
> >@@ -1,2 +1,2 @@
> > [suppress_function]
> >-  symbol_version_regexp = VERSION_1\.*
> >+  symbol_version_regexp = ^VERSION_1
> >diff --git a/tests/data/test-diff-suppr/test7-var-suppr-9.suppr b/tests/data/test-diff-suppr/test7-var-suppr-9.suppr
> >index cbe8b0bc..5d0bdd70 100644
> >--- a/tests/data/test-diff-suppr/test7-var-suppr-9.suppr
> >+++ b/tests/data/test-diff-suppr/test7-var-suppr-9.suppr
> >@@ -1,7 +1,7 @@
> > [suppress_function]
> > # This one shouldn't catch anything, but it must be parsed fine.
> >-  symbol_version_regexp = ^VERSION_\[0-9\]\\.\[0-9\]$
> >+  symbol_version_regexp = ^VERSION_[0-9]\\.[0-9]$
> >
> > [suppress_variable]
> > # This one should be parsed fine too.
> >-  symbol_version_regexp = ^VERSION_\[0-9\]\\.\[0-9\]$
> >\ No newline at end of file
> >+  symbol_version_regexp = ^VERSION_[0-9]\\.[0-9]$
> >--
> >2.26.1.301.g55bc3eb7cb9-goog
> >
Dodji Seketeli April 22, 2020, 1:48 p.m. UTC | #3
Hello Giuliano,

Giuliano Procida <gprocida@google.com> a ?crit:

> The are some (mostly inconsequential) issues with regexes:
>
>   - Leading and trailing .* are redundant and can be removed.

They are redundant I agree, but that redundancy can be useful, I think.
The reason why I have put them in the test is that in the past, I have
tried different regular expression engines.  Some of them would
implement the quantifier in a greedy manner, rather than in a lazy
manner.  Whereas, what I find more useful is the lazy variant.  So that
writing ".*blah" would do what you would expect (rather than having to
write .*?blah)

So putting that in those tests explicitly will hopefully help us catch
potential issues if we are to switch to a different engine tomorrow.  So
I'd prefer keeping that redundancy in those tests.

[...]

>   - File name matches are full path

Are they?

It seems to me file_suppression::suppress_file() acts on the base name
of the file, rather than on its full path.

I might be missing something here, please tell me.

> so should start with (^|/) if trying to match a base name, assuming a
> Unix-like filesystem.

I'd need the above to be clarified to say for sure.

>     Given these are just tests, it's not that important, but they
>     still serve as examples.
>     - In cases where the ^ anchor was used, full paths would usually
>       fail to match. In such cases, the regex was being ignored for
>       other reasons (see later patch) or is expected not to match
>       anyway.
>     - In many cases, the $ anchor could be considered to be missing.
>   - The .ini parser unescapes string values, so escaping regex
>     metacharacters requires a double backslash. Single backslashes
>     are pointless.
>   - The dot metacharacter is used unescaped in a few places where a
>     literal was likely intended, so should be escaped.
>   - The characters [ and ] don't need to be (.ini) escaped.

They don't *need* to (in a string) I agree.  But it they are escaped,
that should work.  It's a way to test the init parser as well.  So I'd
keep the redundancy there as well.

[...]

Cheers,
diff mbox series

Patch

diff --git a/tests/data/test-diff-suppr/libtest31.suppr b/tests/data/test-diff-suppr/libtest31.suppr
index 57929eca..3fe933a6 100644
--- a/tests/data/test-diff-suppr/libtest31.suppr
+++ b/tests/data/test-diff-suppr/libtest31.suppr
@@ -1,3 +1,3 @@ 
 [suppress_function]
   drop = yes
-  name_regexp = hidden::.*
+  name_regexp = ^hidden::
diff --git a/tests/data/test-diff-suppr/libtest32-0.suppr b/tests/data/test-diff-suppr/libtest32-0.suppr
index b79bb965..04179b48 100644
--- a/tests/data/test-diff-suppr/libtest32-0.suppr
+++ b/tests/data/test-diff-suppr/libtest32-0.suppr
@@ -1,3 +1,3 @@ 
 [suppress_function]
-  name_not_regexp = ^pub::.*
+  name_not_regexp = ^pub::
   drop_artifact = true
diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt
index c9b7ad46..7d99a709 100644
--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt
+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt
@@ -1,2 +1,2 @@ 
 [suppress_file]
-  soname_regexp = test48<typo>-soname-abixml-v.*
+  soname_regexp = test48<typo>-soname-abixml-v
diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt
index c69c2504..64470ca4 100644
--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt
+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt
@@ -1,2 +1,2 @@ 
 [suppress_file]
-  file_name_regexp = ^libtest48-soname-abixml-v.*$
+  file_name_regexp = (^|/)libtest48-soname-abixml-v
diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt
index 1a205275..dd4235f9 100644
--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt
+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt
@@ -1,2 +1,2 @@ 
 [suppress_file]
-  file_name_regexp = ^libtest48<typo>-soname-abixml-v.*$
+  file_name_regexp = (^|/)libtest48<typo>-soname-abixml-v
diff --git a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt
index 08d61c0f..bc44c4fd 100644
--- a/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt
+++ b/tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt
@@ -1,2 +1,2 @@ 
 [suppress_file]
-  soname_regexp = test48-soname-abixml-v.*
+  soname_regexp = test48-soname-abixml-v
diff --git a/tests/data/test-diff-suppr/test0-type-suppr-0.suppr b/tests/data/test-diff-suppr/test0-type-suppr-0.suppr
index be876c77..151005e1 100644
--- a/tests/data/test-diff-suppr/test0-type-suppr-0.suppr
+++ b/tests/data/test-diff-suppr/test0-type-suppr-0.suppr
@@ -1,2 +1,2 @@ 
 [suppress_type]
-  name_regexp = .*Private$
+  name_regexp = Private$
diff --git a/tests/data/test-diff-suppr/test0-type-suppr-3.suppr b/tests/data/test-diff-suppr/test0-type-suppr-3.suppr
index b84fcc41..eb63bc53 100644
--- a/tests/data/test-diff-suppr/test0-type-suppr-3.suppr
+++ b/tests/data/test-diff-suppr/test0-type-suppr-3.suppr
@@ -1,5 +1,3 @@ 
 [suppress_file]
-  #
   # Do not load files test0-type-suppr-v0.o or test0-type-suppr-v1.o
-  #
-  file_name_regexp = (test0-type-suppr-v0.o|test0-type-suppr-v1.o)
+  file_name_regexp = (^|/)(test0-type-suppr-v0\\.o|test0-type-suppr-v1\\.o)$
diff --git a/tests/data/test-diff-suppr/test0-type-suppr-4.suppr b/tests/data/test-diff-suppr/test0-type-suppr-4.suppr
index 32552acb..5d122b4e 100644
--- a/tests/data/test-diff-suppr/test0-type-suppr-4.suppr
+++ b/tests/data/test-diff-suppr/test0-type-suppr-4.suppr
@@ -1,5 +1,4 @@ 
 [suppress_file]
-  # Do not load files foo.o.  This is practically going to allow the
+  # Do not load files *foo.o*.  This is practically going to allow the
   # loading of files test0-type-suppr-v0.o and test0-type-suppr-v1.o.
-  file_name_regexp = foo.*
-
+  file_name_regexp = foo\\.o
diff --git a/tests/data/test-diff-suppr/test0-type-suppr-5.suppr b/tests/data/test-diff-suppr/test0-type-suppr-5.suppr
index 1fa3b1ce..0a06e8d0 100644
--- a/tests/data/test-diff-suppr/test0-type-suppr-5.suppr
+++ b/tests/data/test-diff-suppr/test0-type-suppr-5.suppr
@@ -1,6 +1,5 @@ 
 [suppress_file]
-  # Avoid loading files which name does *NOT* match the regexp name
-  # foo.* This is practically going to forbid the loading of files
+  # Avoid loading files which name does *NOT* match *foo.o*.
+  # This is practically going to forbid the loading of files
   # test0-type-suppr-v0.o and test0-type-suppr-v1.o
-  file_name_not_regexp = foo.*
-
+  file_name_not_regexp = foo\\.o
diff --git a/tests/data/test-diff-suppr/test0-type-suppr-6.suppr b/tests/data/test-diff-suppr/test0-type-suppr-6.suppr
index ee297fff..c0c5d078 100644
--- a/tests/data/test-diff-suppr/test0-type-suppr-6.suppr
+++ b/tests/data/test-diff-suppr/test0-type-suppr-6.suppr
@@ -1,5 +1,3 @@ 
 [suppress_file]
-  # Avoid loading files which name does *NOT* match the regexp name
-  # foo.* This is practically going to forbid the loading of files
-  # test0-type-suppr-v0.o and test0-type-suppr-v1.o
-  file_name_not_regexp = (test0-type-suppr-v0.o|test0-type-suppr-v1.o)
+  # Only load files test0-type-suppr-v0.o or test0-type-suppr-v1.o
+  file_name_not_regexp = (^|/)(test0-type-suppr-v0\\.o|test0-type-suppr-v1\\.o)$
diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr
index 0ecaea27..9f24f89f 100644
--- a/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr
+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-0.suppr
@@ -1,2 +1,2 @@ 
 [suppress_variable]
-  name_regexp = .*var.$
+  name_regexp = var.$
diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr
index d0321556..0024c66b 100644
--- a/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr
+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-1.suppr
@@ -1,3 +1,3 @@ 
 [suppress_variable]
-  name_regexp = .*var.$
+  name_regexp = var.$
   change_kind = added-variable
diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr
index 42f55bbc..fabf4e25 100644
--- a/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr
+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-2.suppr
@@ -1,3 +1,3 @@ 
 [suppress_variable]
-  name_regexp = .*var.$
+  name_regexp = var.$
   change_kind = variable-subtype-change
diff --git a/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr b/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr
index 7ad5cacb..3f2a565c 100644
--- a/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr
+++ b/tests/data/test-diff-suppr/test17-suppr-added-var-3.suppr
@@ -1,3 +1,3 @@ 
 [suppress_variable]
-  name_regexp = .*var.$
+  name_regexp = var.$
   change_kind = all
diff --git a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr
index 61f4a6a7..f86ea294 100644
--- a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr
+++ b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr
@@ -1,3 +1,3 @@ 
 [suppress_function]
-  symbol_name_regexp = _Z3.*
+  symbol_name_regexp = ^_Z3
   change_kind = deleted-function
diff --git a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr
index a32db428..0c2e2c21 100644
--- a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr
+++ b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr
@@ -1,3 +1,3 @@ 
 [suppress_function]
-  symbol_name_regexp = _Z.*
-  change_kind = all
\ No newline at end of file
+  symbol_name_regexp = ^_Z
+  change_kind = all
diff --git a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr
index 21387c5c..a0562842 100644
--- a/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr
+++ b/tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr
@@ -1,2 +1,2 @@ 
 [suppress_function]
-  symbol_name_regexp = _Z.*
+  symbol_name_regexp = ^_Z
diff --git a/tests/data/test-diff-suppr/test23-alias-filter-1.suppr b/tests/data/test-diff-suppr/test23-alias-filter-1.suppr
index c0ffa797..3c0788c5 100644
--- a/tests/data/test-diff-suppr/test23-alias-filter-1.suppr
+++ b/tests/data/test-diff-suppr/test23-alias-filter-1.suppr
@@ -1,3 +1,3 @@ 
 [suppress_function]
-  name_regexp = ^__private_.*
+  name_regexp = ^__private_
   allow_other_aliases = yes
diff --git a/tests/data/test-diff-suppr/test23-alias-filter-2.suppr b/tests/data/test-diff-suppr/test23-alias-filter-2.suppr
index e8660292..c7d4220e 100644
--- a/tests/data/test-diff-suppr/test23-alias-filter-2.suppr
+++ b/tests/data/test-diff-suppr/test23-alias-filter-2.suppr
@@ -1,3 +1,3 @@ 
 [suppress_function]
-  name_regexp = ^__private_.*
+  name_regexp = ^__private_
   allow_other_aliases = no
diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-10.txt b/tests/data/test-diff-suppr/test24-soname-suppr-10.txt
index 004952fe..75103163 100644
--- a/tests/data/test-diff-suppr/test24-soname-suppr-10.txt
+++ b/tests/data/test-diff-suppr/test24-soname-suppr-10.txt
@@ -1,3 +1,3 @@ 
 [suppress_type]
-  file_name_not_regexp = libtest24-soname.*\\.so
+  file_name_not_regexp = (^|/)libtest24-soname.*\\.so
 
diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-11.txt b/tests/data/test-diff-suppr/test24-soname-suppr-11.txt
index 0f5db1d1..d1baf90c 100644
--- a/tests/data/test-diff-suppr/test24-soname-suppr-11.txt
+++ b/tests/data/test-diff-suppr/test24-soname-suppr-11.txt
@@ -1,3 +1,3 @@ 
 [suppress_function]
-  file_name_not_regexp = libtest24-soname-wrong-name.*\\.so
+  file_name_not_regexp = (^|/)libtest24-soname-wrong-name.*\\.so
 
diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-12.txt b/tests/data/test-diff-suppr/test24-soname-suppr-12.txt
index 59a14335..3e6c4e97 100644
--- a/tests/data/test-diff-suppr/test24-soname-suppr-12.txt
+++ b/tests/data/test-diff-suppr/test24-soname-suppr-12.txt
@@ -1,2 +1,2 @@ 
 [suppress_function]
-  file_name_not_regexp = libtest24-soname.*\\.so
+  file_name_not_regexp = (^|/)libtest24-soname.*\\.so
diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-2.txt b/tests/data/test-diff-suppr/test24-soname-suppr-2.txt
index 439321d8..65b50fbb 100644
--- a/tests/data/test-diff-suppr/test24-soname-suppr-2.txt
+++ b/tests/data/test-diff-suppr/test24-soname-suppr-2.txt
@@ -1,4 +1,4 @@ 
 [suppress_type]
-  file_name_regexp = .*/libtest24-soname-v0.so$
+  file_name_regexp = (^|/)libtest24-soname-v0\\.so$
   name = S
   reached_through = reference_or_pointer
diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-3.txt b/tests/data/test-diff-suppr/test24-soname-suppr-3.txt
index 1e23370e..f72fd141 100644
--- a/tests/data/test-diff-suppr/test24-soname-suppr-3.txt
+++ b/tests/data/test-diff-suppr/test24-soname-suppr-3.txt
@@ -1,4 +1,4 @@ 
 [suppress_type]
-  file_name_regexp = .*/libtest24-soname-v1.so$
+  file_name_regexp = (^|/)libtest24-soname-v1\\.so$
   name = S
   reached_through = reference_or_pointer
diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-4.txt b/tests/data/test-diff-suppr/test24-soname-suppr-4.txt
index 1893ae6e..29a0b6ec 100644
--- a/tests/data/test-diff-suppr/test24-soname-suppr-4.txt
+++ b/tests/data/test-diff-suppr/test24-soname-suppr-4.txt
@@ -1,4 +1,4 @@ 
 [suppress_type]
-  file_name_regexp = ^libtest24-soname-<wrong-file-name>.so$
+  file_name_regexp = (^|/)libtest24-soname-<wrong-file-name>\\.so$
   name = S
   reached_through = reference_or_pointer
diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-6.txt b/tests/data/test-diff-suppr/test24-soname-suppr-6.txt
index aae7f346..d10956ea 100644
--- a/tests/data/test-diff-suppr/test24-soname-suppr-6.txt
+++ b/tests/data/test-diff-suppr/test24-soname-suppr-6.txt
@@ -1,2 +1,2 @@ 
 [suppress_function]
-  file_name_regexp = libtest24-soname.*\\.so
+  file_name_regexp = (^|/)libtest24-soname.*\\.so
diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-8.txt b/tests/data/test-diff-suppr/test24-soname-suppr-8.txt
index 15292cd4..53028b91 100644
--- a/tests/data/test-diff-suppr/test24-soname-suppr-8.txt
+++ b/tests/data/test-diff-suppr/test24-soname-suppr-8.txt
@@ -1,2 +1,2 @@ 
 [suppress_type]
-  file_name_regexp = libtest24-soname.*\\.so
+  file_name_regexp = (^|/)libtest24-soname.*\\.so
diff --git a/tests/data/test-diff-suppr/test24-soname-suppr-9.txt b/tests/data/test-diff-suppr/test24-soname-suppr-9.txt
index c5dc2562..23d15d4d 100644
--- a/tests/data/test-diff-suppr/test24-soname-suppr-9.txt
+++ b/tests/data/test-diff-suppr/test24-soname-suppr-9.txt
@@ -1,3 +1,3 @@ 
 [suppress_type]
-  file_name_not_regexp = libtest24-soname-wrong-name.*\\.so
+  file_name_not_regexp = (^|/)libtest24-soname-wrong-name.*\\.so$
 
diff --git a/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr b/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr
index b0c0675f..734bbe1d 100644
--- a/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr
+++ b/tests/data/test-diff-suppr/test26-loc-suppr-1.suppr
@@ -1,2 +1,2 @@ 
 [suppress_type]
-  source_location_not_regexp = test26-loc.*\\.h
+  source_location_not_regexp = (^|/)test26-loc.*\\.h$
diff --git a/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr b/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr
index 282702c6..576d87c6 100644
--- a/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr
+++ b/tests/data/test-diff-suppr/test26-loc-suppr-2.suppr
@@ -1,2 +1,2 @@ 
 [suppress_type]
-  source_location_not_regexp = test26-loc.*\\.cc
+  source_location_not_regexp = (^|/)test26-loc.*\\.cc$
diff --git a/tests/data/test-diff-suppr/test29-suppr-1.txt b/tests/data/test-diff-suppr/test29-suppr-1.txt
index 14012181..19a270f5 100644
--- a/tests/data/test-diff-suppr/test29-suppr-1.txt
+++ b/tests/data/test-diff-suppr/test29-suppr-1.txt
@@ -1,2 +1,2 @@ 
 [suppress_variable]
-  file_name_regexp = libtest29-soname.*\\.so
+  file_name_regexp = (^|/)libtest29-soname.*\\.so$
diff --git a/tests/data/test-diff-suppr/test29-suppr-5.txt b/tests/data/test-diff-suppr/test29-suppr-5.txt
index c195ede5..2d6efeb6 100644
--- a/tests/data/test-diff-suppr/test29-suppr-5.txt
+++ b/tests/data/test-diff-suppr/test29-suppr-5.txt
@@ -1,3 +1,3 @@ 
 [suppress_variable]
-  file_name_not_regexp = ^libtest29-soname-wrong.*\\.so$
+  file_name_not_regexp = (^|/)libtest29-soname-wrong.*\\.so$
 
diff --git a/tests/data/test-diff-suppr/test29-suppr-6.txt b/tests/data/test-diff-suppr/test29-suppr-6.txt
index 55cfbc76..4d8c8d1b 100644
--- a/tests/data/test-diff-suppr/test29-suppr-6.txt
+++ b/tests/data/test-diff-suppr/test29-suppr-6.txt
@@ -1,3 +1,3 @@ 
 [suppress_variable]
-  file_name_not_regexp = .*libtest29-soname.*\\.so$
+  file_name_not_regexp = (^|/)libtest29-soname.*\\.so$
 
diff --git a/tests/data/test-diff-suppr/test29-suppr-7.txt b/tests/data/test-diff-suppr/test29-suppr-7.txt
index ba799b3e..5c0aa653 100644
--- a/tests/data/test-diff-suppr/test29-suppr-7.txt
+++ b/tests/data/test-diff-suppr/test29-suppr-7.txt
@@ -1,2 +1,2 @@ 
 [suppress_type]
-  file_name_not_regexp = ^libtest29-soname-wrong.*\\.so$
+  file_name_not_regexp = (^|/)libtest29-soname-wrong.*\\.so$
diff --git a/tests/data/test-diff-suppr/test29-suppr-8.txt b/tests/data/test-diff-suppr/test29-suppr-8.txt
index 6c86f5b8..cc8b20e6 100644
--- a/tests/data/test-diff-suppr/test29-suppr-8.txt
+++ b/tests/data/test-diff-suppr/test29-suppr-8.txt
@@ -1,2 +1,2 @@ 
 [suppress_type]
-  file_name_not_regexp = .*libtest29-soname.*\\.so$
+  file_name_not_regexp = (^|/)libtest29-soname.*\\.so$
diff --git a/tests/data/test-diff-suppr/test33-suppr-1.txt b/tests/data/test-diff-suppr/test33-suppr-1.txt
index 32d46796..069e345d 100644
--- a/tests/data/test-diff-suppr/test33-suppr-1.txt
+++ b/tests/data/test-diff-suppr/test33-suppr-1.txt
@@ -1,4 +1,4 @@ 
 [suppress_type]
   type_kind = class
-  source_location_not_regexp = test33-v\[0-9\]*\\.h
+  source_location_not_regexp = (^|/)test33-v[0-9]*\\.h$
   drop = true
diff --git a/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore b/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore
index 07f3f91f..9318d513 100644
--- a/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore
+++ b/tests/data/test-diff-suppr/test38-char-class-in-ini.abignore
@@ -1,4 +1,4 @@ 
 [suppress_function]
- filename_regexp = ^test38-char-class-in-ini-v[[:digit:]].*
+ file_name_regexp = (^|/)test38-char-class-in-ini-v[[:digit:]]
  symbol_name_regexp = bar
  change_kind = added-function
diff --git a/tests/data/test-diff-suppr/test4-local-suppr-0.suppr b/tests/data/test-diff-suppr/test4-local-suppr-0.suppr
index b7c6271b..d917d350 100644
--- a/tests/data/test-diff-suppr/test4-local-suppr-0.suppr
+++ b/tests/data/test-diff-suppr/test4-local-suppr-0.suppr
@@ -1,3 +1,3 @@ 
 [suppress_type]
   # Types whose name start with "private" should not be flagged
-  name_regexp = ^private.*
+  name_regexp = ^private
diff --git a/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr b/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr
index 0bead6d7..f6a361db 100644
--- a/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr
+++ b/tests/data/test-diff-suppr/test6-fn-suppr-1.suppr
@@ -1,2 +1,2 @@ 
 [suppress_function]
-  symbol_version_regexp = VERSION_1\.*
+  symbol_version_regexp = ^VERSION_1
diff --git a/tests/data/test-diff-suppr/test7-var-suppr-9.suppr b/tests/data/test-diff-suppr/test7-var-suppr-9.suppr
index cbe8b0bc..5d0bdd70 100644
--- a/tests/data/test-diff-suppr/test7-var-suppr-9.suppr
+++ b/tests/data/test-diff-suppr/test7-var-suppr-9.suppr
@@ -1,7 +1,7 @@ 
 [suppress_function]
 # This one shouldn't catch anything, but it must be parsed fine.
-  symbol_version_regexp = ^VERSION_\[0-9\]\\.\[0-9\]$
+  symbol_version_regexp = ^VERSION_[0-9]\\.[0-9]$
 
 [suppress_variable]
 # This one should be parsed fine too.
-  symbol_version_regexp = ^VERSION_\[0-9\]\\.\[0-9\]$
\ No newline at end of file
+  symbol_version_regexp = ^VERSION_[0-9]\\.[0-9]$