generate_*_tests.py: chdir to mbedtls root
Do this in 2.28 just like it's done in the development branch, so that
code and command line usage that works on one branch doesn't surprisingly
fail on 2.28.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/scripts/mbedtls_dev/test_data_generation.py b/scripts/mbedtls_dev/test_data_generation.py
index 993cd4b..3760468 100644
--- a/scripts/mbedtls_dev/test_data_generation.py
+++ b/scripts/mbedtls_dev/test_data_generation.py
@@ -29,6 +29,7 @@
from abc import ABCMeta, abstractmethod
from typing import Callable, Dict, Iterable, Iterator, List, Type, TypeVar
+from mbedtls_dev import build_tree
from mbedtls_dev import test_case
T = TypeVar('T') #pylint: disable=invalid-name
@@ -182,6 +183,12 @@
help='List available targets and exit')
parser.add_argument('targets', nargs='*', metavar='TARGET',
help='Target file to generate (default: all; "-": none)')
+
+ # Change to the mbedtls root, to keep things simple.
+ # Note that if any command line options refer to paths, they need to
+ # be adjusted first.
+ build_tree.chdir_to_root()
+
options = parser.parse_args(args)
generator = generator_class(options)
if options.list: