Skip to content

Commit

Permalink
.github: check openocd output in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sobuch authored and erhankur committed Dec 10, 2024
1 parent 897366e commit 461e882
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/test_openocd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ jobs:
uses: actions/download-artifact@v4
with:
name: openocd-macos-x86
- name: Run OpenOCD
run: chmod +x bin/openocd && ./bin/openocd --version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run and check OpenOCD
run: chmod +x bin/openocd && python tools/test_openocd.py bin/openocd

run-macos-arm64-host:
name: Test OpenOCD on MacOS-arm64
Expand All @@ -27,8 +31,12 @@ jobs:
uses: actions/download-artifact@v4
with:
name: openocd-macos-arm64
- name: Run OpenOCD
run: chmod +x bin/openocd && ./bin/openocd --version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run and check OpenOCD
run: chmod +x bin/openocd && python tools/test_openocd.py bin/openocd

run-linux-host:
name: Test OpenOCD on Linux
Expand All @@ -40,8 +48,12 @@ jobs:
uses: actions/download-artifact@v4
with:
name: openocd-linux
- name: Run OpenOCD
run: chmod +x bin/openocd && ./bin/openocd --version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run and check OpenOCD
run: chmod +x bin/openocd && python tools/test_openocd.py bin/openocd

run-win-host:
name: Test OpenOCD on Windows
Expand All @@ -53,5 +65,9 @@ jobs:
uses: actions/download-artifact@v4
with:
name: openocd-windows
- name: Run OpenOCD
run: .\bin\openocd --version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run and check OpenOCD
run: python tools/test_openocd.py bin\openocd
13 changes: 13 additions & 0 deletions tools/test_openocd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later

import subprocess
import sys

def main(ocd_bin):
version = subprocess.check_output(f'{ocd_bin} --version', stderr=subprocess.STDOUT, shell=True)
print(version.decode('UTF-8'))
return not b'Open On-Chip Debugger v0.12.0' in version

if __name__ == '__main__':
sys.exit(main(sys.argv[1]))

0 comments on commit 461e882

Please sign in to comment.