tests: Add unit tests for cgroup_compare_wildcard_procname()
This commit adds unit tests for cgroup_compare_wildcard_procname().
The following tests are included in this commit:
WildcardProcnameSimpleMatch - Compares an ignore rule with a
wildcarded procname with a matching procname. Expects true.
WildcardProcnameNoMatch - Compares an ignore rule with a wildcarded
procname with a process that has a non-matching name. Expects
false.
ProcnameWildcard_AsteriskNoMatch - Compares a wildcard rule with
a process name that doesn't match. Expects false.
ProcnameWildcard_AsteriskMatch - Compares a wildcard rule with
a process name that does match the rule. Expects true.
ProcnameWildcard_AsteriskNoMatch2 - Compares a wildcard rule
with a process name that is shorter than the rule and thus
does not match. Expects false.
ProcnameWildcard_AsteriskMatchExactly - Compares a wildcard
rule with a process name that matches the rule exactly.
Expects true.
ProcnameWildcard_NoAsteriskMatchExactly - Compares a rule
with no wildcards with a process name that exactly matches
the rule. Expects false as the function exits early due
to no asterisk in the rule.
The results from googletest are reported below:
[----------] 13 tests from CgroupCompareIgnoreRuleTest
<snip>
[ RUN ] CgroupCompareIgnoreRuleTest.WildcardProcnameSimpleMatch
[ OK ] CgroupCompareIgnoreRuleTest.WildcardProcnameSimpleMatch (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.WildcardProcnameNoMatch
[ OK ] CgroupCompareIgnoreRuleTest.WildcardProcnameNoMatch (0 ms)
[----------] 13 tests from CgroupCompareIgnoreRuleTest (1 ms total)
[----------] 7 tests from ProcnameWildcardTest
[ RUN ] ProcnameWildcardTest.ProcnameWildcard_NoAsterisk
[ OK ] ProcnameWildcardTest.ProcnameWildcard_NoAsterisk (0 ms)
[ RUN ] ProcnameWildcardTest.ProcnameWildcard_AsteriskNoMatch
[ OK ] ProcnameWildcardTest.ProcnameWildcard_AsteriskNoMatch (0 ms)
[ RUN ] ProcnameWildcardTest.ProcnameWildcard_AsteriskMatch
[ OK ] ProcnameWildcardTest.ProcnameWildcard_AsteriskMatch (0 ms)
[ RUN ] ProcnameWildcardTest.ProcnameWildcard_AsteriskNoMatch2
[ OK ] ProcnameWildcardTest.ProcnameWildcard_AsteriskNoMatch2 (0 ms)
[ RUN ] ProcnameWildcardTest.ProcnameWildcard_AsteriskMatchExactly
[ OK ] ProcnameWildcardTest.ProcnameWildcard_AsteriskMatchExactly (0 ms)
[ RUN ] ProcnameWildcardTest.ProcnameWildcard_NoAsteriskMatchExactly
[ OK ] ProcnameWildcardTest.ProcnameWildcard_NoAsteriskMatchExactly (0 ms)
[ RUN ] ProcnameWildcardTest.ProcnameWildcard_AsteriskFirstChar
[ OK ] ProcnameWildcardTest.ProcnameWildcard_AsteriskFirstChar (0 ms)
[----------] 7 tests from ProcnameWildcardTest (0 ms total)
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>