[pacman-dev] [PATCH 5/5] pmtest: add memory check to tests with valgrind

Dan McGee dpmcgee at gmail.com
Sun Jan 26 15:10:21 EST 2014


On Mon, Jan 6, 2014 at 2:19 PM, Andrew Gregory
<andrew.gregory.8 at gmail.com>wrote:

> Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> ---
>
Seems like this is two patches in one- one to add FILE_EMPTY, and one to
use it.

How does FILE_EMPTY behave in these cases? Namely the first one feels like
a gray area that the code does not make super obvious.
* File doesn't exist
* File exists, is empty
* File exists, is not empty
* File is a directory

Also, don't we document the available rules somewhere?


>  test/pacman/pmrule.py | 3 +++
>  test/pacman/pmtest.py | 1 +
>  2 files changed, 4 insertions(+)
>
> diff --git a/test/pacman/pmrule.py b/test/pacman/pmrule.py
> index ba94ab8..96ecdec 100644
> --- a/test/pacman/pmrule.py
> +++ b/test/pacman/pmrule.py
> @@ -112,6 +112,9 @@ def check(self, test):
>              if case == "EXIST":
>                  if not os.path.isfile(filename):
>                      success = 0
> +            elif case == "EMPTY":
> +                if not os.path.getsize(filename) == 0:
> +                    success = 0
>              elif case == "MODIFIED":
>                  for f in test.files:
>                      if f.name == key:
> diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py
> index e780a6d..7079b78 100644
> --- a/test/pacman/pmtest.py
> +++ b/test/pacman/pmtest.py
> @@ -224,6 +224,7 @@ def run(self, pacman):
>                  "--child-silent-after-fork=yes",
>                  "--log-file=%s" % os.path.join(self.root,
> "var/log/valgrind"),
>                  "--suppressions=%s" % suppfile])
> +            self.addrule("FILE_EMPTY=var/log/valgrind")
>          cmd.extend([pacman["bin"],
>              "--config", os.path.join(self.root, util.PACCONF),
>              "--root", self.root,
> --
> 1.8.5.2
>
>
>


More information about the pacman-dev mailing list