1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 23:41:18 +01:00

tools: add capability to provide make command via environment

Not all operating systems name the GNU Make `make`. FreeBSD e.g. uses a
different dialect of Make, that seems to be incompatible with GNU make.
(I wasn't able to get `make` run, but `gmake` works).

This allows our test scripts to be configured via the environment
variable `MAKE` to point to a different make command.
This commit is contained in:
Martine S. Lenders 2020-07-07 18:57:16 +02:00
parent ad28752e4e
commit da3fdd33d1
No known key found for this signature in database
GPG Key ID: CCD317364F63286F
4 changed files with 16 additions and 8 deletions

View File

@ -41,13 +41,14 @@ TEST_INTERACTIVE_DELAY = int(os.environ.get('TEST_INTERACTIVE_DELAY') or 1)
TESTRUNNER_RESET_AFTER_TERM = int(os.environ.get('TESTRUNNER_RESET_AFTER_TERM')
or '0')
MAKE = os.environ.get('MAKE', 'make')
def _reset_board(env):
if MAKE_RESET_DELAY > 0:
time.sleep(MAKE_RESET_DELAY)
try:
subprocess.check_output(('make', 'reset'), env=env,
subprocess.check_output((MAKE, 'reset'), env=env,
stderr=subprocess.PIPE)
except subprocess.CalledProcessError:
# make reset yields error on some boards even if successful
@ -74,7 +75,7 @@ def setup_child(timeout=10, spawnclass=pexpect.spawnu, env=None, logfile=None):
# the serial terminal. This gives time for stdio to be ready.
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)
# on many platforms, the termprog needs a short while to be ready...

View File

@ -1,5 +1,7 @@
#!/bin/sh
MAKE=${MAKE:-make}
get_cmd_version() {
if [ -z "$1" ]; then
return
@ -80,7 +82,7 @@ get_sys_shell() {
}
_get_make_shell() {
make -sf - 2>/dev/null <<MAKEFILE
${MAKE} -sf - 2>/dev/null <<MAKEFILE
\$(info \$(realpath \$(SHELL)))
MAKEFILE
}
@ -156,7 +158,7 @@ for c in \
cppcheck \
doxygen \
git \
make \
${MAKE} \
openocd \
python \
python2 \

View File

@ -95,6 +95,8 @@ LOG_HANDLER.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
LOG_LEVELS = ('debug', 'info', 'warning', 'error', 'fatal', 'critical')
MAKE = os.environ.get('MAKE', 'make')
class ErrorInTest(Exception):
"""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):
"""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 = out.decode('utf-8', errors='replace')
@ -383,7 +385,7 @@ class RIOTApplication():
full_env = os.environ.copy()
full_env.update(env)
cmd = ['make']
cmd = [MAKE]
cmd.extend(self.MAKEFLAGS)
cmd.extend(['-C', os.path.join(self.riotdir, self.appdir)])
cmd.extend(args)

View File

@ -38,6 +38,9 @@ except ImportError:
from itertools import tee
MAKE = environ.get("MAKE", "make")
class Termcolor:
red = '\033[1;31m'
green = '\033[1;32m'
@ -90,7 +93,7 @@ def get_results_and_output_from(fd):
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")\
.split()
@ -130,7 +133,7 @@ def build_all():
stdout.flush()
try:
app_dir = join(riotbase, folder, application)
subprocess = Popen(('make', 'buildtest'),
subprocess = Popen((MAKE, 'buildtest'),
bufsize=1, stdin=null, stdout=PIPE, stderr=null,
cwd=app_dir,
env=subprocess_env)