[elbe-devel] [PATCH 07/10] tests: test_preproc: initial implementation

Bastian Germann bage at linutronix.de
Thu Apr 1 18:25:46 CEST 2021


Am 01.04.21 um 13:15 schrieb Torben Hohn:
> run "elbe preprocess" on tests/preproc-*.xml
> 
> This allows testing the schema, and also checks, whether the schema
> supports base="xxx" attributes, originating from xinclude, everywhere.
> 
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>

Reviewed-by: Bastian Germann <bage at linutronix.de>

> ---
>   elbepack/tests/test_preproc.py | 38 ++++++++++++++++++++++++++++++++++
>   1 file changed, 38 insertions(+)
>   create mode 100644 elbepack/tests/test_preproc.py
> 
> diff --git a/elbepack/tests/test_preproc.py b/elbepack/tests/test_preproc.py
> new file mode 100644
> index 000000000..49c59d960
> --- /dev/null
> +++ b/elbepack/tests/test_preproc.py
> @@ -0,0 +1,38 @@
> +# ELBE - Debian Based Embedded Rootfilesystem Builder
> +# Copyright (c) 2020 Olivier Dion <dion at linutronix.de>
> +# Copyright (c) 2021 Torben Hohn <torben.hohn at linutronix.de>
> +#
> +# SPDX-License-Identifier: GPL-3.0-or-later
> +
> +import os
> +
> +from elbepack.commands.test import ElbeTestCase, system, ElbeTestException
> +from elbepack.shellhelper import command_out, system_out
> +from elbepack.directories import pack_dir, elbe_exe, elbe_dir
> +
> +class TestPreproc(ElbeTestCase):
> +
> +    failure_set = {os.path.join(elbe_dir, path)
> +                   for path
> +                   in [
> +                       "tests/preproc-01.xml"
> +                   ]}
> +
> +    params = [os.path.join(elbe_dir, "tests", fname)
> +              for fname
> +              in os.listdir(os.path.join(elbe_dir, "tests"))
> +              if fname.startswith("preproc") and fname.endswith(".xml")]
> +
> +    def test_preproc(self):
> +
> +        try:
> +            system(f'{elbe_exe} "{self.param}"')
> +        except ElbeTestException as e:
> +            if self.param in TestPreproc.failure_set:
> +                self.skipTest("Preproc test for %s is expected to fail" % (self.param))
> +                self.stdout = e.out
> +            else:
> +                raise
> +        else:
> +            if self.param in TestPreproc.failure_set:
> +                raise Exception(f"Preproc test for {self.param} is expected to fail, but did not !")
> 


More information about the elbe-devel mailing list