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
feat(test_runner): Move integration test setup script to python.
Replace the shell-based test setup (run_functional.sh) with a Python
module (tests/test_framework/setup.py) that implements the same approach:
build or download utreexod and bitcoind, and always build florestad,
before running the test suite.
The test runner (tests/test_runner.py) becomes the single entry point,
keeping the flags: --force-rebuild, --release, and --preserve-data-dir.
Also updates doc/running-tests.md accordingly.
just test-functional "-t floresta-cli -k getblock"
98
98
```
99
99
100
-
#### From helper script
100
+
#### From the test runner directly
101
101
102
-
We provide a single helper script [run_functional.sh](https://github.com/vinteumorg/Floresta/blob/master/tests/run_functional.sh) that checks build dependencies, builds all required binaries, and runs the tests.
102
+
The test runner handles everything: checking dependencies, building binaries, and running the suite.
103
103
104
104
Basic usage:
105
105
106
106
```bash
107
-
./tests/run_functional.sh
107
+
uv run tests/test_runner.py
108
108
```
109
109
110
110
##### Utreexod
111
111
112
-
By default, the script will build `utreexod` at the `v0.4.0` tag.
112
+
By default, the runner will build `utreexod` at the `v0.4.0` tag.
113
113
If you want to build a specific release, set the `UTREEXOD_REVISION` environment variable.
114
114
It must be a [valid tag](https://github.com/utreexo/utreexod/tags). For example:
UTREEXOD_REVISION=v0.3.0 uv run tests/test_runner.py
118
118
```
119
119
120
120
##### Bitcoin-core
121
121
122
-
By default, the setup script will obtain a runnable `bitcoind` binary in one of three exclusive ways. The default Bitcoin Core version is `30.2`, but you can override this by setting the `BITCOIN_REVISION` environment variable. The three methods are:
123
-
124
-
1.**Using a user-provided binary**: If the `BITCOIND_EXE` environment variable is set and points to an executable, that exact binary is used. No download or build is attempted, and any `BITCOIN_REVISION` or build-parallelism settings are ignored.
122
+
By default, the runner will download a prebuilt `bitcoind` (v30.2). If you want to use a different version, configure it with the `BITCOIN_REVISION` environment variable. Also, if you need to change the number of CPU cores for source builds, use
BITCOIN_REVISION=28.0 BUILD_BITCOIND_NPROCS=2 uv run tests/test_runner.py
128
127
```
129
128
130
-
2.**Downloading a prebuilt binary**: If `BITCOIND_EXE` is not set, the script will try to download a prebuilt Bitcoin Core tarball for the specified `BITCOIN_REVISION`. Prebuilt binaries are available for all platforms and operating systems supported by Bitcoin Core. The supported versions are `30.2`, `29.2`, `28.3` and `27.2`.
129
+
Additionally, you can use some flags:
131
130
132
131
```bash
133
-
BITCOIN_REVISION=28.3 ./tests/run_functional.sh
132
+
uv run tests/test_runner.py --force-rebuild --preserve-data-dir
134
133
```
135
134
136
-
3.**Building from source**: If no prebuilt binary is available for the platform, operating system, or specified version, the script will clone the Bitcoin Core repository and build `bitcoind` from the specified `BITCOIN_REVISION`. This can be a version tag (e.g., `29.1`) or a branch(e.g., `master`) from the remote repository.
137
-
138
-
````bash
139
-
BITCOIN_REVISION=master ./tests/run_functional.sh
140
-
141
-
Also, if you need to change the number of CPU cores forsource builds, use
142
-
`BUILD_BITCOIND_NPROCS`. For example:
143
-
144
-
```bash
145
-
BUILD_BITCOIND_NPROCS=2 ./tests/run_functional.sh
146
-
````
147
-
148
-
Additionally, you can use some flags:
149
-
150
-
The `--build` argument will force the script to fetch the `bitcoind` binary again and to build the `utreexod`.
151
-
152
-
The `--release` argument will build the `florestad` binary in release mode, which is optimized forproduction use. If this flag is not provided, the binary will be builtin debug mode by default.
153
-
154
-
The `--preserve-data-dir` argument will keep the data and logs directories after successfully running the tests
135
+
The `--force-rebuild` flag will force the runner to rebuild all binaries even if they are already present.
136
+
The `--release` flag will build florestad in release mode (default is debug).
137
+
The `--preserve-data-dir` flag will keep the data and logs directories after running the tests
155
138
(this is useful if you want to keep the data for debugging purposes).
156
139
157
140
Furthermore, you can run a set of specific tests, rather than all at once.
3. Run the tests. The runner will detect existing binaries and skip building:
244
206
245
207
```bash
246
-
uv run pylint ./tests
208
+
uv run tests/test_runner.py
247
209
```
248
210
249
-
##### Run tests from python utility directly
250
-
251
-
Our tests are separated by "test suites". Suites are folders located in`./tests/<suite>` and the tests are the `./tests/<suite>/*-test.py` files. To run all suites, type:
211
+
You can also point directly to external executables without copying:
252
212
253
213
```bash
254
-
FLORESTA_TEMP_DIR=<your_bin_dir> uv run tests/test_runner.py
0 commit comments