Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.4: pytest is failing (ESPTOOL-545) #800

Closed
kloczek opened this issue Nov 22, 2022 · 10 comments
Closed

4.4: pytest is failing (ESPTOOL-545) #800

kloczek opened this issue Nov 22, 2022 · 10 comments

Comments

@kloczek
Copy link

kloczek commented Nov 22, 2022

Operating System

Linux/x86_64

Esptool Version

4.4

Python Version

3.8.15

Full Esptool Command Line that Was Run

N/A

Esptool Output

N/A

What is the Expected Behaviour?

pytest should not fail.

More Information

No response

Other Steps to Reproduce

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/esptool-4.4
collected 53 items / 2 errors

================================================================================== ERRORS ==================================================================================
__________________________________________________________________ ERROR collecting test/test_espefuse.py __________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_espefuse.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_espefuse.py:33: in <module>
    from bitstring import BitString
E   ImportError: cannot import name 'BitString' from 'bitstring' (/usr/lib/python3.8/site-packages/bitstring.py)
__________________________________________________________________ ERROR collecting test/test_esptool.py ___________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_esptool.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test_esptool.py:32: in <module>
    import espefuse
../../../BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/espefuse/__init__.py:11: in <module>
    import espefuse.efuse.esp32 as esp32_efuse
../../../BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/espefuse/efuse/esp32/__init__.py:1: in <module>
    from . import operations
../../../BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/espefuse/efuse/esp32/operations.py:15: in <module>
    from . import fields
../../../BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/espefuse/efuse/esp32/fields.py:14: in <module>
    from .. import base_fields
../../../BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/espefuse/efuse/base_fields.py:11: in <module>
    from bitstring import BitArray, BitString, CreationError
E   ImportError: cannot import name 'BitString' from 'bitstring' (/usr/lib/python3.8/site-packages/bitstring.py)
========================================================================= short test summary info ==========================================================================
ERROR test/test_espefuse.py
ERROR test/test_esptool.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================ 2 errors in 0.49s =============================================================================

Here is list of installed modules in build env

Package         Version
--------------- --------------
appdirs         1.4.4
attrs           22.1.0
bitstring       4.0.1
Brlapi          0.8.3
build           0.9.0
cffi            1.15.1
contourpy       1.0.6
cryptography    38.0.1
cssselect       1.1.0
cycler          0.11.0
distro          1.8.0
dnspython       2.2.1
ecdsa           0.18.0
exceptiongroup  1.0.0
extras          1.0.0
fixtures        4.0.0
fonttools       4.38.0
gpg             1.17.1-unknown
iniconfig       1.1.1
kiwisolver      1.4.4
libcomps        0.1.19
louis           3.23.0
lxml            4.9.1
matplotlib      3.6.2
numpy           1.23.1
olefile         0.46
packaging       21.3
pbr             5.9.0
pep517          0.13.0
Pillow          9.3.0
pip             22.3.1
pluggy          1.0.0
ply             3.11
pycparser       2.21
pyelftools      0.28
PyGObject       3.42.2
pyparsing       3.0.9
pyserial        3.5
pytest          7.2.0
python-dateutil 2.8.2
reedsolo        1.5.4
rpm             4.17.0
scour           0.38.2
setuptools      65.6.0
six             1.16.0
testtools       2.5.0
tomli           2.0.1
wheel           0.38.4
@kloczek kloczek added the bug label Nov 22, 2022
@github-actions github-actions bot changed the title 4.4: pytest is failing 4.4: pytest is failing (ESPTOOL-545) Nov 22, 2022
@kloczek
Copy link
Author

kloczek commented Nov 22, 2022

After add those two files in which pytest is failing to --ignore list other 4 units are failing

self._lib.Cryptography_HAS_PROVIDERS
                and errors[0]._lib_reason_match(
                    self._lib.ERR_LIB_PROV,
                    self._lib.PROV_R_BAD_DECRYPT,
                )
            )
        ):
            raise ValueError("Bad decrypt. Incorrect password?")

        elif any(
            error._lib_reason_match(
                self._lib.ERR_LIB_EVP,
                self._lib.EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM,
            )
            for error in errors
        ):
            raise ValueError("Unsupported public key algorithm.")

        else:
            errors_with_text = binding._errors_with_text(errors)
>           raise ValueError(
                "Could not deserialize key data. The data may be in an "
                "incorrect format, it may be encrypted with an unsupported "
                "algorithm, or it may be an unsupported key type (e.g. EC "
                "curves with explicit parameters).",
                errors_with_text,
            )
E           ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [_OpenSSLErrorWithText(code=75497580, lib=9, reason=108, reason_text=b'error:0480006C:PEM routines::no start line')])

/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:1248: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
Verifying 21696 bytes of data
Signature is valid
Signature block 0 is valid (RSA).
Signature block 0 verification successful with /home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/secure_images/rsa_secure_boot_signing_pubkey.pem (RSA).
Signature block 1 invalid. Skipping.
Signature block 2 invalid. Skipping.
Signature block 0 is valid (ECDSA).
Signature block 0 verification successful with /home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/secure_images/ecdsa_secure_boot_signing_pubkey.pem (ECDSA).
_______________________________________________________________ TestSigning.test_generate_and_extract_key_v2 _______________________________________________________________

self = <test_espsecure.TestSigning object at 0x7f4c24fefe20>

    def test_generate_and_extract_key_v2(self):
        with tempfile.TemporaryDirectory() as keydir:
            # keyfile cannot exist before generation -> tempfile.NamedTemporaryFile()
            # cannot be used for keyfile
            keyfile_name = os.path.join(keydir, "key.pem")

            # We need to manually delete the keyfile as we are iterating over
            # different schemes with the same keyfile so instead of using addCleanup,
            # we remove it using os.remove at the end of each pass
            for scheme in ["rsa3072", "ecdsa192", "ecdsa256"]:
                args = self.GenerateKeyArgs("2", scheme, keyfile_name)
                espsecure.generate_signing_key(args)

                with tempfile.NamedTemporaryFile() as pub_keyfile, open(
                    keyfile_name, "rb"
                ) as keyfile:
                    args = self.ExtractKeyArgs("2", keyfile, pub_keyfile)
>                   espsecure.extract_public_key(args)

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_espsecure.py:515:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/espsecure/__init__.py:694: in extract_public_key
    sk = _load_sbv2_signing_key(args.keyfile.read())
/home/tkloczko/rpmbuild/BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/espsecure/__init__.py:214: in _load_sbv2_signing_key
    sk = serialization.load_pem_private_key(
/usr/lib64/python3.8/site-packages/cryptography/hazmat/primitives/serialization/base.py:22: in load_pem_private_key
    return ossl.load_pem_private_key(data, password)
/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:921: in load_pem_private_key
    return self._load_key(
/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:1189: in _load_key
    self._handle_key_loading_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <OpenSSLBackend(version: OpenSSL 3.0.5 5 Jul 2022, FIPS: False)>

    def _handle_key_loading_error(self) -> typing.NoReturn:
        errors = self._consume_errors()

        if not errors:
            raise ValueError(
                "Could not deserialize key data. The data may be in an "
                "incorrect format or it may be encrypted with an unsupported "
                "algorithm."
            )

        elif (
            errors[0]._lib_reason_match(
                self._lib.ERR_LIB_EVP, self._lib.EVP_R_BAD_DECRYPT
            )
            or errors[0]._lib_reason_match(
                self._lib.ERR_LIB_PKCS12,
                self._lib.PKCS12_R_PKCS12_CIPHERFINAL_ERROR,
            )
            or (
                self._lib.Cryptography_HAS_PROVIDERS
                and errors[0]._lib_reason_match(
                    self._lib.ERR_LIB_PROV,
                    self._lib.PROV_R_BAD_DECRYPT,
                )
            )
        ):
            raise ValueError("Bad decrypt. Incorrect password?")

        elif any(
            error._lib_reason_match(
                self._lib.ERR_LIB_EVP,
                self._lib.EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM,
            )
            for error in errors
        ):
            raise ValueError("Unsupported public key algorithm.")

        else:
            errors_with_text = binding._errors_with_text(errors)
>           raise ValueError(
                "Could not deserialize key data. The data may be in an "
                "incorrect format, it may be encrypted with an unsupported "
                "algorithm, or it may be an unsupported key type (e.g. EC "
                "curves with explicit parameters).",
                errors_with_text,
            )
E           ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [_OpenSSLErrorWithText(code=503841036, lib=60, reason=524556, reason_text=b'error:1E08010C:DECODER routines::unsupported'), _OpenSSLErrorWithText(code=134217857, lib=16, reason=129, reason_text=b'error:08000081:elliptic curve routines::unknown group'), _OpenSSLErrorWithText(code=134217847, lib=16, reason=119, reason_text=b'error:08000077:elliptic curve routines::ec group new by name failure'), _OpenSSLErrorWithText(code=134742032, lib=16, reason=524304, reason_text=b'error:08080010:elliptic curve routines::EC lib'), _OpenSSLErrorWithText(code=109052072, lib=13, reason=168, reason_text=b'error:068000A8:asn1 encoding routines::wrong tag'), _OpenSSLErrorWithText(code=109576458, lib=13, reason=524554, reason_text=b'error:0688010A:asn1 encoding routines::nested asn1 error'), _OpenSSLErrorWithText(code=109576458, lib=13, reason=524554, reason_text=b'error:0688010A:asn1 encoding routines::nested asn1 error')])

/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:1248: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
RSA 3072 private key in PEM format written to /tmp/tmpykofmd08/key.pem
/tmp/tmpykofmd08/key.pem public key extracted to /tmp/tmp7ir1dlvk
ECDSA NIST192p private key in PEM format written to /tmp/tmpykofmd08/key.pem
========================================================================= short test summary info ==========================================================================
FAILED test/test_espsecure.py::TestSigning::test_sign_v2_data - ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported ke...
FAILED test/test_espsecure.py::TestSigning::test_verify_signature_signing_key - ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported ke...
FAILED test/test_espsecure.py::TestSigning::test_verify_signature_public_key - ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported ke...
FAILED test/test_espsecure.py::TestSigning::test_generate_and_extract_key_v2 - ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported ke...
====================================================================== 4 failed, 49 passed in 11.26s =======================================================================

@dobairoland
Copy link
Collaborator

Why do you have bitstring 4.0.1?

See the dependency: https://github.com/espressif/esptool/blob/master/setup.py#L120

@radimkarnis
Copy link
Collaborator

radimkarnis commented Nov 22, 2022

Hello @kloczek,

the version of bitstring is currently restricted to bitstring>=3.1.6,<4. You have an incompatible bistring==4.0.1 in your dev environment.

@dobairoland
Copy link
Collaborator

This is a duplicate of #797.

@kloczek
Copy link
Author

kloczek commented Nov 22, 2022

OK thx to lat me know.
Do you have any plans to update for latest bitstring? 🤔

@kloczek
Copy link
Author

kloczek commented Nov 22, 2022

OK I'll close this ticket and subscribe to #797.

@kloczek kloczek closed this as completed Nov 22, 2022
@dobairoland
Copy link
Collaborator

Yes, you can follow #797 for that.

@kloczek
Copy link
Author

kloczek commented Nov 23, 2022

Just tested last commit and looks like many units are failing because missing images/ directorya and lack of access to /dev/ttyUSB0

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/esptool-4.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/esptool-4.4
collected 199 items

test/test_espefuse.py .......................ssssssssssss......sss.sss..ss..ss.....ssssss.ss........ss..                                                             [ 41%]
test/test_espsecure.py ......F...FF.F.........                                                                                                                       [ 52%]
test/test_esptool.py FFxFFFFFFFFFFFF...FFFFFFFsFFFF.FFFFFsFFFFFFFFFFsFFFEEEFsFFFFFFFF                                                                                [ 84%]
test/test_image_info.py .......                                                                                                                                      [ 88%]
test/test_imagegen.py ..............                                                                                                                                 [ 95%]
test/test_merge_bin.py ........                                                                                                                                      [ 99%]
test/test_modules.py .                                                                                                                                               [100%]

================================================================================== ERRORS ==================================================================================
________________________________________________ ERROR at setup of TestKeepImageSettings.test_keep_does_not_change_settings ________________________________________________

self = <class 'test_esptool.TestKeepImageSettings'>

    @classmethod
    def setup_class(self):
        super(TestKeepImageSettings, self).setup_class()
        self.BL_IMAGE = BL_IMAGES[arg_chip]
        self.flash_offset = (
            0x1000 if arg_chip in ("esp32", "esp32s2") else 0
        )  # bootloader offset
>       with open(self.BL_IMAGE, "rb") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: 'images/bootloader_esp32.bin'

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_esptool.py:695: FileNotFoundError
-------------------------------------------------------------------------- Captured stdout setup ---------------------------------------------------------------------------

**************************************************
__________________________________________________ ERROR at setup of TestKeepImageSettings.test_detect_size_changes_size ___________________________________________________

self = <class 'test_esptool.TestKeepImageSettings'>

    @classmethod
    def setup_class(self):
        super(TestKeepImageSettings, self).setup_class()
        self.BL_IMAGE = BL_IMAGES[arg_chip]
        self.flash_offset = (
            0x1000 if arg_chip in ("esp32", "esp32s2") else 0
        )  # bootloader offset
>       with open(self.BL_IMAGE, "rb") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: 'images/bootloader_esp32.bin'

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_esptool.py:695: FileNotFoundError
_________________________________________________ ERROR at setup of TestKeepImageSettings.test_explicit_set_size_freq_mode _________________________________________________

self = <class 'test_esptool.TestKeepImageSettings'>

    @classmethod
    def setup_class(self):
        super(TestKeepImageSettings, self).setup_class()
        self.BL_IMAGE = BL_IMAGES[arg_chip]
        self.flash_offset = (
            0x1000 if arg_chip in ("esp32", "esp32s2") else 0
        )  # bootloader offset
>       with open(self.BL_IMAGE, "rb") as f:
E       FileNotFoundError: [Errno 2] No such file or directory: 'images/bootloader_esp32.bin'

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_esptool.py:695: FileNotFoundError
================================================================================= FAILURES =================================================================================
______________________________________________________________________ TestSigning.test_sign_v2_data _______________________________________________________________________

self = <test_espsecure.TestSigning object at 0x7fbc2f96dca0>

    def test_sign_v2_data(self):
        signing_keys = [
            "rsa_secure_boot_signing_key.pem",
            "ecdsa192_secure_boot_signing_key.pem",
            "ecdsa_secure_boot_signing_key.pem",
        ]
        for key in signing_keys:
            with tempfile.NamedTemporaryFile() as output_file:
                args = self.SignArgs(
                    "2",
                    [self._open(key)],
                    output_file.name,
                    False,
                    self._open("bootloader_unsigned_v2.bin"),
                )
>               espsecure.sign_data(args)

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_espsecure.py:183:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:309: in sign_data
    return sign_secure_boot_v2(args)
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:418: in sign_secure_boot_v2
    private_key = _load_sbv2_signing_key(keyfile.read())
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:214: in _load_sbv2_signing_key
    sk = serialization.load_pem_private_key(
/usr/lib64/python3.8/site-packages/cryptography/hazmat/primitives/serialization/base.py:22: in load_pem_private_key
    return ossl.load_pem_private_key(data, password)
/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:921: in load_pem_private_key
    return self._load_key(
/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:1189: in _load_key
    self._handle_key_loading_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <OpenSSLBackend(version: OpenSSL 3.0.5 5 Jul 2022, FIPS: False)>

    def _handle_key_loading_error(self) -> typing.NoReturn:
        errors = self._consume_errors()

        if not errors:
            raise ValueError(
                "Could not deserialize key data. The data may be in an "
                "incorrect format or it may be encrypted with an unsupported "
                "algorithm."
            )

        elif (
            errors[0]._lib_reason_match(
                self._lib.ERR_LIB_EVP, self._lib.EVP_R_BAD_DECRYPT
            )
            or errors[0]._lib_reason_match(
                self._lib.ERR_LIB_PKCS12,
                self._lib.PKCS12_R_PKCS12_CIPHERFINAL_ERROR,
            )
            or (
                self._lib.Cryptography_HAS_PROVIDERS
                and errors[0]._lib_reason_match(
                    self._lib.ERR_LIB_PROV,
                    self._lib.PROV_R_BAD_DECRYPT,
                )
            )
        ):
            raise ValueError("Bad decrypt. Incorrect password?")

        elif any(
            error._lib_reason_match(
                self._lib.ERR_LIB_EVP,
                self._lib.EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM,
            )
            for error in errors
        ):
            raise ValueError("Unsupported public key algorithm.")

        else:
            errors_with_text = binding._errors_with_text(errors)
>           raise ValueError(
                "Could not deserialize key data. The data may be in an "
                "incorrect format, it may be encrypted with an unsupported "
                "algorithm, or it may be an unsupported key type (e.g. EC "
                "curves with explicit parameters).",
                errors_with_text,
            )
E           ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [_OpenSSLErrorWithText(code=503841036, lib=60, reason=524556, reason_text=b'error:1E08010C:DECODER routines::unsupported'), _OpenSSLErrorWithText(code=134217857, lib=16, reason=129, reason_text=b'error:08000081:elliptic curve routines::unknown group'), _OpenSSLErrorWithText(code=134217847, lib=16, reason=119, reason_text=b'error:08000077:elliptic curve routines::ec group new by name failure'), _OpenSSLErrorWithText(code=134742032, lib=16, reason=524304, reason_text=b'error:08080010:elliptic curve routines::EC lib'), _OpenSSLErrorWithText(code=109052072, lib=13, reason=168, reason_text=b'error:068000A8:asn1 encoding routines::wrong tag'), _OpenSSLErrorWithText(code=109576458, lib=13, reason=524554, reason_text=b'error:0688010A:asn1 encoding routines::nested asn1 error'), _OpenSSLErrorWithText(code=109576458, lib=13, reason=524554, reason_text=b'error:0688010A:asn1 encoding routines::nested asn1 error')])

/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:1248: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
Padding data contents by 2288 bytes so signature sector aligns at sector boundary
1 signing key(s) found.
Signed 32768 bytes of data from /home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/secure_images/bootloader_unsigned_v2.bin. Signature sector now has 1 signature blocks.
Signature block 0 is valid (RSA).
Signature block 0 verification successful with /home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/secure_images/rsa_secure_boot_signing_key.pem (RSA).
Signature block 1 invalid. Skipping.
Signature block 2 invalid. Skipping.
Padding data contents by 2288 bytes so signature sector aligns at sector boundary
1 signing key(s) found.
______________________________________________________________ TestSigning.test_verify_signature_signing_key _______________________________________________________________

self = <test_espsecure.TestSigning object at 0x7fbc2f971cd0>

    def test_verify_signature_signing_key(self):
        # correct key v1
        args = self.VerifyArgs(
            "1",
            self._open("ecdsa_secure_boot_signing_key.pem"),
            self._open("bootloader_signed.bin"),
        )
        espsecure.verify_signature(args)

        # correct key v2
        args = self.VerifyArgs(
            "2",
            self._open("rsa_secure_boot_signing_key.pem"),
            self._open("bootloader_signed_v2.bin"),
        )
        espsecure.verify_signature(args)

        # correct key v2 (ecdsa256)
        args = self.VerifyArgs(
            "2",
            self._open("ecdsa_secure_boot_signing_key.pem"),
            self._open("bootloader_signed_v2_ecdsa256.bin"),
        )
        espsecure.verify_signature(args)

        # correct key v2 (ecdsa192)
        args = self.VerifyArgs(
            "2",
            self._open("ecdsa192_secure_boot_signing_key.pem"),
            self._open("bootloader_signed_v2_ecdsa192.bin"),
        )
>       espsecure.verify_signature(args)

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_espsecure.py:323:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:516: in verify_signature
    return verify_signature_v2(args)
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:596: in verify_signature_v2
    vk = _get_sbv2_pub_key(args.keyfile)
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:265: in _get_sbv2_pub_key
    return _load_sbv2_signing_key(key_data).public_key()
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:214: in _load_sbv2_signing_key
    sk = serialization.load_pem_private_key(
/usr/lib64/python3.8/site-packages/cryptography/hazmat/primitives/serialization/base.py:22: in load_pem_private_key
    return ossl.load_pem_private_key(data, password)
/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:921: in load_pem_private_key
    return self._load_key(
/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:1189: in _load_key
    self._handle_key_loading_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <OpenSSLBackend(version: OpenSSL 3.0.5 5 Jul 2022, FIPS: False)>

    def _handle_key_loading_error(self) -> typing.NoReturn:
        errors = self._consume_errors()

        if not errors:
            raise ValueError(
                "Could not deserialize key data. The data may be in an "
                "incorrect format or it may be encrypted with an unsupported "
                "algorithm."
            )

        elif (
            errors[0]._lib_reason_match(
                self._lib.ERR_LIB_EVP, self._lib.EVP_R_BAD_DECRYPT
            )
            or errors[0]._lib_reason_match(
                self._lib.ERR_LIB_PKCS12,
                self._lib.PKCS12_R_PKCS12_CIPHERFINAL_ERROR,
            )
            or (
                self._lib.Cryptography_HAS_PROVIDERS
                and errors[0]._lib_reason_match(
                    self._lib.ERR_LIB_PROV,
                    self._lib.PROV_R_BAD_DECRYPT,
                )
            )
        ):
            raise ValueError("Bad decrypt. Incorrect password?")

        elif any(
            error._lib_reason_match(
                self._lib.ERR_LIB_EVP,
                self._lib.EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM,
            )
            for error in errors
        ):
            raise ValueError("Unsupported public key algorithm.")

        else:
            errors_with_text = binding._errors_with_text(errors)
>           raise ValueError(
                "Could not deserialize key data. The data may be in an "
                "incorrect format, it may be encrypted with an unsupported "
                "algorithm, or it may be an unsupported key type (e.g. EC "
                "curves with explicit parameters).",
                errors_with_text,
            )
E           ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [_OpenSSLErrorWithText(code=503841036, lib=60, reason=524556, reason_text=b'error:1E08010C:DECODER routines::unsupported'), _OpenSSLErrorWithText(code=134217857, lib=16, reason=129, reason_text=b'error:08000081:elliptic curve routines::unknown group'), _OpenSSLErrorWithText(code=134217847, lib=16, reason=119, reason_text=b'error:08000077:elliptic curve routines::ec group new by name failure'), _OpenSSLErrorWithText(code=134742032, lib=16, reason=524304, reason_text=b'error:08080010:elliptic curve routines::EC lib'), _OpenSSLErrorWithText(code=109052072, lib=13, reason=168, reason_text=b'error:068000A8:asn1 encoding routines::wrong tag'), _OpenSSLErrorWithText(code=109576458, lib=13, reason=524554, reason_text=b'error:0688010A:asn1 encoding routines::nested asn1 error'), _OpenSSLErrorWithText(code=109576458, lib=13, reason=524554, reason_text=b'error:0688010A:asn1 encoding routines::nested asn1 error')])

/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:1248: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
Verifying 21696 bytes of data
Signature is valid
Signature block 0 is valid (RSA).
Signature block 0 verification successful with /home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/secure_images/rsa_secure_boot_signing_key.pem (RSA).
Signature block 1 invalid. Skipping.
Signature block 2 invalid. Skipping.
Signature block 0 is valid (ECDSA).
Signature block 0 verification successful with /home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/secure_images/ecdsa_secure_boot_signing_key.pem (ECDSA).
_______________________________________________________________ TestSigning.test_verify_signature_public_key _______________________________________________________________

self = <test_espsecure.TestSigning object at 0x7fbc2f96dc40>

    def test_verify_signature_public_key(self):
        # correct key v1
        args = self.VerifyArgs(
            "1",
            self._open("ecdsa_secure_boot_signing_pubkey.pem"),
            self._open("bootloader_signed.bin"),
        )
        espsecure.verify_signature(args)

        # correct key v2
        args = self.VerifyArgs(
            "2",
            self._open("rsa_secure_boot_signing_pubkey.pem"),
            self._open("bootloader_signed_v2.bin"),
        )
        espsecure.verify_signature(args)

        # correct key v2 (ecdsa256)
        args = self.VerifyArgs(
            "2",
            self._open("ecdsa_secure_boot_signing_pubkey.pem"),
            self._open("bootloader_signed_v2_ecdsa256.bin"),
        )
        espsecure.verify_signature(args)

        # correct key v2 (ecdsa192)
        args = self.VerifyArgs(
            "2",
            self._open("ecdsa192_secure_boot_signing_pubkey.pem"),
            self._open("bootloader_signed_v2_ecdsa192.bin"),
        )
>       espsecure.verify_signature(args)

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_espsecure.py:416:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:516: in verify_signature
    return verify_signature_v2(args)
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:596: in verify_signature_v2
    vk = _get_sbv2_pub_key(args.keyfile)
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:267: in _get_sbv2_pub_key
    vk = _load_sbv2_pub_key(key_data)
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/espsecure/__init__.py:241: in _load_sbv2_pub_key
    vk = serialization.load_pem_public_key(keydata, backend=default_backend())
/usr/lib64/python3.8/site-packages/cryptography/hazmat/primitives/serialization/base.py:30: in load_pem_public_key
    return ossl.load_pem_public_key(data)
/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:968: in load_pem_public_key
    self._handle_key_loading_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <OpenSSLBackend(version: OpenSSL 3.0.5 5 Jul 2022, FIPS: False)>

    def _handle_key_loading_error(self) -> typing.NoReturn:
        errors = self._consume_errors()

        if not errors:
            raise ValueError(
                "Could not deserialize key data. The data may be in an "
                "incorrect format or it may be encrypted with an unsupported "
                "algorithm."
            )

        elif (
            errors[0]._lib_reason_match(
                self._lib.ERR_LIB_EVP, self._lib.EVP_R_BAD_DECRYPT
            )
            or errors[0]._lib_reason_match(
                self._lib.ERR_LIB_PKCS12,
                self._lib.PKCS12_R_PKCS12_CIPHERFINAL_ERROR,
            )
            or (
                self._lib.Cryptography_HAS_PROVIDERS
                and errors[0]._lib_reason_match(
                    self._lib.ERR_LIB_PROV,
                    self._lib.PROV_R_BAD_DECRYPT,
                )
            )
        ):
            raise ValueError("Bad decrypt. Incorrect password?")

        elif any(
            error._lib_reason_match(
                self._lib.ERR_LIB_EVP,
                self._lib.EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM,
            )
            for error in errors
        ):
            raise ValueError("Unsupported public key algorithm.")

        else:
            errors_with_text = binding._errors_with_text(errors)
>           raise ValueError(
                "Could not deserialize key data. The data may be in an "
                "incorrect format, it may be encrypted with an unsupported "
                "algorithm, or it may be an unsupported key type (e.g. EC "
                "curves with explicit parameters).",
                errors_with_text,
            )
E           ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [_OpenSSLErrorWithText(code=75497580, lib=9, reason=108, reason_text=b'error:0480006C:PEM routines::no start line')])

/usr/lib64/python3.8/site-packages/cryptography/hazmat/backends/openssl/backend.py:1248: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
Verifying 21696 bytes of data
Signature is valid
Signature block 0 is valid (RSA).
Signature block 0 verification successful with /home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/secure_images/rsa_secure_boot_signing_pubkey.pem (RSA).
Signature block 1 invalid. Skipping.
Signature block 2 invalid. Skipping.
Signature block 0 is valid (ECDSA).
Signature block 0 verification successful with /home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/secure_images/ecdsa_secure_boot_signing_pubkey.pem (ECDSA).

[..]

_____________________________________________________________ TestReadWriteMemory.test_read_write_memory_stub ______________________________________________________________

self = Serial<id=0x7fbc2ee93340, open=False>(port='/dev/ttyUSB0', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)

    def open(self):
        """\
        Open port with current settings. This may throw a SerialException
        if the port cannot be opened."""
        if self._port is None:
            raise SerialException("Port must be configured before it can be used.")
        if self.is_open:
            raise SerialException("Port is already open.")
        self.fd = None
        # open
        try:
>           self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
E           FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyUSB0'

/usr/lib/python3.8/site-packages/serial/serialposix.py:322: FileNotFoundError

During handling of the above exception, another exception occurred:

self = <esptool.targets.esp32.ESP32ROM object at 0x7fbc2ee932b0>, port = '/dev/ttyUSB0', baud = 115200, trace_enabled = False

    def __init__(self, port=DEFAULT_PORT, baud=ESP_ROM_BAUD, trace_enabled=False):
        """Base constructor for ESPLoader bootloader interaction

        Don't call this constructor, either instantiate a specific
        ROM class directly, or use cmds.detect_chip().

        This base class has all of the instance methods for bootloader
        functionality supported across various chips & stub
        loaders. Subclasses replace the functions they don't support
        with ones which throw NotImplementedInROMError().

        """
        # True if esptool detects the ROM is in Secure Download Mode
        self.secure_download_mode = False
        # True if esptool detects conditions which require the stub to be disabled
        self.stub_is_disabled = False

        if isinstance(port, str):
            try:
>               self._port = serial.serial_for_url(port)

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/esptool/loader.py:273:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

url = '/dev/ttyUSB0', args = (), kwargs = {}, do_open = True, klass = <class 'serial.serialposix.Serial'>, url_lowercase = '/dev/ttyusb0'
instance = Serial<id=0x7fbc2ee93340, open=False>(port='/dev/ttyUSB0', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)

    def serial_for_url(url, *args, **kwargs):
        """\
        Get an instance of the Serial class, depending on port/url. The port is not
        opened when the keyword parameter 'do_not_open' is true, by default it
        is. All other parameters are directly passed to the __init__ method when
        the port is instantiated.

        The list of package names that is searched for protocol handlers is kept in
        ``protocol_handler_packages``.

        e.g. we want to support a URL ``foobar://``. A module
        ``my_handlers.protocol_foobar`` is provided by the user. Then
        ``protocol_handler_packages.append("my_handlers")`` would extend the search
        path so that ``serial_for_url("foobar://"))`` would work.
        """
        # check and remove extra parameter to not confuse the Serial class
        do_open = not kwargs.pop('do_not_open', False)
        # the default is to use the native implementation
        klass = Serial
        try:
            url_lowercase = url.lower()
        except AttributeError:
            # it's not a string, use default
            pass
        else:
            # if it is an URL, try to import the handler module from the list of possible packages
            if '://' in url_lowercase:
                protocol = url_lowercase.split('://', 1)[0]
                module_name = '.protocol_{}'.format(protocol)
                for package_name in protocol_handler_packages:
                    try:
                        importlib.import_module(package_name)
                        handler_module = importlib.import_module(module_name, package_name)
                    except ImportError:
                        continue
                    else:
                        if hasattr(handler_module, 'serial_class_for_url'):
                            url, klass = handler_module.serial_class_for_url(url)
                        else:
                            klass = handler_module.Serial
                        break
                else:
                    raise ValueError('invalid URL, protocol {!r} not known'.format(protocol))
        # instantiate and open when desired
        instance = klass(None, *args, **kwargs)
        instance.port = url
        if do_open:
>           instance.open()

/usr/lib/python3.8/site-packages/serial/__init__.py:90:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = Serial<id=0x7fbc2ee93340, open=False>(port='/dev/ttyUSB0', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)

    def open(self):
        """\
        Open port with current settings. This may throw a SerialException
        if the port cannot be opened."""
        if self._port is None:
            raise SerialException("Port must be configured before it can be used.")
        if self.is_open:
            raise SerialException("Port is already open.")
        self.fd = None
        # open
        try:
            self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
        except OSError as msg:
            self.fd = None
>           raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
E           serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'

/usr/lib/python3.8/site-packages/serial/serialposix.py:325: SerialException

During handling of the above exception, another exception occurred:

self = <test_esptool.TestReadWriteMemory object at 0x7fbc2f52b310>

    def test_read_write_memory_stub(self):
>       esp = esptool.get_default_connected_device(
            [arg_port], arg_port, 10, 115200, arg_chip
        )

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_esptool.py:907:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/esptool-4.4/esptool/__init__.py:912: in get_default_connected_device
    _esp = chip_class(each_port, initial_baud, trace)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <esptool.targets.esp32.ESP32ROM object at 0x7fbc2ee932b0>, port = '/dev/ttyUSB0', baud = 115200, trace_enabled = False

    def __init__(self, port=DEFAULT_PORT, baud=ESP_ROM_BAUD, trace_enabled=False):
        """Base constructor for ESPLoader bootloader interaction

        Don't call this constructor, either instantiate a specific
        ROM class directly, or use cmds.detect_chip().

        This base class has all of the instance methods for bootloader
        functionality supported across various chips & stub
        loaders. Subclasses replace the functions they don't support
        with ones which throw NotImplementedInROMError().

        """
        # True if esptool detects the ROM is in Secure Download Mode
        self.secure_download_mode = False
        # True if esptool detects conditions which require the stub to be disabled
        self.stub_is_disabled = False

        if isinstance(port, str):
            try:
                self._port = serial.serial_for_url(port)
            except serial.serialutil.SerialException:
>               raise FatalError(f"Could not open {port}, the port doesn't exist")
E               esptool.util.FatalError: Could not open /dev/ttyUSB0, the port doesn't exist

/home/tkloczko/rpmbuild/BUILD/esptool-4.4/esptool/loader.py:275: FatalError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
Serial port /dev/ttyUSB0
============================================================================= warnings summary =============================================================================
test/test_esptool.py:847
  /home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/test_esptool.py:847: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.flaky(reruns=5)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] test/test_espefuse.py:506: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:509: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:518: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:527: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:532: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:541: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:549: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:552: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:561: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:569: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:578: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:587: Not necessary fo all chips
SKIPPED [1] test/test_espefuse.py:797: ESP32-C2-only
SKIPPED [1] test/test_espefuse.py:817: ESP32-C2-only
SKIPPED [1] test/test_espefuse.py:845: Only chips with 6 keys
SKIPPED [1] test/test_espefuse.py:929: 512 bit keys are only supported on ESP32-S2 and S3
SKIPPED [1] test/test_espefuse.py:947: 512 bit keys are only supported on ESP32-S2 and S3
SKIPPED [1] test/test_espefuse.py:988: 512 bit keys are only supported on ESP32-S2 and S3
SKIPPED [1] test/test_espefuse.py:1058: ESP32-C2-only
SKIPPED [1] test/test_espefuse.py:1075: Only chip with 6 keys
SKIPPED [1] test/test_espefuse.py:1185: ESP32-C2-only
SKIPPED [1] test/test_espefuse.py:1208: Only chips with 6 keys
SKIPPED [1] test/test_espefuse.py:1344: ESP32-C2-only, supports 1 key block
SKIPPED [1] test/test_espefuse.py:1356: ESP32-C2-only, supports 1 key block
SKIPPED [1] test/test_espefuse.py:1368: ESP32-C2-only, supports 1 key block
SKIPPED [1] test/test_espefuse.py:1380: ESP32-C2-only, supports 1 key block
SKIPPED [1] test/test_espefuse.py:1407: Supports 6 key blocks
SKIPPED [1] test/test_espefuse.py:1439: Supports 6 key blocks
SKIPPED [1] test/test_espefuse.py:1485: ESP32-C2-only
SKIPPED [1] test/test_espefuse.py:1504: Only chip with 6 keys
SKIPPED [1] test/test_espefuse.py:1724: For this chip, FE and SB keys go into one BLOCK
SKIPPED [1] test/test_espefuse.py:1740: For this chip, FE and SB keys go into one BLOCK
SKIPPED [1] test/test_esptool.py:487: This check happens only on a valid image
SKIPPED [1] test/test_esptool.py:573: ESP8266 only
SKIPPED [1] test/test_esptool.py:658: ESP8266 only
SKIPPED [1] test/test_esptool.py:778: ESP8266 only
XFAIL test/test_esptool.py::TestFlashEncryption::test_blank_efuse_encrypt_write_continue2
ERROR test/test_esptool.py::TestKeepImageSettings::test_keep_does_not_change_settings - FileNotFoundError: [Errno 2] No such file or directory: 'images/bootloader_esp32.bin'
ERROR test/test_esptool.py::TestKeepImageSettings::test_detect_size_changes_size - FileNotFoundError: [Errno 2] No such file or directory: 'images/bootloader_esp32.bin'
ERROR test/test_esptool.py::TestKeepImageSettings::test_explicit_set_size_freq_mode - FileNotFoundError: [Errno 2] No such file or directory: 'images/bootloader_esp32.bin'
FAILED test/test_espsecure.py::TestSigning::test_sign_v2_data - ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported ke...
FAILED test/test_espsecure.py::TestSigning::test_verify_signature_signing_key - ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported ke...
FAILED test/test_espsecure.py::TestSigning::test_verify_signature_public_key - ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported ke...
FAILED test/test_espsecure.py::TestSigning::test_generate_and_extract_key_v2 - ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported ke...
FAILED test/test_esptool.py::TestFlashEncryption::test_blank_efuse_encrypt_write_abort - esptool.util.FatalError: Could not open /dev/ttyUSB0, the port doesn't exist
FAILED test/test_esptool.py::TestFlashEncryption::test_blank_efuse_encrypt_write_continue1 - esptool.util.FatalError: Could not open /dev/ttyUSB0, the port doesn't exist
FAILED test/test_esptool.py::TestFlashing::test_short_flash - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_highspeed_flash - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_adjacent_flash - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_adjacent_independent_flash - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_correct_offset - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_no_compression_flash - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_compressed_nostub_flash - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_partition_table_then_bootloader - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_partition_table_then_bootloader_no_compression - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_partition_table_then_bootloader_nostub - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_length_not_aligned_4bytes - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_length_not_aligned_4bytes_no_compression - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_write_no_overlap - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_compressible_file - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_compressible_non_trivial_file - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_zero_length - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_single_byte - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_erase_range_messages - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashing::test_write_image_for_another_target - assert 'Unexpected chip id in image.' in "esptool.py v4.4\nSerial port /dev/ttyUSB0\n\nA fatal error occurred: Could not open /dev/ttyUSB0, the port doesn't exist\n"
FAILED test/test_esptool.py::TestFlashSizes::test_high_offset - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashSizes::test_high_offset_no_compression - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashSizes::test_large_image - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashSizes::test_large_no_compression - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestFlashSizes::test_write_past_end_fails - assert 'File images/one_kb.bin' in "esptool.py v4.4\nSerial port /dev/ttyUSB0\n\nA fatal error occurred: Could not open /dev/ttyUSB0, the port doesn't exist\n"
FAILED test/test_esptool.py::TestFlashSizes::test_write_no_compression_past_end_fails - assert 'File images/one_kb.bin' in "esptool.py v4.4\nSerial port /dev/ttyUSB0\n\nA fatal error occurred: Could not open /dev/ttyUSB0, the port doesn't exist\n"
FAILED test/test_esptool.py::TestFlashSizes::test_flash_size_keep - FileNotFoundError: [Errno 2] No such file or directory: 'images/bootloader_esp32.bin'
FAILED test/test_esptool.py::TestFlashDetection::test_flash_id - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestStubReuse::test_stub_reuse_with_synchronization - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestErase::test_chip_erase - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestErase::test_region_erase - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestErase::test_large_region_erase - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestSectorBoundaries::test_end_sector - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestSectorBoundaries::test_end_sector_uncompressed - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestSectorBoundaries::test_overlap - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestVerifyCommand::test_verify_success - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestVerifyCommand::test_verify_failure - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestVerifyCommand::test_verify_unaligned_length - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestReadIdentityValues::test_read_mac - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestMemoryOperations::test_memory_dump - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestMemoryOperations::test_memory_write - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestMemoryOperations::test_memory_read - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestLoadRAM::test_load_ram - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestBootloaderHeaderRewriteCases::test_flash_header_rewrite - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestBootloaderHeaderRewriteCases::test_flash_header_no_magic_no_rewrite - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'esp32', '--port', '/de...
FAILED test/test_esptool.py::TestAutoDetect::test_auto_detect - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'auto', '--port', '/dev...
FAILED test/test_esptool.py::TestVirtualPort::test_auto_detect - subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/tkloczko/rpmbuild/BUILD/esptool-4.4/test/../esptool/__init__.py', '--chip', 'auto', '--port', '/dev...
FAILED test/test_esptool.py::TestVirtualPort::test_auto_detect_virtual_port - Exception: Server not started successfully!
FAILED test/test_esptool.py::TestVirtualPort::test_highspeed_flash_virtual_port - Exception: Server not started successfully!
FAILED test/test_esptool.py::TestReadWriteMemory::test_read_write_memory_rom - esptool.util.FatalError: Could not open /dev/ttyUSB0, the port doesn't exist
FAILED test/test_esptool.py::TestReadWriteMemory::test_read_write_memory_stub - esptool.util.FatalError: Could not open /dev/ttyUSB0, the port doesn't exist
========================================== 56 failed, 103 passed, 36 skipped, 1 xfailed, 1 warning, 3 errors in 89.38s (0:01:29) ===========================================

Do I need connected esp device over serial bus to pass test suite?

@radimkarnis
Copy link
Collaborator

test_esptool.py is meant to be run with real hardware connected. It is explained here. For your purpose, it should be added to the --ignore list.

@kloczek
Copy link
Author

kloczek commented Nov 23, 2022

Thx added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants