mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 13:45:29 +00:00
New function to write a whole .data file
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
db2f575c9d
commit
8ffb585659
|
@ -17,7 +17,8 @@
|
|||
# limitations under the License.
|
||||
|
||||
import binascii
|
||||
from typing import Any, List, Optional
|
||||
import sys
|
||||
from typing import Any, Iterable, List, Optional
|
||||
import typing_extensions #pylint: disable=import-error
|
||||
|
||||
class Writable(typing_extensions.Protocol):
|
||||
|
@ -86,3 +87,21 @@ class TestCase:
|
|||
if self.dependencies:
|
||||
out.write('depends_on:' + ':'.join(self.dependencies) + '\n')
|
||||
out.write(self.function + ':' + ':'.join(self.arguments) + '\n')
|
||||
|
||||
|
||||
|
||||
def write_data_file(filename: str,
|
||||
test_cases: Iterable[TestCase],
|
||||
caller: Optional[str] = None) -> None:
|
||||
"""Write the test cases to the specified file.
|
||||
|
||||
If the file already exists, it is overwritten.
|
||||
"""
|
||||
if caller is None:
|
||||
caller = sys.argv[0]
|
||||
with open(filename, 'w') as out:
|
||||
out.write('# Automatically generated by {}. Do not edit!\n'
|
||||
.format(caller))
|
||||
for tc in test_cases:
|
||||
tc.write(out)
|
||||
out.write('\n# End of automatically generated file.\n')
|
||||
|
|
Loading…
Reference in a new issue