diff --git a/.github/workflows/test_openocd.yml b/.github/workflows/test_openocd.yml index 93b5f796c..a379d0c04 100644 --- a/.github/workflows/test_openocd.yml +++ b/.github/workflows/test_openocd.yml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/tools/test_openocd.py b/tools/test_openocd.py new file mode 100755 index 000000000..c04f694e4 --- /dev/null +++ b/tools/test_openocd.py @@ -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]))