From 5939a2a4de08e4c1be482532d329411af823294e Mon Sep 17 00:00:00 2001 From: Yuto Takano Date: Fri, 6 Aug 2021 16:40:30 +0100 Subject: [PATCH] Check environment by verifying other dirs' existence Signed-off-by: Yuto Takano --- tests/scripts/check-names.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/scripts/check-names.py b/tests/scripts/check-names.py index e3863cfc8d..b9e028bdd3 100755 --- a/tests/scripts/check-names.py +++ b/tests/scripts/check-names.py @@ -162,11 +162,10 @@ class NameCheck(object): Check that the current working directory is the project root, and throw an exception if not. """ - current_dir = os.path.realpath('.') - root_dir = os.path.dirname(os.path.dirname( - os.path.dirname(os.path.realpath(__file__)))) - if current_dir != root_dir: - raise Exception("Must be run from Mbed TLS root") + if (not os.path.isdir("include") or + not os.path.isdir("tests") or + not os.path.isdir("library")): + raise Exception("This script must be run from Mbed TLS root") def get_files(self, extension, directory): """