When using nextest for running tests each test is run in its own process so the old solution of using a static variable for the guest ID (used to determine the network segment) no longer works. Instead use a text file on the filesystem protected with an exclusive lock. The test process will read from it and then write back the next ID that can be used. It wraps around at the limit of u8 and skips ID 0. This function intentionally panics rather than propagate errors as it should only be called for testing purposes and there the panic handler will give a useful backtrace and cleanup. Signed-off-by: Rob Bradford <rbradford@rivosinc.com> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||