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>
This commit is contained in:
Gilles Peskine 2023-10-25 17:43:51 +02:00
parent bf3c3fa122
commit cc2bbfe905

View file

@ -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) {