From 178f26ec173835294d7280cca2068914bd76c8c0 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Mon, 5 Apr 2021 03:27:56 -0700 Subject: [PATCH] [ re #1162 ] Test without install (#1240) Co-authored-by: Guillaume ALLAIS --- .gitignore | 1 + Makefile | 29 +++++++++++++++++++---------- tests/Makefile | 2 +- tests/tests.ipkg | 1 - 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index b1f356050..983f4c465 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ result *.d *.a *.dll +*.dylib # Editor/IDE Related .\#* # Emacs swap file diff --git a/Makefile b/Makefile index 8c2a89085..6b02b5efa 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,10 @@ else SEP := : endif +# Library and data paths for test +IDRIS2_TEST_LIBS ?= ${IDRIS2_CURDIR}/lib +IDRIS2_TEST_DATA ?= ${IDRIS2_CURDIR}/support + # Library and data paths for bootstrap-test IDRIS2_BOOT_TEST_LIBS := ${IDRIS2_CURDIR}/bootstrap/${NAME}-${IDRIS2_VERSION}/lib IDRIS2_BOOT_TEST_DATA := ${IDRIS2_CURDIR}/bootstrap/${NAME}-${IDRIS2_VERSION}/support @@ -47,15 +51,19 @@ export IDRIS2_BOOT_PATH := "${IDRIS2_CURDIR}/libs/prelude/build/ttc${SEP}${IDRIS export SCHEME -.PHONY: all idris2-exec ${TARGET} testbin support support-clean clean distclean FORCE +.PHONY: all idris2-exec ${TARGET} testbin support support-lib support-clean clean distclean FORCE -all: support ${TARGET} libs +all: support ${TARGET} support-lib libs idris2-exec: ${TARGET} ${TARGET}: src/IdrisPaths.idr ${IDRIS2_BOOT} --build ${IDRIS2_APP_IPKG} +support-lib: + mkdir -p lib + install support/c/${IDRIS2_SUPPORT} lib + # We use FORCE to always rebuild IdrisPath so that the git SHA1 info is always up to date src/IdrisPaths.idr: FORCE echo '-- @generated' > src/IdrisPaths.idr @@ -82,15 +90,15 @@ test-lib: contrib libs : prelude base contrib network test-lib -testbin: test-lib - @${MAKE} -C tests testbin IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH} +testbin: + @${MAKE} -C tests testbin IDRIS2=../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH} IDRIS2_DATA=${IDRIS2_TEST_DATA} IDRIS2_LIBS=${IDRIS2_TEST_LIBS} test: testbin @echo - @echo "NOTE: \`${MAKE} test\` does not rebuild idris; to do that run \`${MAKE}\`" + @echo "NOTE: \`${MAKE} test\` does not rebuild Idris or the libraries packaged with it; to do that run \`${MAKE}\`" @if [ ! -x "${TARGET}" ]; then echo "ERROR: Missing IDRIS2 executable. Cannot run tests!\n"; exit 1; fi @echo - @${MAKE} -C tests only=$(only) IDRIS2=../../../${TARGET} + @${MAKE} -C tests only=$(only) IDRIS2=../../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH} IDRIS2_DATA=${IDRIS2_TEST_DATA} IDRIS2_LIBS=${IDRIS2_TEST_LIBS} support: @${MAKE} -C support/c @@ -112,6 +120,7 @@ clean: clean-libs support-clean $(RM) src/IdrisPaths.idr ${MAKE} -C tests clean $(RM) -r build + $(RM) -r lib install: install-idris2 install-support install-libs @@ -125,7 +134,7 @@ ifeq ($(OS), windows) -install ${TARGET}.cmd ${PREFIX}/bin endif mkdir -p ${PREFIX}/lib/ - install support/c/${IDRIS2_SUPPORT} ${PREFIX}/lib + install lib/${IDRIS2_SUPPORT} ${PREFIX}/lib mkdir -p ${PREFIX}/bin/${NAME}_app install ${TARGETDIR}/${NAME}_app/* ${PREFIX}/bin/${NAME}_app @@ -152,7 +161,7 @@ install-libs: .PHONY: bootstrap bootstrap-build bootstrap-racket bootstrap-racket-build bootstrap-test bootstrap-clean # Bootstrapping using SCHEME -bootstrap: support +bootstrap: support support-lib cp support/c/${IDRIS2_SUPPORT} bootstrap/idris2_app sed 's/libidris2_support.so/${IDRIS2_SUPPORT}/g; s|__PREFIX__|${IDRIS2_CURDIR}/bootstrap|g' \ bootstrap/idris2_app/idris2.ss \ @@ -161,7 +170,7 @@ bootstrap: support IDRIS2_CG="chez" $(SHELL) ./bootstrap-stage2.sh # Bootstrapping using racket -bootstrap-racket: support +bootstrap-racket: support support-lib cp support/c/${IDRIS2_SUPPORT} bootstrap/idris2_app sed 's|__PREFIX__|${IDRIS2_CURDIR}/bootstrap|g' \ bootstrap/idris2_app/idris2.rkt \ @@ -170,7 +179,7 @@ bootstrap-racket: support IDRIS2_CG="racket" $(SHELL) ./bootstrap-stage2.sh bootstrap-test: - $(MAKE) test INTERACTIVE='' IDRIS2_PATH=${IDRIS2_BOOT_PATH} IDRIS2_DATA=${IDRIS2_BOOT_TEST_DATA} IDRIS2_LIBS=${IDRIS2_BOOT_TEST_LIBS} + $(MAKE) test INTERACTIVE='' IDRIS2_PATH=${IDRIS2_BOOT_PATH} IDRIS2_TEST_DATA=${IDRIS2_BOOT_TEST_DATA} IDRIS2_TEST_LIBS=${IDRIS2_BOOT_TEST_LIBS} bootstrap-clean: $(RM) -r bootstrap/bin bootstrap/lib bootstrap/idris2-${IDRIS2_VERSION} diff --git a/tests/Makefile b/tests/Makefile index bc48aee8a..ad65ac343 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -7,7 +7,7 @@ test: ./build/exec/runtests $(IDRIS2) $(INTERACTIVE) --threads $(threads) --only $(only) testbin: - ${IDRIS2_BOOT} --build tests.ipkg + ${IDRIS2} --build tests.ipkg clean: $(RM) -r build diff --git a/tests/tests.ipkg b/tests/tests.ipkg index 9b6ded08d..03fd293b2 100644 --- a/tests/tests.ipkg +++ b/tests/tests.ipkg @@ -1,5 +1,4 @@ package runtests -depends = test main = Main executable = runtests