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 <Gilles.Peskine@arm.com>
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 6ab4a56..ef1898b 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -248,7 +248,9 @@
* 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) {