From 505cc641de6cb39cde1cb76a3db60cf66fd83798 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 27 Jan 2021 18:30:40 +0100 Subject: [PATCH] Use the base name of the generating script, not the full path Otherwise the generation is sensitive to trivial differences such as running `tests/scripts/generate_psa_tests.py` vs `./tests/scripts/generate_psa_tests.py` vs an absolute path. Signed-off-by: Gilles Peskine --- scripts/mbedtls_dev/test_case.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/mbedtls_dev/test_case.py b/scripts/mbedtls_dev/test_case.py index a6ed8fc90..c476d1ee9 100644 --- a/scripts/mbedtls_dev/test_case.py +++ b/scripts/mbedtls_dev/test_case.py @@ -17,6 +17,7 @@ # limitations under the License. import binascii +import os import sys from typing import Any, Iterable, List, Optional import typing_extensions #pylint: disable=import-error @@ -98,7 +99,7 @@ def write_data_file(filename: str, If the file already exists, it is overwritten. """ if caller is None: - caller = sys.argv[0] + caller = os.path.basename(sys.argv[0]) with open(filename, 'w') as out: out.write('# Automatically generated by {}. Do not edit!\n' .format(caller))