Skip to content

Commit 2f84ad7

Browse files
committed
docs: add ramdisk guide for running tests on OSX
1 parent a245429 commit 2f84ad7

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

test/README.md

+32-9
Original file line numberDiff line numberDiff line change
@@ -109,34 +109,57 @@ how many jobs to run, append `--jobs=n`
109109
The individual tests and the test_runner harness have many command-line
110110
options. Run `test/functional/test_runner.py -h` to see them all.
111111

112-
#### Speed up test runs with a ramdisk
112+
#### Speed up test runs with a RAM disk
113113

114-
If you have available RAM on your system you can create a ramdisk to use as the `cache` and `tmp` directories for the functional tests in order to speed them up.
115-
Speed-up amount varies on each system (and according to your ram speed and other variables), but a 2-3x speed-up is not uncommon.
114+
If you have available RAM on your system you can create a RAM disk to use as the `cache` and `tmp` directories for the functional tests in order to speed them up.
115+
Speed-up amount varies on each system (and according to your RAM speed and other variables), but a 2-3x speed-up is not uncommon.
116116

117-
To create a 4GB ramdisk on Linux at `/mnt/tmp/`:
117+
**Linux**
118+
119+
To create a 4 GiB RAM disk at `/mnt/tmp/`:
118120

119121
```bash
120122
sudo mkdir -p /mnt/tmp
121123
sudo mount -t tmpfs -o size=4g tmpfs /mnt/tmp/
122124
```
123125

124-
Configure the size of the ramdisk using the `size=` option.
125-
The size of the ramdisk needed is relative to the number of concurrent jobs the test suite runs.
126-
For example running the test suite with `--jobs=100` might need a 4GB ramdisk, but running with `--jobs=32` will only need a 2.5GB ramdisk.
126+
Configure the size of the RAM disk using the `size=` option.
127+
The size of the RAM disk needed is relative to the number of concurrent jobs the test suite runs.
128+
For example running the test suite with `--jobs=100` might need a 4 GiB RAM disk, but running with `--jobs=32` will only need a 2.5 GiB RAM disk.
127129

128-
To use, run the test suite specifying the ramdisk as the `cachedir` and `tmpdir`:
130+
To use, run the test suite specifying the RAM disk as the `cachedir` and `tmpdir`:
129131

130132
```bash
131133
test/functional/test_runner.py --cachedir=/mnt/tmp/cache --tmpdir=/mnt/tmp
132134
```
133135

134-
Once finished with the tests and the disk, and to free the ram, simply unmount the disk:
136+
Once finished with the tests and the disk, and to free the RAM, simply unmount the disk:
135137

136138
```bash
137139
sudo umount /mnt/tmp
138140
```
139141

142+
**macOS**
143+
144+
To create a 4 GiB RAM disk named "ramdisk" at `/Volumes/ramdisk/`:
145+
146+
```bash
147+
diskutil erasevolume HFS+ ramdisk $(hdiutil attach -nomount ram://8388608)
148+
```
149+
150+
Configure the RAM disk size, expressed as the number of blocks, at the end of the command
151+
(`4096 MiB * 2048 blocks/MiB = 8388608 blocks` for 4 GiB). To run the tests using the RAM disk:
152+
153+
```bash
154+
test/functional/test_runner.py --cachedir=/Volumes/ramdisk/cache --tmpdir=/Volumes/ramdisk/tmp
155+
```
156+
157+
To unmount:
158+
159+
```bash
160+
umount /Volumes/ramdisk
161+
```
162+
140163
#### Troubleshooting and debugging test failures
141164

142165
##### Resource contention

0 commit comments

Comments
 (0)