-
Notifications
You must be signed in to change notification settings - Fork 25
150 lines (127 loc) · 4.48 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# SPDX-FileCopyrightText: AISEC Pentesting Team
#
# SPDX-License-Identifier: CC0-1.0
# https://github.com/actions/setup-python/issues/374
#
name: tests
on:
push:
branches:
- master
pull_request:
paths:
- '.github/**'
- 'src/**'
- 'tests/**'
jobs:
pytest:
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: Gr1N/setup-poetry@v9
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-${{ hashFiles('pyproject.toml') }}
- name: Install Dependencies
run: |
poetry install
- name: Run pytest
run: |
poetry run make pytest
bats:
strategy:
fail-fast: false
runs-on: ubuntu-latest
container: debian:stable
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-${{ hashFiles('pyproject.toml') }}
- name: Install Dependencies
run: |
apt-get update -y && apt-get install -y bats python3 python3-poetry jq
poetry install
- name: Run bats
run: |
poetry run make bats
>>>>>>> 01e0e10 (tests: Add end to end tests with bats)
vecu:
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: Gr1N/setup-poetry@v9
- uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-${{ hashFiles('pyproject.toml') }}
- name: Install Dependencies
run: |
poetry install
- name: Spawn vECU
run: |
poetry run gallia script vecu "unix-lines:///tmp/vecu.sock" rng --seed 3 --mandatory_sessions "[1, 2, 3]" --mandatory_services "[DiagnosticSessionControl, EcuReset, ReadDataByIdentifier, WriteDataByIdentifier, RoutineControl, SecurityAccess, ReadMemoryByAddress, WriteMemoryByAddress, RequestDownload, RequestUpload, TesterPresent, ReadDTCInformation, ClearDiagnosticInformation, InputOutputControlByIdentifier]" &
- name: Add config
run: |
echo "[gallia]" > gallia.toml
echo "[gallia.scanner]" >> gallia.toml
echo 'target = "unix-lines:///tmp/vecu.sock"' >> gallia.toml
echo 'dumpcap = false' >> gallia.toml
echo "[gallia.protocols.uds]" >> gallia.toml
echo 'ecu_reset = 0x01' >> gallia.toml
- name: Dump Config and Defaults
run: |
poetry run gallia --show-config
poetry run gallia --show-defaults
- name: Test scan-services
run: |
poetry run gallia scan uds services --sessions 1 2 --check-session
- name: Test scan-sessions
run: |
poetry run gallia scan uds sessions --depth 2
poetry run gallia scan uds sessions --fast
- name: Test scan-identifiers
run: |
poetry run gallia scan uds identifiers --start 0 --end 100 --sid 0x22
poetry run gallia scan uds identifiers --start 0 --end 100 --sid 0x2e
poetry run gallia scan uds identifiers --start 0 --end 100 --sid 0x31
- name: Test scan-reset
run: |
poetry run gallia scan uds reset
- name: Test scan-dump-seeds
run: |
poetry run gallia scan uds dump-seeds --duration 0.01 --level 0x2f
- name: Test scan-memory-functions
run: |
for sid in 0x23 0x34 0x35 0x3d; do
poetry run gallia scan uds memory --sid "$sid"
done
- name: Test UDS primitives
run: |
poetry run gallia primitive uds ecu-reset
poetry run gallia primitive uds vin
poetry run gallia primitive uds ping --count 2
poetry run gallia primitive uds rdbi 0x108d
poetry run gallia primitive uds pdu 1001
poetry run gallia primitive uds wdbi 0x2266 --data 00
poetry run gallia primitive uds dtc read
poetry run gallia primitive uds dtc clear
poetry run gallia primitive uds dtc control --stop
poetry run gallia primitive uds dtc control --resume
poetry run gallia primitive uds iocbi 0x1000 reset-to-default