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

Merge pull request #1778 from authmillenon/netdev-test-env-fixes

netdev.tests: Add fixes for environment variables
This commit is contained in:
Martine Lenders 2014-10-08 12:28:16 +02:00
commit a48e471d88
2 changed files with 20 additions and 10 deletions

View File

@ -9,12 +9,11 @@ endif
include ../Makefile.tests_common
USEMODULE += defaulttransceiver
USEMODULE += net_help
USEMODULE += netdev_base
DISABLE_MODULE += auto_init
INCLUDES += -I$(RIOTBASE)/sys/net/include
CHANNEL ?= 1
SENDER_ADDRESS ?= 1
RECEIVER_ADDRESS ?= 2

View File

@ -6,7 +6,7 @@
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os, sys, time
import os, signal, sys, time
from pexpect import spawn, TIMEOUT, EOF
class Abort(Exception):
@ -17,11 +17,22 @@ board = os.environ.get('BOARD', 'native')
DEFAULT_TIMEOUT=5
def main():
receiver = spawn("make term", timeout=5, env={"SENDER": '0'})
time.sleep(1)
sender = spawn("make term", timeout=5, env={"SENDER": '1'})
receiver = None
sender = None
if "PORT" in os.environ:
del os.environ["PORT"]
if "TERMFLAGS" in os.environ:
del os.environ["TERMFLAGS"]
try:
os.environ["SENDER"] = "0"
receiver = spawn("make term", timeout=5)
time.sleep(1)
os.environ["SENDER"] = "1"
sender = spawn("make term", timeout=5)
receiver.expect(r"RIOT netdev test")
sender.expect(r"RIOT netdev test")
@ -122,10 +133,10 @@ def main():
except Abort:
return 0
finally:
if not sender.terminate():
sender.terminate(force=True)
if not receiver.terminate():
receiver.terminate(force=True)
if sender and not sender.terminate():
os.killpg(sender.pid, signal.SIGKILL)
if receiver and not receiver.terminate():
os.killpg(receiver.pid, signal.SIGKILL)
if __name__ == "__main__":
sys.exit(main())