[apparmor] [patch 04/12] parser: add more convert_aaregex_to_pcre() unit tests
Seth Arnold
seth.arnold at canonical.com
Fri Dec 6 18:50:54 UTC 2013
On Fri, Dec 06, 2013 at 06:10:55AM -0800, Steve Beattie wrote:
> > I think one more case would be useful, to check that /**/ works as
> > expected:
> >
> > MY_REGEX_TEST("/**/", "/[^/\\x00][^\\x00]*/", ePatternTailGlob);
> >
> > Does that look right?
>
> Correct except for the type returned, which will be ePatternRegex if I'm
> not mistaken.
Copy-and-waste for the win.
> And, I think tests for both /*/ and /**/ would be useful. So here's a
> patch:
>
> Signed-off-by: Steve Beattie <steve at nxnw.org>
Acked-by: Seth Arnold <seth.arnold at canonical.com>
Thanks!
> ---
> parser/parser_regex.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> Index: b/parser/parser_regex.c
> ===================================================================
> --- a/parser/parser_regex.c
> +++ b/parser/parser_regex.c
> @@ -1390,9 +1390,11 @@ static int test_aaregex_to_pcre(void)
> MY_REGEX_TEST("/*", "/[^/\\x00][^/\\x00]*", ePatternRegex);
> MY_REGEX_TEST("/blort/*", "/blort/[^/\\x00][^/\\x00]*", ePatternRegex);
> MY_REGEX_TEST("/*/blort", "/[^/\\x00][^/\\x00]*/blort", ePatternRegex);
> + MY_REGEX_TEST("/*/", "/[^/\\x00][^/\\x00]*/", ePatternRegex);
> MY_REGEX_TEST("/**", "/[^/\\x00][^\\x00]*", ePatternTailGlob);
> MY_REGEX_TEST("/blort/**", "/blort/[^/\\x00][^\\x00]*", ePatternTailGlob);
> MY_REGEX_TEST("/**/blort", "/[^/\\x00][^\\x00]*/blort", ePatternRegex);
> + MY_REGEX_TEST("/**/", "/[^/\\x00][^\\x00]*/", ePatternRegex);
>
> /* more complicated quoting */
> MY_REGEX_FAIL_TEST("\\\\[");
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20131206/5d6f561a/attachment.pgp>
More information about the AppArmor
mailing list