Skip to content

Commit

Permalink
Add support for Linux in test scripts
Browse files Browse the repository at this point in the history
Set the GDB to use for Windows, Linux and Mac.  This allows testing
to be run on multiple operating systems.
  • Loading branch information
c1728p9 committed Mar 14, 2016
1 parent e23e79f commit 52c2a31
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/gdb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import os
import json
import sys
from subprocess import Popen, STDOUT, PIPE

from pyOCD.tools.gdb_server import GDBServerTool
Expand All @@ -36,6 +37,17 @@

TEST_PARAM_FILE = "test_params.txt"
TEST_RESULT_FILE = "test_results.txt"
PYTHON_GDB_FOR_OS = {
"linux": "arm-none-eabi-gdb",
"darwin": "arm-none-eabi-gdb-py",
"win": "arm-none-eabi-gdb-py",
}
PYTHON_GDB = None
for prefix, program in PYTHON_GDB_FOR_OS.iteritems():
if sys.platform.startswith(prefix):
PYTHON_GDB = program
break


parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Expand Down Expand Up @@ -116,7 +128,7 @@ def test_gdb(board_id=None):
f.write(json.dumps(test_params))

# Run the test
gdb = ["arm-none-eabi-gdb-py", "--command=gdb_script.py"]
gdb = [PYTHON_GDB, "--command=gdb_script.py"]
with open("output.txt", "wb") as f:
program = Popen(gdb, stdin=PIPE, stdout=f, stderr=STDOUT)
args = ['-p=%i' % test_port, "-f=%i" % test_clock, "-b=%s" % board_id]
Expand Down

0 comments on commit 52c2a31

Please sign in to comment.