Josh Steadmon <steadmon@xxxxxxxxxx> writes: > Teach the testsuite runner in `test-tool run-command testsuite` how to > run unit tests: if TEST_SHELL_PATH is not set, assume that we're running > the programs directly from CWD, rather than defaulting to "sh" as an > interpreter. Hmph. It sounds more like "the run-command testsuite subcommand only runs programs in the current directory", not "assume" (which implies there is a way to override the assumption). Not that the limitation would hurt us in any way, though. > + /* > + * If we run without a shell, we have to provide the relative path to > + * the executables. > + */ It sounds more like "If TEST_SHELL_PATH is not given, then we run them in the current directory.". It is perfectly fine, because ... > suite.shell_path = getenv("TEST_SHELL_PATH"); > if (!suite.shell_path) > - suite.shell_path = "sh"; > + strbuf_addstr(&progpath, "./"); > + path_prefix_len = progpath.len; > > dir = opendir("."); > if (!dir) > @@ -180,13 +187,17 @@ static int testsuite(int argc, const char **argv) > ... > for (i = 0; i < argc; i++) > if (!wildmatch(argv[i], p, 0)) { > - string_list_append(&suite.tests, p); > + strbuf_setlen(&progpath, path_prefix_len); > + strbuf_addstr(&progpath, p); > + string_list_append(&suite.tests, progpath.buf); > break; > } > } ... this "prefixing" is done to a path discovered by readdir() from a directory handle obtained by opendir("."). If there were a way to pass paths to executables directly, possibly as absolute paths, the unconditional prefixing of "./" would have been a problem, but we do not have such a facility, so this should be OK.