From cc2bbfe905253ac7920b65d130198954aff38b9d Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 25 Oct 2023 17:43:51 +0200 Subject: [PATCH] Fix invocation with explicit .datax file Don't chdir when invoking a test suite executable with an explicit .datax file. The point of the chdir is to automatically find the .datax file (and the relative location of the data_files directory) in typical cases. This conflicts with the expectation that passing a relative path to a .datax file will work. (This is what I had originally intended, and what is documented in the comment, but I forgot to add the argc check in the initial commit.) Signed-off-by: Gilles Peskine --- tests/suites/main_test.function | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function index 6ab4a5618c..ef1898ba38 100644 --- a/tests/suites/main_test.function +++ b/tests/suites/main_test.function @@ -248,7 +248,9 @@ int main(int argc, const char *argv[]) * test-specific files such as the outcome file, which is arguably * not desirable and should be fixed later. */ - try_chdir_if_supported(argv[0]); + if (argc == 1) { + try_chdir_if_supported(argv[0]); + } int ret = mbedtls_test_platform_setup(); if (ret != 0) {