@@ -310,13 +310,22 @@ runtest-upstream: test
310
310
test-one: install_for_test
311
311
$(MAKE) test-one-no-rebuild
312
312
313
+ # If the TEST argument is passed as `ocaml/testsuite/tests/foo` (as is invited by
314
+ # tab completion) then look for it in `tests/foo`. Otherwise, if it's passed as
315
+ # just `foo`, then look for it in `tests/foo` for backward compatibility.
316
+ locate_test = \
317
+ $(shell \
318
+ test=$(shell echo "$1" | sed 's|^ocaml/testsuite/tests/||g'); \
319
+ echo "tests/$${test}"; \
320
+ )
321
+
313
322
test-one-no-rebuild:
314
323
(export OCAMLSRCDIR=$$(pwd)/_runtest; \
315
324
export CAML_LD_LIBRARY_PATH=$$(pwd)/_runtest/lib/ocaml/stublibs; \
316
325
if $$(which gfortran > /dev/null 2>&1); then \
317
326
export LIBRARY_PATH=$$(dirname $$(gfortran -print-file-name=libgfortran.a)); \
318
327
fi; \
319
- cd _runtest/testsuite && make one $(if $(TEST),TEST="tests/$( TEST)") $(if $(DIR),DIR="tests/$( DIR)" ))
328
+ cd _runtest/testsuite && make one $(if $(TEST),TEST=$(call locate_test,$( TEST))) $(if $(DIR),DIR=$(call locate_test,$( DIR)) ))
320
329
321
330
promote-one: install_for_test
322
331
$(MAKE) promote-one-no-rebuild
@@ -327,7 +336,7 @@ promote-one-no-rebuild:
327
336
if $$(which gfortran > /dev/null 2>&1); then \
328
337
export LIBRARY_PATH=$$(dirname $$(gfortran -print-file-name=libgfortran.a)); \
329
338
fi; \
330
- cd _runtest/testsuite && make promote $(if $(TEST),TEST="tests/$( TEST)") $(if $(DIR),DIR="tests/$( DIR)" ))
339
+ cd _runtest/testsuite && make promote $(if $(TEST),TEST=$(call locate_test,$( TEST))) $(if $(DIR),DIR=$(call locate_test,$( DIR)) ))
331
340
332
341
# This target is like a polling version of upstream "make ocamlopt"
333
342
.PHONY: hacking
0 commit comments