Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conftest: Randomize default PAN_ID #300

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
See https://docs.pytest.org/en/stable/fixture.html#conftest-py-sharing-fixture-functions
""" # noqa: E501

import random
import re
import os
import subprocess
Expand All @@ -29,6 +30,7 @@
RIOTBASE = os.environ.get('RIOTBASE')
RUNNING_CTRLS = []
RUNNING_EXPERIMENTS = []
DEFAULT_PAN_ID = str(random.randint(0, 0xFFFD))


def pytest_addoption(parser):
Expand Down Expand Up @@ -321,6 +323,12 @@ def update_env(node, modules=None, cflags=None, port=None, termflags=None, extra
node.env.get('DOCKER_ENVIRONMENT_CMDLINE', '')
+ f" -e 'USEMODULE={node.env['USEMODULE']}'"
)
node.env['DEFAULT_PAN_ID'] = DEFAULT_PAN_ID
if os.environ.get('BUILD_IN_DOCKER', 0) == '1':
node.env['DOCKER_ENVIRONMENT_CMDLINE'] = (
node.env.get('DOCKER_ENVIRONMENT_CMDLINE', '')
+ f" -e 'DEFAULT_PAN_ID={node.env['DEFAULT_PAN_ID']}'"
)
if cflags is not None:
node.env['CFLAGS'] = cflags
if port is not None:
Expand Down
Loading