all: Fix paths to mpy-cross and micropython binaries.

Binaries built using the Make build system now no longer appear in the
working directory of the build, but rather in the build directory.  Thus
some paths had to be adjusted.
This commit is contained in:
Daniel Jour 2022-08-02 23:48:41 +02:00 committed by Damien George
parent b2e8240268
commit 47c84286e8
11 changed files with 33 additions and 31 deletions

View File

@ -35,7 +35,7 @@ jobs:
env:
SOURCE_DATE_EPOCH: 1234567890
- name: Check reproducible build date
run: echo | ports/unix/micropython-minimal -i | grep 'on 2009-02-13;'
run: echo | ports/unix/build-minimal/micropython-minimal -i | grep 'on 2009-02-13;'
standard:
runs-on: ubuntu-latest

View File

@ -1,6 +1,6 @@
MPTOP = ../..
CFLAGS = -std=c99 -I. -I$(MPTOP) -DNO_QSTR
LDFLAGS = -L.
LDFLAGS = -L./build
hello-embed: hello-embed.o -lmicropython

View File

@ -304,18 +304,18 @@ include $(TOP)/py/mkrules.mk
.PHONY: test test_full
test: $(PROG) $(TOP)/tests/run-tests.py
test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py
test_full: $(PROG) $(TOP)/tests/run-tests.py
test_full: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py -d thread
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --emit native
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) -d basics float micropython
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython
cat $(TOP)/tests/basics/0prelim.py | ./$(PROG) | grep -q 'abc'
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py -d thread
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --emit native
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) -d basics float micropython
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython
cat $(TOP)/tests/basics/0prelim.py | ./$(BUILD)/$(PROG) | grep -q 'abc'
test_gcov: test_full
gcov -o $(BUILD)/py $(TOP)/py/*.c
@ -346,9 +346,9 @@ $(BUILD)/lib/libffi/include/ffi.h: $(TOP)/lib/libffi/configure
PREFIX = /usr/local
BINDIR = $(DESTDIR)$(PREFIX)/bin
install: $(PROG)
install: $(BUILD)/$(PROG)
install -d $(BINDIR)
install $(PROG) $(BINDIR)/$(PROG)
install $(BUILD)/$(PROG) $(BINDIR)/$(PROG)
uninstall:
-rm $(BINDIR)/$(PROG)

View File

@ -7,7 +7,7 @@ ECHO = @echo
RM = /bin/rm
MKDIR = /bin/mkdir
PYTHON = python3
MPY_CROSS = $(MPY_DIR)/mpy-cross/mpy-cross
MPY_CROSS = $(MPY_DIR)/mpy-cross/build/mpy-cross
MPY_TOOL = $(PYTHON) $(MPY_DIR)/tools/mpy-tool.py
MPY_LD = $(PYTHON) $(MPY_DIR)/tools/mpy_ld.py

View File

@ -61,7 +61,7 @@ MPY_LIB_SUBMODULE_DIR = $(TOP)/lib/micropython-lib
MPY_LIB_DIR = $(MPY_LIB_SUBMODULE_DIR)
ifeq ($(MICROPY_MPYCROSS),)
MICROPY_MPYCROSS = $(TOP)/mpy-cross/mpy-cross
MICROPY_MPYCROSS = $(TOP)/mpy-cross/build/mpy-cross
MICROPY_MPYCROSS_DEPENDENCY = $(MICROPY_MPYCROSS)
endif

View File

@ -193,7 +193,7 @@ if(MICROPY_FROZEN_MANIFEST)
# to automatically build mpy-cross if needed.
set(MICROPY_MPYCROSS $ENV{MICROPY_MPYCROSS})
if(NOT MICROPY_MPYCROSS)
set(MICROPY_MPYCROSS_DEPENDENCY ${MICROPY_DIR}/mpy-cross/mpy-cross)
set(MICROPY_MPYCROSS_DEPENDENCY ${MICROPY_DIR}/mpy-cross/build/mpy-cross)
if(NOT MICROPY_MAKE_EXECUTABLE)
set(MICROPY_MAKE_EXECUTABLE make)
endif()

View File

@ -162,7 +162,7 @@ $(HEADER_BUILD):
ifneq ($(MICROPY_MPYCROSS_DEPENDENCY),)
# to automatically build mpy-cross, if needed
$(MICROPY_MPYCROSS_DEPENDENCY):
$(MAKE) -C $(dir $@)
$(MAKE) -C $(dir $@)..
endif
ifneq ($(FROZEN_DIR),)

View File

@ -14,7 +14,7 @@ import pyboard
# Paths for host executables
CPYTHON3 = os.getenv("MICROPY_CPYTHON3", "python3")
MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/unix/micropython-coverage")
MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/unix/build-coverage/micropython-coverage")
NATMOD_EXAMPLE_DIR = "../examples/natmod/"

View File

@ -33,14 +33,16 @@ if os.name == "nt":
MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", base_path("../ports/windows/micropython.exe"))
else:
CPYTHON3 = os.getenv("MICROPY_CPYTHON3", "python3")
MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", base_path("../ports/unix/micropython"))
MICROPYTHON = os.getenv(
"MICROPY_MICROPYTHON", base_path("../ports/unix/build-standard/micropython")
)
# Use CPython options to not save .pyc files, to only access the core standard library
# (not site packages which may clash with u-module names), and improve start up time.
CPYTHON3_CMD = [CPYTHON3, "-BS"]
# mpy-cross is only needed if --via-mpy command-line arg is passed
MPYCROSS = os.getenv("MICROPY_MPYCROSS", base_path("../mpy-cross/mpy-cross"))
MPYCROSS = os.getenv("MICROPY_MPYCROSS", base_path("../mpy-cross/build/mpy-cross"))
# For diff'ing test output
DIFF = os.getenv("MICROPY_DIFF", "diff -u")

View File

@ -409,9 +409,9 @@ function ci_unix_run_tests_full_helper {
variant=$1
shift
if [ $variant = standard ]; then
micropython=micropython
micropython=build-$variant/micropython
else
micropython=micropython-$variant
micropython=build-$variant/micropython-$variant
fi
make -C ports/unix VARIANT=$variant "$@" test_full
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/$micropython ./run-multitests.py multi_net/*.py)
@ -444,7 +444,7 @@ function ci_unix_minimal_build {
}
function ci_unix_minimal_run_tests {
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython-minimal ./run-tests.py -e exception_chain -e self_type_check -e subclass_native_init -d basics)
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/build-minimal/micropython-minimal ./run-tests.py -e exception_chain -e self_type_check -e subclass_native_init -d basics)
}
function ci_unix_standard_build {
@ -491,21 +491,21 @@ function ci_unix_coverage_run_mpy_merge_tests {
test=$(basename $inpy .py)
echo $test
outmpy=$outdir/$test.mpy
$mptop/mpy-cross/mpy-cross -o $outmpy $inpy
(cd $outdir && $mptop/ports/unix/micropython-coverage -m $test >> out-individual)
$mptop/mpy-cross/build/mpy-cross -o $outmpy $inpy
(cd $outdir && $mptop/ports/unix/build-coverage/micropython-coverage -m $test >> out-individual)
allmpy+=($outmpy)
done
# Merge all the tests into one .mpy file, and then execute it.
python3 $mptop/tools/mpy-tool.py --merge -o $outdir/merged.mpy ${allmpy[@]}
(cd $outdir && $mptop/ports/unix/micropython-coverage -m merged > out-merged)
(cd $outdir && $mptop/ports/unix/build-coverage/micropython-coverage -m merged > out-merged)
# Make sure the outputs match.
diff $outdir/out-individual $outdir/out-merged && /bin/rm -rf $outdir
}
function ci_unix_coverage_run_native_mpy_tests {
MICROPYPATH=examples/natmod/features2 ./ports/unix/micropython-coverage -m features2
MICROPYPATH=examples/natmod/features2 ./ports/unix/build-coverage/micropython-coverage -m features2
(cd tests && ./run-natmodtests.py "$@" extmod/{btree*,framebuf*,uheapq*,urandom*,ure*,uzlib*}.py)
}
@ -614,7 +614,7 @@ function ci_unix_macos_run_tests {
# Issues with macOS tests:
# - import_pkg7 has a problem with relative imports
# - urandom_basic has a problem with getrandbits(0)
(cd tests && ./run-tests.py --exclude 'import_pkg7.py' --exclude 'urandom_basic.py')
(cd tests && MICROPY_MICROPYTHON=../ports/unix/build-standard/micropython ./run-tests.py --exclude 'import_pkg7.py' --exclude 'urandom_basic.py')
}
function ci_unix_qemu_mips_setup {
@ -634,7 +634,7 @@ function ci_unix_qemu_mips_run_tests {
# - (i)listdir does not work, it always returns the empty list (it's an issue with the underlying C call)
# - ffi tests do not work
file ./ports/unix/micropython-coverage
(cd tests && MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py --exclude 'vfs_posix.py' --exclude 'ffi_(callback|float|float2).py')
(cd tests && MICROPY_MICROPYTHON=../ports/unix/build-coverage/micropython-coverage ./run-tests.py --exclude 'vfs_posix.py' --exclude 'ffi_(callback|float|float2).py')
}
function ci_unix_qemu_arm_setup {
@ -654,7 +654,7 @@ function ci_unix_qemu_arm_run_tests {
# - (i)listdir does not work, it always returns the empty list (it's an issue with the underlying C call)
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabi
file ./ports/unix/micropython-coverage
(cd tests && MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py --exclude 'vfs_posix.py')
(cd tests && MICROPY_MICROPYTHON=../ports/unix/build-coverage/micropython-coverage ./run-tests.py --exclude 'vfs_posix.py')
}
########################################################################################

View File

@ -329,7 +329,7 @@ def main():
sys.exit(1)
# Get paths to tools
MPY_CROSS = VARS["MPY_DIR"] + "/mpy-cross/mpy-cross"
MPY_CROSS = VARS["MPY_DIR"] + "/mpy-cross/build/mpy-cross"
if sys.platform == "win32":
MPY_CROSS += ".exe"
MPY_CROSS = os.getenv("MICROPY_MPYCROSS", MPY_CROSS)