You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+80-36Lines changed: 80 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,8 +51,8 @@ but doesn't know that there's someone working on it.
51
51
52
52
Note that you must contribute all your changes under the MIT License. If you are
53
53
just modifying a file, you don't need to do anything (maybe update the copyright
54
-
years). If you are adding new files, you need to use the`SPDX-License-Identifier: MIT`
55
-
header.
54
+
years). If you are adding new files, you need to use the
55
+
`SPDX-License-Identifier: MIT`header.
56
56
57
57
1. Fork this repository.
58
58
2. Checkout the `master` branch.
@@ -63,71 +63,97 @@ header.
63
63
new warning (but it may be possible to remove some warning checks if it makes
64
64
the code much easier).
65
65
5. Test your changes by running `./run-tests.sh` in the `test` directory.
66
-
(You must run `./fetch-test-deps.sh` first; if you forget to, the test suite will fail and remind you mid-way.)
66
+
(You must run `./fetch-test-deps.sh` first; if you forget to, the test suite
67
+
will fail and remind you mid-way.)
67
68
5. Format your changes according to `clang-format`, which will reformat the
68
69
coding style according to our standards defined in `.clang-format`.
69
70
6. Create a pull request against the branch `master`.
70
-
7. Be prepared to get some comments about your code and to modify it. Tip: Use
71
+
7. Check the results of the GitHub Actions CI jobs for your pull request. The
72
+
"Code format checking" and "Regression testing" jobs should all succeed.
73
+
The "Diff completeness check" and "Static analysis" jobs should be manually
74
+
checked, as they may output warnings which do not count as failure errors.
75
+
The "Code coverage report" provides an
76
+
[LCOV](https://github.com/linux-test-project/lcov)-generated report which
77
+
can be downloaded and checked to see if your new code has full test coverage.
78
+
8. Be prepared to get some comments about your code and to modify it. Tip: Use
71
79
`git rebase -i origin/master` to modify chains of commits.
72
80
73
81
## Adding a test
74
82
75
-
The test suite is a little ad-hoc, so the way tests work is different for each program being tested.
83
+
The test suite is a little ad-hoc, so the way tests work is different for each
84
+
program being tested.
76
85
77
-
Feel free to modify how the test scripts work, if the thing you want to test doesn't fit the existing scheme(s).
86
+
Feel free to modify how the test scripts work, if the thing you want to test
87
+
doesn't fit the existing scheme(s).
78
88
79
89
### RGBASM
80
90
81
91
Each `.asm` file corresponds to one test.
82
92
RGBASM will be invoked on the `.asm` file with all warnings enabled.
83
93
84
-
If a `.out` file exists, RGBASM's output (`print`, `println`, etc.) must match its contents.
85
-
If a `.err` file exists, RGBASM's error output (`warn`, errors, etc.) must match its contents.
94
+
If a `.out` file exists, RGBASM's output (`print`, `println`, etc.) must match
95
+
its contents.
96
+
If a `.err` file exists, RGBASM's error output (`warn`, errors, etc.) must match
97
+
its contents.
86
98
87
-
If a `.out.bin` file exists, the object file will be linked, and the generated ROM truncated to the length of the `.out.bin` file.
99
+
If a `.out.bin` file exists, the object file will be linked, and the generated
100
+
ROM truncated to the length of the `.out.bin` file.
88
101
After that, the ROM must match the `.out.bin` file.
89
102
90
103
### RGBLINK
91
104
92
105
Each `.asm` file corresponds to one test, or one *set* of tests.
93
106
94
-
All tests begin by assembling the `.asm` file into an object file, which will be linked in various ways depending on the test.
107
+
All tests begin by assembling the `.asm` file into an object file, which will be
108
+
linked in various ways depending on the test.
95
109
96
110
#### Simple tests
97
111
98
112
These simply check that RGBLINK's output matches some expected output.
99
113
100
-
A `.out` file **must** exist, and RGBLINK's total output must match that file's contents.
114
+
A `.out` file **must** exist, and RGBLINK's total output must match that file's
115
+
contents.
101
116
102
-
Additionally, if a `.out.bin` file exists, the `.gb` file generated by RGBLINK must match it.
117
+
Additionally, if a `.out.bin` file exists, the `.gb` file generated by RGBLINK
118
+
must match it.
103
119
104
120
#### Linker script tests
105
121
106
122
These allow applying various linker scripts to the same object file.
107
-
If one or more `.link` files exist, whose names start the same as the `.asm` file, then each of those files correspond to one test.
123
+
If one or more `.link` files exist, whose names start the same as the `.asm`
124
+
file, then each of those files correspond to one test.
108
125
109
-
Each `.link` linker script **must** be accompanied by a `.out` file, and RGBLINK's total output must match that file's contents when passed the corresponding linker script.
126
+
Each `.link` linker script **must** be accompanied by a `.out` file, and
127
+
RGBLINK's total output must match that file's contents when passed the
128
+
corresponding linker script.
110
129
111
130
#### Variant tests
112
131
113
132
These allow testing RGBLINK's `-d`, `-t`, and `-w` flags.
114
-
If one or more <code>-<var><flag></var>.out</code> or <code>-no-<var><flag></var>.out</code> files exist, then each of them corresponds to one test.
133
+
If one or more
134
+
<code>-<var><flag></var>.out</code> or <code>-no-<var><flag></var>.out</code>
135
+
files exist, then each of them corresponds to one test.
115
136
116
-
The object file will be linked with and without said flag, respectively; and in each case, RGBLINK's total output must match the `.out` file's contents.
137
+
The object file will be linked with and without said flag, respectively; and in
138
+
each case, RGBLINK's total output must match the `.out` file's contents.
117
139
118
140
### RGBFIX
119
141
120
142
Each `.flags` file corresponds to one test.
121
143
Each one is a text file whose first line contains flags to pass to RGBFIX.
122
-
(There may be more lines, which will be ignored; they can serve as comments to explain what the test is about.)
144
+
(There may be more lines, which will be ignored; they can serve as comments to
145
+
explain what the test is about.)
123
146
124
-
RGBFIX will be invoked on the `.bin` file if it exists, or else on default-input.bin.
147
+
RGBFIX will be invoked on the `.bin` file if it exists, or else on
148
+
default-input.bin.
125
149
126
150
If no `.out` file exist, RGBFIX is not expected to output anything.
127
151
If one *does* exist, RGBFIX's output **must** match the `.out` file's contents.
128
152
129
-
If no `.err` file exists, RGBFIX is simply expected to be able to process the file normally.
130
-
If one *does* exist, RGBFIX's return status is ignored, but its error output **must** match the `.err` file's contents.
153
+
If no `.err` file exists, RGBFIX is simply expected to be able to process the
154
+
file normally.
155
+
If one *does* exist, RGBFIX's return status is ignored, but its error output
156
+
**must** match the `.err` file's contents.
131
157
132
158
Additionally, if a `.gb` file exists, the output of RGBFIX must match the `.gb`.
133
159
@@ -139,20 +165,27 @@ There are three kinds of test.
139
165
140
166
Each `.png` file corresponds to one test.
141
167
RGBGFX will be invoked on the file.
142
-
If a `.flags` file exists, it will be used as part of the RGBGFX invocation (<code>@<var><file></var>.flags</code>).
168
+
If a `.flags` file exists, it will be used as part of the RGBGFX invocation
169
+
(<code>@<var><file></var>.flags</code>).
143
170
144
-
If `.out.1bpp`, `.out.2bpp`, `.out.pal`, `.out.tilemap`, `.out.attrmap`, or `.out.palmap` files exist, RGBGFX will create the corresponding kind of output, which must match the file's contents.
171
+
If `.out.1bpp`, `.out.2bpp`, `.out.pal`, `.out.tilemap`, `.out.attrmap`, or
172
+
`.out.palmap` files exist, RGBGFX will create the corresponding kind of output,
173
+
which must match the file's contents.
145
174
Multiple kinds of output may be tested for the same input.
146
175
147
-
If no `.err` file exists, RGBGFX is simply expected to be able to process the file normally.
148
-
If one *does* exist, RGBGFX's return status is ignored, but its output **must** match the `.err` file's contents.
176
+
If no `.err` file exists, RGBGFX is simply expected to be able to process the
177
+
file normally.
178
+
If one *does* exist, RGBGFX's return status is ignored, but its output **must**
179
+
match the `.err` file's contents.
149
180
150
181
#### Reverse tests
151
182
152
183
Each `.1bpp` or `.2bpp` file corresponds to one test.
153
-
RGBGFX will be invoked on the file with `-r 1` for reverse mode, then invoked on the output without `-r 1`.
184
+
RGBGFX will be invoked on the file with `-r 1` for reverse mode, then invoked on
185
+
the output without `-r 1`.
154
186
The round-trip output must match the input file's contents.
155
-
If a `.flags` file exists, it will be used as part of the RGBGFX invocation (<code>@<var><file></var>.flags</code>).
187
+
If a `.flags` file exists, it will be used as part of the RGBGFX invocation
188
+
(<code>@<var><file></var>.flags</code>).
156
189
157
190
#### Random seed tests
158
191
@@ -161,30 +194,41 @@ Each one is a binary RNG file which is passed to the `rgbgfx_test` program.
161
194
162
195
### Downstream projects
163
196
164
-
1. Make sure the downstream project supports <code>make <var><target></var> RGBDS=<var><path/to/RGBDS/></var></code>.
165
-
While the test suite supports any Make target name, only [Make](//gnu.org/software/make) is currently supported, and the Makefile must support a `RGBDS` variable to use a non-system RGBDS directory.
While the test suite supports any Make target name, only
200
+
[Make](//gnu.org/software/make) is currently supported, and the Makefile must
201
+
support a `RGBDS` variable to use a non-system RGBDS directory.
202
+
167
203
Also, only projects hosted on GitHub are currently supported.
168
-
2. Add the project to `test/fetch-test-deps.sh`: add a new `action` line at the bottom, following the existing pattern:
204
+
2. Add the project to `test/fetch-test-deps.sh`: add a new `action` line at the
205
+
bottom, following the existing pattern:
169
206
170
207
```sh
171
208
action <owner><repo><date of last commit><hash of last commit>
172
209
```
173
-
174
-
(The date is used to avoid fetching too much history when cloning the repositories.)
175
-
3. Add the project to `test/run-tests.sh`: add a new `test_downstream` line at the bottom, following the existing pattern:
176
-
210
+
211
+
(The date is used to avoid fetching too much history when cloning the
212
+
repositories.)
213
+
3. Add the project to `test/run-tests.sh`: add a new `test_downstream` line at
214
+
the bottom, following the existing pattern:
215
+
177
216
```sh
178
217
test_downstream <owner><repo><makefile target><build file><sha1 hash of build file>
179
218
```
180
219
181
220
## Container images
182
221
183
-
The CI will [take care](https://github.com/gbdev/rgbds/blob/master/.github/workflows/build-container.yml) of updating the [rgbds container](https://github.com/gbdev/rgbds/pkgs/container/rgbds) image tagged `master`.
0 commit comments