Skip to content

Commit bfec906

Browse files
authored
flambda-backend: Add autocompletion for test-one/promote-one (#1393)
* Add autocompletion for test-one/promote-one * Add RAE's suggestion for Makefile in subdir
1 parent 9fc4aac commit bfec906

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Makefile.common-jst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,22 @@ runtest-upstream: test
310310
test-one: install_for_test
311311
$(MAKE) test-one-no-rebuild
312312

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+
313322
test-one-no-rebuild:
314323
(export OCAMLSRCDIR=$$(pwd)/_runtest; \
315324
export CAML_LD_LIBRARY_PATH=$$(pwd)/_runtest/lib/ocaml/stublibs; \
316325
if $$(which gfortran > /dev/null 2>&1); then \
317326
export LIBRARY_PATH=$$(dirname $$(gfortran -print-file-name=libgfortran.a)); \
318327
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))))
320329

321330
promote-one: install_for_test
322331
$(MAKE) promote-one-no-rebuild
@@ -327,7 +336,7 @@ promote-one-no-rebuild:
327336
if $$(which gfortran > /dev/null 2>&1); then \
328337
export LIBRARY_PATH=$$(dirname $$(gfortran -print-file-name=libgfortran.a)); \
329338
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))))
331340

332341
# This target is like a polling version of upstream "make ocamlopt"
333342
.PHONY: hacking

testsuite/tests/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.PHONY: test-one test-one-no-rebuild promote-one promote-one-no-rebuild
2+
3+
test-one test-one-no-rebuild promote-one promote-one-no-rebuild:
4+
$(MAKE) -C ../../.. $@

0 commit comments

Comments
 (0)