Skip to content

Commit

Permalink
tests: add capability to provide make command via environment
Browse files Browse the repository at this point in the history
For those tests that don't use the tooling fixed in the previous commit
  • Loading branch information
miri64 committed Jul 9, 2020
1 parent da3fdd3 commit 1cb0e09
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions dist/pythonlibs/testrunner/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

MAKE = os.environ.get('MAKE', 'make')


def _reset_board(env):
if MAKE_RESET_DELAY > 0:
time.sleep(MAKE_RESET_DELAY)
Expand Down
26 changes: 14 additions & 12 deletions tests/lwip/tests/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

DEFAULT_TIMEOUT = 5

MAKE = os.environ.get('MAKE', 'make')


class Strategy(object):
def __init__(self, func=None):
Expand Down Expand Up @@ -47,7 +49,7 @@ def __run_make(self, application, make_targets, env=None):
if env is not None:
env.update(env)
env.update(self.board.to_env())
cmd = ("make", "-C", application) + make_targets
cmd = (MAKE, "-C", application) + make_targets
print(' '.join(cmd))
print(subprocess.check_output(cmd, env=env))

Expand Down Expand Up @@ -165,7 +167,7 @@ def default_test_case(board_group, application, env=None):
if env is not None:
env.update(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,
logfile=sys.stdout) as spawn:
spawn.expect("TEST: SUCCESS")
Expand Down Expand Up @@ -201,9 +203,9 @@ def test_ipv6_send(board_group, application, env=None):
if env is not None:
env_receiver.update(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, \
pexpect.spawnu("make", ["-C", application, "term"], env=env_receiver,
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_receiver,
timeout=DEFAULT_TIMEOUT) as receiver:
ipprot = random.randint(0x00, 0xff)
receiver_ip = get_ipv6_address(receiver)
Expand All @@ -225,9 +227,9 @@ def test_udpv6_send(board_group, application, env=None):
if env is not None:
env_receiver.update(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, \
pexpect.spawnu("make", ["-C", application, "term"], env=env_receiver,
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_receiver,
timeout=DEFAULT_TIMEOUT) as receiver:
port = random.randint(0x0000, 0xffff)
receiver_ip = get_ipv6_address(receiver)
Expand All @@ -250,9 +252,9 @@ def test_tcpv6_send(board_group, application, env=None):
if env is not None:
env_server.update(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, \
pexpect.spawnu("make", ["-C", application, "term"], env=env_server,
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_server,
timeout=DEFAULT_TIMEOUT) as server:
port = random.randint(0x0000, 0xffff)
server_ip = get_ipv6_address(server)
Expand Down Expand Up @@ -284,9 +286,9 @@ def test_tcpv6_multiconnect(board_group, application, env=None):
if env is not None:
env_server.update(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, \
pexpect.spawnu("make", ["-C", application, "term"], env=env_server,
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_server,
timeout=DEFAULT_TIMEOUT) as server:
port = random.randint(0x0000, 0xffff)
server_ip = get_ipv6_address(server)
Expand Down Expand Up @@ -327,9 +329,9 @@ def test_triple_send(board_group, application, env=None):
if env is not None:
env_receiver.update(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, \
pexpect.spawnu("make", ["-C", application, "term"], env=env_receiver,
pexpect.spawnu(MAKE, ["-C", application, "term"], env=env_receiver,
timeout=DEFAULT_TIMEOUT) as receiver:
udp_port = random.randint(0x0000, 0xffff)
tcp_port = random.randint(0x0000, 0xffff)
Expand Down
3 changes: 2 additions & 1 deletion tests/riotboot/tests/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
import sys
import subprocess
from testrunner import run
from testrunner.spawn import MAKE


def flash_slot(slotnum, version):
cmd = [
"make",
MAKE,
"RIOTBOOT_SKIP_COMPILE=1",
"riotboot/flash-slot{}".format(slotnum),
"APP_VER={}".format(version),
Expand Down
3 changes: 2 additions & 1 deletion tests/warn_conflict/tests/01-make.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pexpect

BOARD = os.getenv('BOARD', 'stm32f4discovery')
MAKE = os.environ.get('MAKE', 'make')


def testfunc():
Expand All @@ -20,7 +21,7 @@ def testfunc():
if exc.errno == os.errno.ENOENT:
print("ABORTING TEST: {} seems to be missing.\n".format(cross_gcc))
else:
child = pexpect.spawnu(['make'], env=os.environ)
child = pexpect.spawnu([MAKE], env=os.environ)
child.logfile = sys.stdout

try:
Expand Down

0 comments on commit 1cb0e09

Please sign in to comment.