mbedtls
mbedtls copied to clipboard
test_certs.h should be a generated file
tests/src/test_certs.h
is generated by tests/scripts/generate_test_cert_macros.py
. Despite the name, tests/src/test_certs.h
is not really a header file, it's just included from one .c
file. So it should be handled normally like other generated files.
This applies to 3.6 and development.
On second thoughts, I'm not sure about this. I had missed that test_certs.h
only depends on the content of the tests/data_files
directory. Files in this directory almost never change, so it is not a problem to commit files that are generated from them. It is, however, relatively common to add files to this directory, and that requires updating test_certs.h
. Furthermore adding two files in parallel may lead to an add-add conflict when merging. So I'm still leaning towards thinking that test_certs.h
should be generated as part of make generated_files
(and cmake etc. equivalents).
Other reasons why we commit files in tests/data_files
are that many files require special tooling (e.g. I think at the moment there isn't a single version of openssl that works for all the targets in tests/data_files/Makefile
), and the output is randomized. This doesn't apply to the process that generates test_certs.h
.
Maybe related to the generation issue, but the windows build complains that "test_certs.h" is not found, even after a successful run of make generated_files.bat
. (Which depends on setting a CC environment variable, which is not set by default and is not documented.) I think it is an issue of search path for include files in the VS2017 project. It works fine if I add "tests/src" to the search path.
"test_certs.h" is not found, even after a successful run of make generated_files.bat.
This is fixed by https://github.com/Mbed-TLS/mbedtls/pull/9017 .
I think it is an issue of search path for include files in the VS2017 project.
Is it? test_certs.h
is only included with #include "test_certs.h"
from a file in the same directory, so the search path shouldn't matter.
Resolved by https://github.com/Mbed-TLS/mbedtls/pull/9017
Which depends on setting a CC environment variable, which is not set by default and is not documented.
Fair point. https://github.com/Mbed-TLS/mbedtls/pull/9128