nxdk-pgraph-test-runner 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nxdk_pgraph_test_runner-0.0.1/.github/workflows/build.yml +107 -0
- nxdk_pgraph_test_runner-0.0.1/.gitignore +14 -0
- nxdk_pgraph_test_runner-0.0.1/LICENSE.txt +9 -0
- nxdk_pgraph_test_runner-0.0.1/PKG-INFO +102 -0
- nxdk_pgraph_test_runner-0.0.1/README.md +75 -0
- nxdk_pgraph_test_runner-0.0.1/githooks/pre-commit +76 -0
- nxdk_pgraph_test_runner-0.0.1/pyproject.toml +86 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/__about__.py +4 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/__init__.py +118 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/__main__.py +7 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/_config.py +126 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/_emulator_output.py +65 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/_ftp_server.py +114 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/_nxdk_pgraph_tester_config.py +247 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/_nxdk_pgraph_tester_progress_log.py +83 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/_nxdk_pgraph_tester_test_output.py +53 -0
- nxdk_pgraph_test_runner-0.0.1/src/nxdk_pgraph_test_runner/runner.py +286 -0
- nxdk_pgraph_test_runner-0.0.1/tests/__init__.py +3 -0
- nxdk_pgraph_test_runner-0.0.1/tests/test_config.py +40 -0
- nxdk_pgraph_test_runner-0.0.1/tests/test_emulator_output.py +41 -0
- nxdk_pgraph_test_runner-0.0.1/tests/test_nxdk_pgraph_tester_config.py +55 -0
- nxdk_pgraph_test_runner-0.0.1/tests/test_runner.py +20 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- '.github/**'
|
|
9
|
+
- '!.github/workflows/**'
|
|
10
|
+
pull_request:
|
|
11
|
+
paths-ignore:
|
|
12
|
+
- '.github/**'
|
|
13
|
+
- '!.github/workflows/**'
|
|
14
|
+
- 'README.md'
|
|
15
|
+
release:
|
|
16
|
+
types: [ published ]
|
|
17
|
+
workflow_dispatch:
|
|
18
|
+
|
|
19
|
+
concurrency:
|
|
20
|
+
group: ${{ github.workflow }}-${{ github.head_ref }}
|
|
21
|
+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
select-python-version-for-publishing:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
outputs:
|
|
27
|
+
python-version: ${{ steps.select-version.outputs.version }}
|
|
28
|
+
steps:
|
|
29
|
+
- id: select-version
|
|
30
|
+
run: echo "version=3.11" >> $GITHUB_OUTPUT
|
|
31
|
+
|
|
32
|
+
Build:
|
|
33
|
+
needs: [ select-python-version-for-publishing ]
|
|
34
|
+
name: Build source and wheel distributions
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
|
|
37
|
+
strategy:
|
|
38
|
+
matrix:
|
|
39
|
+
python-version: [ "3.11", "3.12", "3.13" ]
|
|
40
|
+
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
|
|
44
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
45
|
+
uses: actions/setup-python@v5
|
|
46
|
+
with:
|
|
47
|
+
python-version: ${{ matrix.python-version }}
|
|
48
|
+
|
|
49
|
+
- name: Install Hatch
|
|
50
|
+
uses: pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc
|
|
51
|
+
|
|
52
|
+
- name: Hatch fmt and type check
|
|
53
|
+
run: |
|
|
54
|
+
hatch fmt --check
|
|
55
|
+
hatch run types:check
|
|
56
|
+
|
|
57
|
+
- name: Build sdist and wheel
|
|
58
|
+
run: |
|
|
59
|
+
hatch build
|
|
60
|
+
|
|
61
|
+
- name: Test
|
|
62
|
+
run: |
|
|
63
|
+
hatch test
|
|
64
|
+
|
|
65
|
+
- name: Upload sdist artifact
|
|
66
|
+
uses: actions/upload-artifact@v4
|
|
67
|
+
if: matrix.python-version == needs.select-python-version-for-publishing.outputs.python-version
|
|
68
|
+
with:
|
|
69
|
+
name: source
|
|
70
|
+
path: dist/*.tar.gz
|
|
71
|
+
|
|
72
|
+
- name: Upload wheel artifact
|
|
73
|
+
uses: actions/upload-artifact@v4
|
|
74
|
+
if: matrix.python-version == needs.select-python-version-for-publishing.outputs.python-version
|
|
75
|
+
with:
|
|
76
|
+
name: wheels
|
|
77
|
+
path: dist/*.whl
|
|
78
|
+
|
|
79
|
+
Publish:
|
|
80
|
+
needs: [ Build, select-python-version-for-publishing ]
|
|
81
|
+
name: Publish distribution to PyPi
|
|
82
|
+
runs-on: ubuntu-latest
|
|
83
|
+
if: github.event_name == 'release'
|
|
84
|
+
|
|
85
|
+
steps:
|
|
86
|
+
- uses: actions/download-artifact@v4
|
|
87
|
+
with:
|
|
88
|
+
name: source
|
|
89
|
+
path: dist
|
|
90
|
+
|
|
91
|
+
- uses: actions/download-artifact@v4
|
|
92
|
+
with:
|
|
93
|
+
name: wheels
|
|
94
|
+
path: dist
|
|
95
|
+
|
|
96
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
97
|
+
if: github.event.release.prerelease
|
|
98
|
+
with:
|
|
99
|
+
user: __token__
|
|
100
|
+
password: ${{ secrets.TESTPYPI_API_TOKEN }}
|
|
101
|
+
repository_url: https://test.pypi.org/legacy/
|
|
102
|
+
|
|
103
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
104
|
+
if: github.event.release.prerelease == false
|
|
105
|
+
with:
|
|
106
|
+
user: __token__
|
|
107
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present Erik Abair <erik.abair@bearbrains.work>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nxdk-pgraph-test-runner
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Executes and captures the results of https://github.com/abaire/nxdk_pgraph_tests in an emulator
|
|
5
|
+
Project-URL: Documentation, https://github.com/abaire/nxdk-pgraph-test-runner#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/abaire/nxdk-pgraph-test-runner/issues
|
|
7
|
+
Project-URL: Source, https://github.com/abaire/nxdk-pgraph-test-runner
|
|
8
|
+
Author-email: Erik Abair <erik.abair@bearbrains.work>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Keywords: nv2a,pgraph,xbox,xemu
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
17
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: docker~=7.1.0
|
|
20
|
+
Requires-Dist: ifaddr~=0.2.0
|
|
21
|
+
Requires-Dist: mergedeep~=1.3.4
|
|
22
|
+
Requires-Dist: platformdirs~=4.3.6
|
|
23
|
+
Requires-Dist: pyfatx~=0.0.7
|
|
24
|
+
Requires-Dist: pyftpdlib~=2.0.1
|
|
25
|
+
Requires-Dist: tomli-w~=1.2.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# nxdk-pgraph-test-runner
|
|
29
|
+
|
|
30
|
+
[](https://pypi.org/project/nxdk-pgraph-test-runner)
|
|
31
|
+
[](https://pypi.org/project/nxdk-pgraph-test-runner)
|
|
32
|
+
|
|
33
|
+
-----
|
|
34
|
+
|
|
35
|
+
## Table of Contents
|
|
36
|
+
|
|
37
|
+
- [Installation](#installation)
|
|
38
|
+
- [Configuration](#configuration)
|
|
39
|
+
- [License](#license)
|
|
40
|
+
|
|
41
|
+
## Purpose
|
|
42
|
+
|
|
43
|
+
This test harness utilizes
|
|
44
|
+
the [nxdk_pgraph_tests](https://github.com/abaire/nxdk_pgraph_tests) project to
|
|
45
|
+
exercise the NV2A 3D accelerator on the original Microsoft Xbox. The runner is
|
|
46
|
+
intended to be used with an emulator (e.g., [xemu](https://xemu.app)) and is
|
|
47
|
+
able to detect and recover from crashes.
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
### Prerequisites
|
|
52
|
+
|
|
53
|
+
* Docker - required
|
|
54
|
+
* An xbox emulator (e.g., [xemu](https://xemu.app)) - required
|
|
55
|
+
|
|
56
|
+
### pip installation
|
|
57
|
+
|
|
58
|
+
```console
|
|
59
|
+
# Optionally create a virtual env
|
|
60
|
+
# pip -m venv .venv
|
|
61
|
+
# source .venv/bin/activate
|
|
62
|
+
|
|
63
|
+
pip install nxdk-pgraph-test-runner
|
|
64
|
+
|
|
65
|
+
nxdk-pgraph-test-runner --help
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
70
|
+
A default config may be generated by running the `nxdk-pgraph-test-runner`
|
|
71
|
+
command.
|
|
72
|
+
|
|
73
|
+
### Emulator command line
|
|
74
|
+
|
|
75
|
+
`"emulator_command = /path/to/emulator {ISO}"`
|
|
76
|
+
|
|
77
|
+
The command may utilize the following macros:
|
|
78
|
+
|
|
79
|
+
* `{ISO}` - Replaced with the path to the `nxdk_pgraph_tests.iso` xiso file.
|
|
80
|
+
|
|
81
|
+
### Example invocation
|
|
82
|
+
|
|
83
|
+
This is a sample invocation that will run xemu against a previously downloaded
|
|
84
|
+
nxdk_pgraph_tests iso. It will create a `results` directory with the results of
|
|
85
|
+
the tests.
|
|
86
|
+
|
|
87
|
+
```shell
|
|
88
|
+
nxdk-pgraph-test-runner \
|
|
89
|
+
--override-ftp-ip 10.0.2.2 \
|
|
90
|
+
--iso-path ~/nxdk_pgraph_tests_xiso.iso \
|
|
91
|
+
--emulator-command "/path/to/xemu -dvd_path \"{ISO}\"" \
|
|
92
|
+
-I lo0
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This assumes that xemu is configured to use NAT networking, so the IP reported
|
|
96
|
+
to the pgraph tester is set to the qemu `10.0.2.2` host address and the loopback
|
|
97
|
+
interface (-I `lo0`) is used.
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
`nxdk-pgraph-test-runner` is distributed under the terms of
|
|
102
|
+
the [MIT](https://spdx.org/licenses/MIT.html) license.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# nxdk-pgraph-test-runner
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/nxdk-pgraph-test-runner)
|
|
4
|
+
[](https://pypi.org/project/nxdk-pgraph-test-runner)
|
|
5
|
+
|
|
6
|
+
-----
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [Configuration](#configuration)
|
|
12
|
+
- [License](#license)
|
|
13
|
+
|
|
14
|
+
## Purpose
|
|
15
|
+
|
|
16
|
+
This test harness utilizes
|
|
17
|
+
the [nxdk_pgraph_tests](https://github.com/abaire/nxdk_pgraph_tests) project to
|
|
18
|
+
exercise the NV2A 3D accelerator on the original Microsoft Xbox. The runner is
|
|
19
|
+
intended to be used with an emulator (e.g., [xemu](https://xemu.app)) and is
|
|
20
|
+
able to detect and recover from crashes.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
### Prerequisites
|
|
25
|
+
|
|
26
|
+
* Docker - required
|
|
27
|
+
* An xbox emulator (e.g., [xemu](https://xemu.app)) - required
|
|
28
|
+
|
|
29
|
+
### pip installation
|
|
30
|
+
|
|
31
|
+
```console
|
|
32
|
+
# Optionally create a virtual env
|
|
33
|
+
# pip -m venv .venv
|
|
34
|
+
# source .venv/bin/activate
|
|
35
|
+
|
|
36
|
+
pip install nxdk-pgraph-test-runner
|
|
37
|
+
|
|
38
|
+
nxdk-pgraph-test-runner --help
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Configuration
|
|
42
|
+
|
|
43
|
+
A default config may be generated by running the `nxdk-pgraph-test-runner`
|
|
44
|
+
command.
|
|
45
|
+
|
|
46
|
+
### Emulator command line
|
|
47
|
+
|
|
48
|
+
`"emulator_command = /path/to/emulator {ISO}"`
|
|
49
|
+
|
|
50
|
+
The command may utilize the following macros:
|
|
51
|
+
|
|
52
|
+
* `{ISO}` - Replaced with the path to the `nxdk_pgraph_tests.iso` xiso file.
|
|
53
|
+
|
|
54
|
+
### Example invocation
|
|
55
|
+
|
|
56
|
+
This is a sample invocation that will run xemu against a previously downloaded
|
|
57
|
+
nxdk_pgraph_tests iso. It will create a `results` directory with the results of
|
|
58
|
+
the tests.
|
|
59
|
+
|
|
60
|
+
```shell
|
|
61
|
+
nxdk-pgraph-test-runner \
|
|
62
|
+
--override-ftp-ip 10.0.2.2 \
|
|
63
|
+
--iso-path ~/nxdk_pgraph_tests_xiso.iso \
|
|
64
|
+
--emulator-command "/path/to/xemu -dvd_path \"{ISO}\"" \
|
|
65
|
+
-I lo0
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This assumes that xemu is configured to use NAT networking, so the IP reported
|
|
69
|
+
to the pgraph tester is set to the qemu `10.0.2.2` host address and the loopback
|
|
70
|
+
interface (-I `lo0`) is used.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
`nxdk-pgraph-test-runner` is distributed under the terms of
|
|
75
|
+
the [MIT](https://spdx.org/licenses/MIT.html) license.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# To enable this hook, rename this file to "pre-commit" and copy into the
|
|
4
|
+
# ../.git/hooks directory.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function check_no_diffmarkers_or_whitespace_errors {
|
|
8
|
+
# If there are whitespace errors, print the offending file names and fail.
|
|
9
|
+
set -e
|
|
10
|
+
git diff-index --check --cached "${1}" --
|
|
11
|
+
set +e
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
function reformat {
|
|
16
|
+
# Reformat the files in-place and re-add any that were changed.
|
|
17
|
+
#
|
|
18
|
+
# Note that this has the side effect of incorporating changes to staged files
|
|
19
|
+
# that were not themselves staged. E.g., if you edit a file, `git add`, then
|
|
20
|
+
# edit some more, then commit, all of the changes will be committed, not just
|
|
21
|
+
# the staged ones. Depending on typical workflows it might be better to do
|
|
22
|
+
# something more complicated here, or to just have the hook fail instead of
|
|
23
|
+
# perform an in-place fix.
|
|
24
|
+
local files_to_format="$(echo "${changed_python_filenames}" | grep -v '3rdparty')"
|
|
25
|
+
if [[ -n "${files_to_format}" ]]; then
|
|
26
|
+
hatch fmt
|
|
27
|
+
hatch run types:check
|
|
28
|
+
|
|
29
|
+
echo "${files_to_format}" | xargs git add
|
|
30
|
+
fi
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function check_no_donotsubmit {
|
|
34
|
+
local filenames="$1"
|
|
35
|
+
|
|
36
|
+
if [[ -z "${filenames}" ]]; then
|
|
37
|
+
return
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
set +e
|
|
41
|
+
output="$(grep -H -ni 'DONOTSUBMIT' -- "$1" 2>/dev/null)"
|
|
42
|
+
found=$?
|
|
43
|
+
set -e
|
|
44
|
+
|
|
45
|
+
if [[ $found -eq 0 ]]; then
|
|
46
|
+
echo "${output}"
|
|
47
|
+
echo "DONOTSUBMIT tag found, aborting"
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
|
54
|
+
against=HEAD
|
|
55
|
+
else
|
|
56
|
+
# Initial commit: diff against an empty tree object
|
|
57
|
+
against=$(git hash-object -t tree /dev/null)
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Redirect output to stderr.
|
|
61
|
+
exec 1>&2
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
added_and_modified_filenames="$(git diff --cached --name-only --diff-filter=d)"
|
|
65
|
+
changed_python_filenames="$(echo "${added_and_modified_filenames}" | \
|
|
66
|
+
grep -E '.*\.py$')"
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# Allow blank line at EOF.
|
|
70
|
+
git config --local core.whitespace -blank-at-eof
|
|
71
|
+
|
|
72
|
+
reformat
|
|
73
|
+
|
|
74
|
+
check_no_donotsubmit "${changed_python_filenames}"
|
|
75
|
+
check_no_diffmarkers_or_whitespace_errors "${against}"
|
|
76
|
+
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nxdk-pgraph-test-runner"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = 'Executes and captures the results of https://github.com/abaire/nxdk_pgraph_tests in an emulator'
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
keywords = ["xemu", "nv2a", "xbox", "pgraph"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Erik Abair", email = "erik.abair@bearbrains.work" },
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Programming Language :: Python",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
22
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"docker~=7.1.0",
|
|
26
|
+
"platformdirs~=4.3.6",
|
|
27
|
+
"tomli_w~=1.2.0",
|
|
28
|
+
"pyfatx~=0.0.7",
|
|
29
|
+
"ifaddr~=0.2.0",
|
|
30
|
+
"mergedeep~=1.3.4",
|
|
31
|
+
"pyftpdlib~=2.0.1",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Documentation = "https://github.com/abaire/nxdk-pgraph-test-runner#readme"
|
|
36
|
+
Issues = "https://github.com/abaire/nxdk-pgraph-test-runner/issues"
|
|
37
|
+
Source = "https://github.com/abaire/nxdk-pgraph-test-runner"
|
|
38
|
+
|
|
39
|
+
[project.scripts]
|
|
40
|
+
nxdk-pgraph-test-runner = "nxdk_pgraph_test_runner:run"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.version]
|
|
43
|
+
path = "src/nxdk_pgraph_test_runner/__about__.py"
|
|
44
|
+
|
|
45
|
+
[tool.hatch.envs.types]
|
|
46
|
+
type = "virtual"
|
|
47
|
+
path = ".venv-mypy"
|
|
48
|
+
extra-dependencies = [
|
|
49
|
+
"pip",
|
|
50
|
+
"mypy>=1.0.0",
|
|
51
|
+
]
|
|
52
|
+
[tool.hatch.envs.types.scripts]
|
|
53
|
+
check = "mypy --install-types --non-interactive {args:src/nxdk_pgraph_test_runner tests}"
|
|
54
|
+
|
|
55
|
+
[tool.mypy]
|
|
56
|
+
disable_error_code = ["import-untyped", "import-not-found"]
|
|
57
|
+
|
|
58
|
+
[tool.coverage.run]
|
|
59
|
+
source_pkgs = ["nxdk_pgraph_test_runner", "tests"]
|
|
60
|
+
branch = true
|
|
61
|
+
parallel = true
|
|
62
|
+
omit = [
|
|
63
|
+
"src/nxdk_pgraph_test_runner/__about__.py",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[tool.coverage.paths]
|
|
67
|
+
nxdk_pgraph_test_runner = ["src/nxdk_pgraph_test_runner", "*/nxdk-pgraph-test-runner/src/nxdk_pgraph_test_runner"]
|
|
68
|
+
tests = ["tests", "*/nxdk-pgraph-test-runner/tests"]
|
|
69
|
+
|
|
70
|
+
[tool.coverage.report]
|
|
71
|
+
exclude_lines = [
|
|
72
|
+
"no cov",
|
|
73
|
+
"if __name__ == .__main__.:",
|
|
74
|
+
"if TYPE_CHECKING:",
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
[tool.hatch.envs.default]
|
|
78
|
+
type = "virtual"
|
|
79
|
+
path = "venv"
|
|
80
|
+
|
|
81
|
+
[tool.hatch.envs.hatch-test]
|
|
82
|
+
type = "virtual"
|
|
83
|
+
path = "venv"
|
|
84
|
+
extra-dependencies = [
|
|
85
|
+
"pytest",
|
|
86
|
+
]
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025-present Erik Abair <erik.abair@bearbrains.work>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
# ruff: noqa: T201 `print` found
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import logging
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
from platformdirs import user_config_dir
|
|
15
|
+
|
|
16
|
+
from nxdk_pgraph_test_runner._config import Config
|
|
17
|
+
from nxdk_pgraph_test_runner.runner import entrypoint
|
|
18
|
+
|
|
19
|
+
logger = logging.getLogger(__name__)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def run():
|
|
23
|
+
"""Parses program arguments and executes the runner."""
|
|
24
|
+
default_config_path = os.path.join(user_config_dir("nxdk-pgraph-test-runner"), "config.toml")
|
|
25
|
+
|
|
26
|
+
parser = argparse.ArgumentParser()
|
|
27
|
+
parser.add_argument("-c", "--config", help="Path to the runner config file.", default=default_config_path)
|
|
28
|
+
parser.add_argument(
|
|
29
|
+
"--emulator-commandline",
|
|
30
|
+
help=(
|
|
31
|
+
"String used to launch the Xbox emulator. A `${ISO}` parameter will be replaced with the path to the "
|
|
32
|
+
"tester xiso."
|
|
33
|
+
),
|
|
34
|
+
)
|
|
35
|
+
parser.add_argument("--iso-path", help="Path to the nxdk_pgraph_tests.iso xiso file.")
|
|
36
|
+
parser.add_argument("--no-save-config", "-N", action="store_true", help="Do not update the config file.")
|
|
37
|
+
parser.add_argument(
|
|
38
|
+
"--override-ftp-ip",
|
|
39
|
+
help="Use the given IP instead of the local IP when configuring the pgraph runner for artifact reporting.",
|
|
40
|
+
)
|
|
41
|
+
parser.add_argument(
|
|
42
|
+
"--ftp-ip",
|
|
43
|
+
help="Bind the FTP server to the given local IP.",
|
|
44
|
+
)
|
|
45
|
+
parser.add_argument(
|
|
46
|
+
"--ftp-interface",
|
|
47
|
+
"-I",
|
|
48
|
+
help="Bind the FTP server to the given network interface (e.g., lo0).",
|
|
49
|
+
)
|
|
50
|
+
parser.add_argument(
|
|
51
|
+
"--xbox-artifact-path",
|
|
52
|
+
"-P",
|
|
53
|
+
default="e:/nxdk_pgraph_tests",
|
|
54
|
+
help="Xbox path into which test artifacts will be written",
|
|
55
|
+
)
|
|
56
|
+
parser.add_argument(
|
|
57
|
+
"--verbose",
|
|
58
|
+
"-v",
|
|
59
|
+
help="Enables verbose logging information",
|
|
60
|
+
action="store_true",
|
|
61
|
+
)
|
|
62
|
+
parser.add_argument(
|
|
63
|
+
"--timeout-seconds",
|
|
64
|
+
"-T",
|
|
65
|
+
help="Maximum period of time to execute the emulator before considering everything failed.",
|
|
66
|
+
type=int,
|
|
67
|
+
)
|
|
68
|
+
parser.add_argument(
|
|
69
|
+
"--work-dir",
|
|
70
|
+
"-W",
|
|
71
|
+
help="Host directory used to store temporary data",
|
|
72
|
+
)
|
|
73
|
+
parser.add_argument(
|
|
74
|
+
"--output-dir",
|
|
75
|
+
"-o",
|
|
76
|
+
help="Host directory used to store results of the runner",
|
|
77
|
+
)
|
|
78
|
+
parser.add_argument(
|
|
79
|
+
"--test-failure-retries",
|
|
80
|
+
"-r",
|
|
81
|
+
default=1,
|
|
82
|
+
help="Number of times to retry failed tests before considering them permanently failed",
|
|
83
|
+
type=int,
|
|
84
|
+
)
|
|
85
|
+
args = parser.parse_args()
|
|
86
|
+
|
|
87
|
+
log_level = logging.DEBUG if args.verbose else logging.INFO
|
|
88
|
+
logging.basicConfig(level=log_level)
|
|
89
|
+
|
|
90
|
+
config = Config.load(args.config)
|
|
91
|
+
if not config:
|
|
92
|
+
print("Using default config")
|
|
93
|
+
config = Config()
|
|
94
|
+
|
|
95
|
+
if args.emulator_commandline:
|
|
96
|
+
config.set_emulator_command(args.emulator_commandline)
|
|
97
|
+
if args.iso_path:
|
|
98
|
+
config.iso_path = args.iso_path
|
|
99
|
+
if args.ftp_ip:
|
|
100
|
+
config.ftp_ip = args.ftp_ip
|
|
101
|
+
if args.ftp_interface:
|
|
102
|
+
config.ftp_preferred_interface = args.ftp_interface
|
|
103
|
+
if args.override_ftp_ip:
|
|
104
|
+
config.ftp_ip_override = args.override_ftp_ip
|
|
105
|
+
if args.timeout_seconds:
|
|
106
|
+
config.timeout_seconds = args.timeout_seconds
|
|
107
|
+
if args.work_dir:
|
|
108
|
+
config.set_work_dir = args.work_dir
|
|
109
|
+
if args.output_dir:
|
|
110
|
+
config.set_output_dir = args.output_dir
|
|
111
|
+
config.test_failure_retries = args.test_failure_retries
|
|
112
|
+
config.xbox_artifact_path = args.xbox_artifact_path
|
|
113
|
+
|
|
114
|
+
if not args.no_save_config:
|
|
115
|
+
logger.debug("Updating config file at %s", args.config)
|
|
116
|
+
config.store(args.config)
|
|
117
|
+
|
|
118
|
+
sys.exit(entrypoint(config))
|