Commit 9c0113de authored by Jérome Perrin's avatar Jérome Perrin

test: fix tests on python2

1dc49d3e (tests: ignore CryptographyDeprecationWarning on python2, 2021-08-13)
was wrong, because this warning includes the path of the software, which
also has a md5sum hash, so the normalization has to be done before the
md5sum normalization, otherwise this consumes an md5sum and they become
off by one, with errors like:

    Expected:
        package: shared at /shared/package/<MD5SUM:0>
        Uninstalling package.
        Installing package.
        package: Checking whether package is installed at shared path: /shared/package/<MD5SUM:0>
        package: [ENV] FOO = bar
        package: Command 'set -e;./configure --prefix=/shared/package/<MD5SUM:0>"' returned non-zero exit status 127.
        package: Compilation error. The package is left as is at /shared/package/<MD5SUM:0>__compile__ where you can inspect what went wrong.
        A shell script slapos.recipe.build.env.sh has been generated. You can source it in your shell to reproduce build environment.
        /bin/sh: 1: ./configure: not found
        While:
          Installing package.
        Error: System error
    Got:
        package: shared at /shared/package/<MD5SUM:1>
        Uninstalling package.
        Installing package.
        package: Checking whether package is installed at shared path: /shared/package/<MD5SUM:1>
        package: [ENV] FOO = bar
        package: Command 'set -e;./configure --prefix=/shared/package/<MD5SUM:1>"' returned non-zero exit status 127.
        package: Compilation error. The package is left as is at /shared/package/<MD5SUM:1>__compile__ where you can inspect what went wrong.
        A shell script slapos.recipe.build.env.sh has been generated. You can source it in your shell to reproduce build environment.
        <BLANKLINE>
        /bin/sh: 1: ./configure: not found
        While:
          Installing package.
        Error: System error
        <BLANKLINE>
parent 1dc49d3e
...@@ -398,10 +398,10 @@ def test_suite(): ...@@ -398,10 +398,10 @@ def test_suite():
'--prefix=/shared/'), '--prefix=/shared/'),
(re.compile(r'\s/\S+\/shared\/'), (re.compile(r'\s/\S+\/shared\/'),
' /shared/'), ' /shared/'),
(re.compile('[0-9a-f]{32}'), md5sum),
(re.compile( (re.compile(
r'.*CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. ' r'.*CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. '
'Support for it is now deprecated in cryptography, and will be removed in the next release.\n.*'), ''), 'Support for it is now deprecated in cryptography, and will be removed in the next release.\n.*'), ''),
(re.compile('[0-9a-f]{32}'), md5sum),
# Normalize subprocess.CalledProcessError message, on python >= 3.6 # Normalize subprocess.CalledProcessError message, on python >= 3.6
# there's an extra . at the end. # there's an extra . at the end.
(re.compile(r'Command (.*) returned non-zero exit status (\d+)[\.]{0,1}'), (re.compile(r'Command (.*) returned non-zero exit status (\d+)[\.]{0,1}'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment