Merge pull request #14459 from miri64/tools/enh/make-env
tools: add capability to provide make command via environment
This commit is contained in:
commit
37a5e8700f
6
dist/pythonlibs/testrunner/spawn.py
vendored
6
dist/pythonlibs/testrunner/spawn.py
vendored
@ -41,13 +41,15 @@ TEST_INTERACTIVE_DELAY = int(os.environ.get('TEST_INTERACTIVE_DELAY') or 1)
|
|||||||
TESTRUNNER_RESET_AFTER_TERM = int(os.environ.get('TESTRUNNER_RESET_AFTER_TERM')
|
TESTRUNNER_RESET_AFTER_TERM = int(os.environ.get('TESTRUNNER_RESET_AFTER_TERM')
|
||||||
or '0')
|
or '0')
|
||||||
|
|
||||||
|
MAKE = os.environ.get('MAKE', 'make')
|
||||||
|
|
||||||
|
|
||||||
def _reset_board(env):
|
def _reset_board(env):
|
||||||
if MAKE_RESET_DELAY > 0:
|
if MAKE_RESET_DELAY > 0:
|
||||||
time.sleep(MAKE_RESET_DELAY)
|
time.sleep(MAKE_RESET_DELAY)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.check_output(('make', 'reset'), env=env,
|
subprocess.check_output((MAKE, 'reset'), env=env,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
# make reset yields error on some boards even if successful
|
# make reset yields error on some boards even if successful
|
||||||
@ -74,7 +76,7 @@ def setup_child(timeout=10, spawnclass=pexpect.spawnu, env=None, logfile=None):
|
|||||||
# the serial terminal. This gives time for stdio to be ready.
|
# the serial terminal. This gives time for stdio to be ready.
|
||||||
time.sleep(MAKE_TERM_CONNECT_DELAY)
|
time.sleep(MAKE_TERM_CONNECT_DELAY)
|
||||||
|
|
||||||
child = spawnclass("make cleanterm", env=env, timeout=timeout,
|
child = spawnclass("{} cleanterm".format(MAKE), env=env, timeout=timeout,
|
||||||
codec_errors='replace', echo=False)
|
codec_errors='replace', echo=False)
|
||||||
|
|
||||||
# on many platforms, the termprog needs a short while to be ready...
|
# on many platforms, the termprog needs a short while to be ready...
|
||||||
|
|||||||
6
dist/tools/ci/print_toolchain_versions.sh
vendored
6
dist/tools/ci/print_toolchain_versions.sh
vendored
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
MAKE=${MAKE:-make}
|
||||||
|
|
||||||
get_cmd_version() {
|
get_cmd_version() {
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
return
|
return
|
||||||
@ -80,7 +82,7 @@ get_sys_shell() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_get_make_shell() {
|
_get_make_shell() {
|
||||||
make -sf - 2>/dev/null <<MAKEFILE
|
${MAKE} -sf - 2>/dev/null <<MAKEFILE
|
||||||
\$(info \$(realpath \$(SHELL)))
|
\$(info \$(realpath \$(SHELL)))
|
||||||
MAKEFILE
|
MAKEFILE
|
||||||
}
|
}
|
||||||
@ -156,7 +158,7 @@ for c in \
|
|||||||
cppcheck \
|
cppcheck \
|
||||||
doxygen \
|
doxygen \
|
||||||
git \
|
git \
|
||||||
make \
|
${MAKE} \
|
||||||
openocd \
|
openocd \
|
||||||
python \
|
python \
|
||||||
python2 \
|
python2 \
|
||||||
|
|||||||
@ -95,6 +95,8 @@ LOG_HANDLER.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
|
|||||||
|
|
||||||
LOG_LEVELS = ('debug', 'info', 'warning', 'error', 'fatal', 'critical')
|
LOG_LEVELS = ('debug', 'info', 'warning', 'error', 'fatal', 'critical')
|
||||||
|
|
||||||
|
MAKE = os.environ.get('MAKE', 'make')
|
||||||
|
|
||||||
|
|
||||||
class ErrorInTest(Exception):
|
class ErrorInTest(Exception):
|
||||||
"""Custom exception for a failed test.
|
"""Custom exception for a failed test.
|
||||||
@ -156,7 +158,7 @@ def apps_directories(riotdir, apps_dirs=None, apps_dirs_skip=None):
|
|||||||
|
|
||||||
def _riot_applications_dirs(riotdir):
|
def _riot_applications_dirs(riotdir):
|
||||||
"""Applications directories in the RIOT repository with relative path."""
|
"""Applications directories in the RIOT repository with relative path."""
|
||||||
cmd = ['make', 'info-applications']
|
cmd = [MAKE, 'info-applications']
|
||||||
|
|
||||||
out = subprocess.check_output(cmd, cwd=riotdir)
|
out = subprocess.check_output(cmd, cwd=riotdir)
|
||||||
out = out.decode('utf-8', errors='replace')
|
out = out.decode('utf-8', errors='replace')
|
||||||
@ -383,7 +385,7 @@ class RIOTApplication():
|
|||||||
full_env = os.environ.copy()
|
full_env = os.environ.copy()
|
||||||
full_env.update(env)
|
full_env.update(env)
|
||||||
|
|
||||||
cmd = ['make']
|
cmd = [MAKE]
|
||||||
cmd.extend(self.MAKEFLAGS)
|
cmd.extend(self.MAKEFLAGS)
|
||||||
cmd.extend(['-C', os.path.join(self.riotdir, self.appdir)])
|
cmd.extend(['-C', os.path.join(self.riotdir, self.appdir)])
|
||||||
cmd.extend(args)
|
cmd.extend(args)
|
||||||
|
|||||||
7
dist/tools/compile_test/compile_test.py
vendored
7
dist/tools/compile_test/compile_test.py
vendored
@ -38,6 +38,9 @@ except ImportError:
|
|||||||
from itertools import tee
|
from itertools import tee
|
||||||
|
|
||||||
|
|
||||||
|
MAKE = environ.get("MAKE", "make")
|
||||||
|
|
||||||
|
|
||||||
class Termcolor:
|
class Termcolor:
|
||||||
red = '\033[1;31m'
|
red = '\033[1;31m'
|
||||||
green = '\033[1;32m'
|
green = '\033[1;32m'
|
||||||
@ -90,7 +93,7 @@ def get_results_and_output_from(fd):
|
|||||||
|
|
||||||
|
|
||||||
def get_app_dirs():
|
def get_app_dirs():
|
||||||
return check_output(["make", "-f", "makefiles/app_dirs.inc.mk", "info-applications"]) \
|
return check_output([MAKE, "-f", "makefiles/app_dirs.inc.mk", "info-applications"]) \
|
||||||
.decode("utf-8", errors="ignore")\
|
.decode("utf-8", errors="ignore")\
|
||||||
.split()
|
.split()
|
||||||
|
|
||||||
@ -130,7 +133,7 @@ def build_all():
|
|||||||
stdout.flush()
|
stdout.flush()
|
||||||
try:
|
try:
|
||||||
app_dir = join(riotbase, folder, application)
|
app_dir = join(riotbase, folder, application)
|
||||||
subprocess = Popen(('make', 'buildtest'),
|
subprocess = Popen((MAKE, 'buildtest'),
|
||||||
bufsize=1, stdin=null, stdout=PIPE, stderr=null,
|
bufsize=1, stdin=null, stdout=PIPE, stderr=null,
|
||||||
cwd=app_dir,
|
cwd=app_dir,
|
||||||
env=subprocess_env)
|
env=subprocess_env)
|
||||||
|
|||||||
@ -18,6 +18,8 @@ import socket
|
|||||||
|
|
||||||
DEFAULT_TIMEOUT = 5
|
DEFAULT_TIMEOUT = 5
|
||||||
|
|
||||||
|
MAKE = os.environ.get('MAKE', 'make')
|
||||||
|
|
||||||
|
|
||||||
class Strategy(object):
|
class Strategy(object):
|
||||||
def __init__(self, func=None):
|
def __init__(self, func=None):
|
||||||
@ -47,7 +49,7 @@ class BoardStrategy(Strategy):
|
|||||||
if env is not None:
|
if env is not None:
|
||||||
env.update(env)
|
env.update(env)
|
||||||
env.update(self.board.to_env())
|
env.update(self.board.to_env())
|
||||||
cmd = ("make", "-C", application) + make_targets
|
cmd = (MAKE, "-C", application) + make_targets
|
||||||
print(' '.join(cmd))
|
print(' '.join(cmd))
|
||||||
print(subprocess.check_output(cmd, env=env))
|
print(subprocess.check_output(cmd, env=env))
|
||||||
|
|
||||||
@ -165,7 +167,7 @@ def default_test_case(board_group, application, env=None):
|
|||||||
if env is not None:
|
if env is not None:
|
||||||
env.update(env)
|
env.update(env)
|
||||||
env.update(board.to_env())
|
env.update(board.to_env())
|
||||||
with pexpect.spawnu("make", ["-C", application, "term"], env=env,
|
with pexpect.spawnu(MAKE, ["-C", application, "term"], env=env,
|
||||||
timeout=DEFAULT_TIMEOUT,
|
timeout=DEFAULT_TIMEOUT,
|
||||||
logfile=sys.stdout) as spawn:
|
logfile=sys.stdout) as spawn:
|
||||||
spawn.expect("TEST: SUCCESS")
|
spawn.expect("TEST: SUCCESS")
|
||||||
@ -201,9 +203,9 @@ def test_ipv6_send(board_group, application, env=None):
|
|||||||
if env is not None:
|
if env is not None:
|
||||||
env_receiver.update(env)
|
env_receiver.update(env)
|
||||||
env_receiver.update(board_group.boards[1].to_env())
|
env_receiver.update(board_group.boards[1].to_env())
|
||||||
with pexpect.spawnu("make", ["-C", application, "term"], env=env_sender,
|
with pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_sender,
|
||||||
timeout=DEFAULT_TIMEOUT) as sender, \
|
timeout=DEFAULT_TIMEOUT) as sender, \
|
||||||
pexpect.spawnu("make", ["-C", application, "term"], env=env_receiver,
|
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_receiver,
|
||||||
timeout=DEFAULT_TIMEOUT) as receiver:
|
timeout=DEFAULT_TIMEOUT) as receiver:
|
||||||
ipprot = random.randint(0x00, 0xff)
|
ipprot = random.randint(0x00, 0xff)
|
||||||
receiver_ip = get_ipv6_address(receiver)
|
receiver_ip = get_ipv6_address(receiver)
|
||||||
@ -225,9 +227,9 @@ def test_udpv6_send(board_group, application, env=None):
|
|||||||
if env is not None:
|
if env is not None:
|
||||||
env_receiver.update(env)
|
env_receiver.update(env)
|
||||||
env_receiver.update(board_group.boards[1].to_env())
|
env_receiver.update(board_group.boards[1].to_env())
|
||||||
with pexpect.spawnu("make", ["-C", application, "term"], env=env_sender,
|
with pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_sender,
|
||||||
timeout=DEFAULT_TIMEOUT) as sender, \
|
timeout=DEFAULT_TIMEOUT) as sender, \
|
||||||
pexpect.spawnu("make", ["-C", application, "term"], env=env_receiver,
|
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_receiver,
|
||||||
timeout=DEFAULT_TIMEOUT) as receiver:
|
timeout=DEFAULT_TIMEOUT) as receiver:
|
||||||
port = random.randint(0x0000, 0xffff)
|
port = random.randint(0x0000, 0xffff)
|
||||||
receiver_ip = get_ipv6_address(receiver)
|
receiver_ip = get_ipv6_address(receiver)
|
||||||
@ -250,9 +252,9 @@ def test_tcpv6_send(board_group, application, env=None):
|
|||||||
if env is not None:
|
if env is not None:
|
||||||
env_server.update(env)
|
env_server.update(env)
|
||||||
env_server.update(board_group.boards[1].to_env())
|
env_server.update(board_group.boards[1].to_env())
|
||||||
with pexpect.spawnu("make", ["-C", application, "term"], env=env_client,
|
with pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_client,
|
||||||
timeout=DEFAULT_TIMEOUT) as client, \
|
timeout=DEFAULT_TIMEOUT) as client, \
|
||||||
pexpect.spawnu("make", ["-C", application, "term"], env=env_server,
|
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_server,
|
||||||
timeout=DEFAULT_TIMEOUT) as server:
|
timeout=DEFAULT_TIMEOUT) as server:
|
||||||
port = random.randint(0x0000, 0xffff)
|
port = random.randint(0x0000, 0xffff)
|
||||||
server_ip = get_ipv6_address(server)
|
server_ip = get_ipv6_address(server)
|
||||||
@ -284,9 +286,9 @@ def test_tcpv6_multiconnect(board_group, application, env=None):
|
|||||||
if env is not None:
|
if env is not None:
|
||||||
env_server.update(env)
|
env_server.update(env)
|
||||||
env_server.update(board_group.boards[1].to_env())
|
env_server.update(board_group.boards[1].to_env())
|
||||||
with pexpect.spawnu("make", ["-C", application, "term"], env=env_client,
|
with pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_client,
|
||||||
timeout=DEFAULT_TIMEOUT) as client, \
|
timeout=DEFAULT_TIMEOUT) as client, \
|
||||||
pexpect.spawnu("make", ["-C", application, "term"], env=env_server,
|
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_server,
|
||||||
timeout=DEFAULT_TIMEOUT) as server:
|
timeout=DEFAULT_TIMEOUT) as server:
|
||||||
port = random.randint(0x0000, 0xffff)
|
port = random.randint(0x0000, 0xffff)
|
||||||
server_ip = get_ipv6_address(server)
|
server_ip = get_ipv6_address(server)
|
||||||
@ -327,9 +329,9 @@ def test_triple_send(board_group, application, env=None):
|
|||||||
if env is not None:
|
if env is not None:
|
||||||
env_receiver.update(env)
|
env_receiver.update(env)
|
||||||
env_receiver.update(board_group.boards[1].to_env())
|
env_receiver.update(board_group.boards[1].to_env())
|
||||||
with pexpect.spawnu("make", ["-C", application, "term"], env=env_sender,
|
with pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_sender,
|
||||||
timeout=DEFAULT_TIMEOUT) as sender, \
|
timeout=DEFAULT_TIMEOUT) as sender, \
|
||||||
pexpect.spawnu("make", ["-C", application, "term"], env=env_receiver,
|
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_receiver,
|
||||||
timeout=DEFAULT_TIMEOUT) as receiver:
|
timeout=DEFAULT_TIMEOUT) as receiver:
|
||||||
udp_port = random.randint(0x0000, 0xffff)
|
udp_port = random.randint(0x0000, 0xffff)
|
||||||
tcp_port = random.randint(0x0000, 0xffff)
|
tcp_port = random.randint(0x0000, 0xffff)
|
||||||
|
|||||||
@ -10,11 +10,12 @@
|
|||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
from testrunner import run
|
from testrunner import run
|
||||||
|
from testrunner.spawn import MAKE
|
||||||
|
|
||||||
|
|
||||||
def flash_slot(slotnum, version):
|
def flash_slot(slotnum, version):
|
||||||
cmd = [
|
cmd = [
|
||||||
"make",
|
MAKE,
|
||||||
"RIOTBOOT_SKIP_COMPILE=1",
|
"RIOTBOOT_SKIP_COMPILE=1",
|
||||||
"riotboot/flash-slot{}".format(slotnum),
|
"riotboot/flash-slot{}".format(slotnum),
|
||||||
"APP_VER={}".format(version),
|
"APP_VER={}".format(version),
|
||||||
|
|||||||
@ -7,6 +7,7 @@ from traceback import print_tb
|
|||||||
import pexpect
|
import pexpect
|
||||||
|
|
||||||
BOARD = os.getenv('BOARD', 'stm32f4discovery')
|
BOARD = os.getenv('BOARD', 'stm32f4discovery')
|
||||||
|
MAKE = os.environ.get('MAKE', 'make')
|
||||||
|
|
||||||
|
|
||||||
def testfunc():
|
def testfunc():
|
||||||
@ -20,7 +21,7 @@ def testfunc():
|
|||||||
if exc.errno == os.errno.ENOENT:
|
if exc.errno == os.errno.ENOENT:
|
||||||
print("ABORTING TEST: {} seems to be missing.\n".format(cross_gcc))
|
print("ABORTING TEST: {} seems to be missing.\n".format(cross_gcc))
|
||||||
else:
|
else:
|
||||||
child = pexpect.spawnu(['make'], env=os.environ)
|
child = pexpect.spawnu([MAKE], env=os.environ)
|
||||||
child.logfile = sys.stdout
|
child.logfile = sys.stdout
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user